Variables on Extra-Vars within Extra-Vars-File

13 views
Skip to first unread message

wpgpo...@gmail.com

unread,
Sep 14, 2023, 12:42:18 PM9/14/23
to Ansible Project
Hello Groups,

Is there any way that we can have a variable within a variable-file?

Example:
ansible-playbook -i localhost -e "test=var1 some=ex_1" -e "@files/dev/sample_ex_1.yml"

Desired:
ansible-playbook -i localhost -e "test=var1 some=ex_1" -e "@files/dev/sample_{{ some }}.yml"


Thank you...

Brian Coca

unread,
Sep 14, 2023, 3:50:24 PM9/14/23
to ansible...@googlegroups.com
No, buton the other hand... its still shell:

ansible-playbook -i localhost -e "test=var1
some=${THIS_IS_AN_ENV_VAR}" -e
"@files/dev/sample_${THIS_IS_AN_ENV_VAR}.yml"

--
----------
Brian Coca

wpgpo...@gmail.com

unread,
Sep 14, 2023, 4:42:41 PM9/14/23
to Ansible Project
Yes, that is what I'm actually doing by putting the same value.

Thank you
Reply all
Reply to author
Forward
0 new messages