You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Result:
No prompt.
vars/test.yml would loaded in order
pre_tasks, roles, post_tasks are printing config_names value from test.yml as expected.
Execution 2:
ansible-playbook -i test.yml playbook.yml
Result:
Prompts for filename.
pre_tasks and post_tasks are printing config_names value from test.yml
roles is using value from vars/static.yml file.
Summary
Some how the workflow is missing to consider prompted variable values for roles section ( not sure of underneath task ). My case is more complex, I have split up prompt and tasks into two different playbooks and included in sequential order in top playbook. The first playbook prompts and set variables using set_fact task. The second playbook would be called after executing the first, so as expected the verbose shows of loading right file then using right values in pre and post tasks. Roles failed to recognize the overridden value.
Cheers
Venkat Vagga
The text was updated successfully, but these errors were encountered:
Hi,
I have observed the following behavior in the following scenario.
var files
vars/static.yml
config_names:
- value1
- value2
vars/test.yml
config_names:
- value3
- value4
playbook
vars_prompt:
- name: "filename"
prompt: "Filename"
private: no
when: filename is not defined
vars_files:
- vars/static.yml
- [ vars/ {{ filename }}. yml, vars/static.yml ]
pre_tasks:
- debug: msg="{{ item }}"
with_items: config_names
roles:
- { role: test, with_items: config_names }
post_tasks:
- debug: msg="{{ item }}
with_items: config_names
Execution 1:
Result:
No prompt.
vars/test.yml would loaded in order
pre_tasks, roles, post_tasks are printing config_names value from test.yml as expected.
Execution 2:
Result:
Prompts for filename.
pre_tasks and post_tasks are printing config_names value from test.yml
roles is using value from vars/static.yml file.
Summary
Some how the workflow is missing to consider prompted variable values for roles section ( not sure of underneath task ). My case is more complex, I have split up prompt and tasks into two different playbooks and included in sequential order in top playbook. The first playbook prompts and set variables using set_fact task. The second playbook would be called after executing the first, so as expected the verbose shows of loading right file then using right values in pre and post tasks. Roles failed to recognize the overridden value.
Cheers
Venkat Vagga
The text was updated successfully, but these errors were encountered: