Can anyone please help me here, I have a playbook which has the following vars:
vars_files:
- "../vars/location.yml"
The location.yml has the following declared:
loc: "{{ inventory_hostname[0:3] }}"
location_file: "/root/ansible/vars/{{ loc }}.yml"
So from hostname location_file: is then prd.yml, this file contains the line:
txm_QA_access: false
Now if I run the playbook which copies a sudoers template with the following conditional specified in it:
{% if txm_QA_access %}
%Sudo-admin ALL= /bin/su - admin
%Team-QA ALL= /bin/su - admin
%Team-QA\ OffShore\ \(UK\) ALL= /bin/su - admin
{% endif %} `
When I run the playbook I get an error:
"msg": "AnsibleUndefinedVariable: `txm_QA_access` is undefined"
Where am I going wrong? Isn't it defined as a Boolean which is false so in theory it should skip adding those lines in the sudoers template?
Any help appreciated spent hours on this now.