Looking for some guidance:
I have a 3 step workflow - the first 2 templates use set_stats
to set some fact data. eg:
- set_stats:
data:
xldeploy_workstation_host : "{{ hostvars['localhost']['targethost'] }}"
when: tower_job_id is defined
and
- set_stats:
data:
target_inv: "xld{{ env }}"
target_env: "{{ env }}/TEMPLATE"
app_system: "{{ system | lower }}"
when: tower_job_id is defined
In the 3rd template, it uses the app_system
variable like so:
- name: Run {{ app_system }} playbook
import_playbook: "{{ app_system }}.yml"
However, I get the below error message:
ERROR! 'app_system' is undefined
I can see that set_stats
worked by looking at the logs of the previous steps in the workflow:
ok: [1.2.3.4] => {
"ansible_stats": {
"aggregate": true,
"data": {
"xldeploy_workstation_host": "*host.fqdn*"
},
"per_host": false
},
"changed": false
}
and
ok: [1.2.3.5] => {
"ansible_stats": {
"aggregate": true,
"data": {
"app_system": "*app*",
"project_name": "*projectname*",
"target_env": "dev/TEMPLATE",
"target_inv": "xlddev"
},
"per_host": false
},
"changed": false
}
Not sure why the last step in the workflow is not picking up the set_stats
data - it looks like it should work according to the documentation.
I am using Tower version 3.2.2 and Ansible version 2.4.3.0