I have the following playbook working in Ansible 1.9, where in i like to
include a play at run time based on variable passed either as command line
argument or declared under 'vars'.
- name: include another play
vars:
var_name_1: var_value_1
var_name_2: var_value_2
include: "code/folder/{{ var_name_1 }}.yml"
The playbook included the play inside the file
'code/folder/var_value_1.yml' successfully. However the same play book
throws the following error in Ansible 2.0
ERROR! the file_name 'code/folder/{{ var_name_1 }}.yml' does not exist, or
is not readable
As i understand, Ansible 2.0 is not able to interpolate filenames with
variables.
The same issue exists for 'vars_files' also, for which i used the
'include_vars' under 'tasks' as a workaround to include var files at
runtime.
Questions:
1. Why was this feature removed or excluded, assuming my code is valid
for 2.0?
2. What are the options for including a play at runtime in Ansible 2.0?
posted
from
http://stackoverflow.com/questions/33623050/ansible-2-0-interpolate-filenames-with-variables
--
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/717e06aa-4c74-4280-b03d-eca0139d5e37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.