]> git.ekhem.eu.org Git - metadata.git/commitdiff
[config] Expand variables before creating the fact file.
authorJakub Czajka <jakub@ekhem.eu.org>
Sun, 3 Dec 2023 12:57:53 +0000 (13:57 +0100)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:45:06 +0000 (19:45 +0100)
Ansible does not expand variables.

config.git/deploy.yaml

index 83df766b4ed8e2c572e2772e11fdd566af8f3dd2..d7f233cb095c61e155440a82ff88e1fa7fa4483f 100644 (file)
@@ -15,6 +15,8 @@
         state: directory
       become: true
     - name: Export environment as ansible facts in the .ini format
-      shell: sed --expression 's/export\s//g ; s/\"//g ; 1s/^.*$/[vars]/' \
-        /etc/environment > /etc/ansible/facts.d/env.fact
+      shell: envsubst < /etc/environment \
+        | sed 's/export\s//g ; s/\"//g ; 1s/^.*$/[vars]/' \
+         > /etc/ansible/facts.d/env.fact
+      environment: "{{ ansible_local.env.vars }}"
       become: true