I know subject sounds kind of crazy, but here's the code to explain it a
bit:
- hosts: all
vars:
- djbdns_var:
FOO: "DJ DNS"
- vnstat_var:
FOO: "VN, stat!"
tasks:
- name: Test flexible vars
command: echo "$FOO"
environment: "{{ item }}_var"
with_items:
- djbdns
- vnstat
which should be equivalent to something like:
tasks:
- name: Test flexible vars (step 1)
command: echo "$FOO"
environment: djbdns_var"
- name: Test flexible vars (step 2)
command: echo "$FOO"
environment: vnstat_var"
so what I'm trying to do is define different set of environment variables
for each step of iteration, and the best way I figured was something like
above. However it doesn't work. Ansible (1.5.3) recognizes passed argument
as a string and throws an error rather than interpret resulting variable
name.
Question is: can something be done to accomplish what I'm trying to do?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/5e8abf0d-04c2-4859-b74f-929093931038%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.