My playbook has no issues when running it on the command line. But in ansible controller, I am encountering this error:
[WARNING]: Found variable using reserved name: vars_files
ERROR! vars file /var/lib/awx/projects/Windows/roles/create/vars/appendvars.yml was not found
Could not find file on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
This is my playbook path:
/var/lib/awx/projects/Windows/playbook.yml
My playbook:
- name: Create from data
hosts: localhost
roles:
- role: Create
vars_files:
- /var/lib/awx/projects/Windows/roles/Create/vars/appendvars.yml
- name: Delete from data
hosts: localhost
roles:
- role: Delete
vars_files:
- /var/lib/awx/projects/Windows/roles/Delete/vars/appendvars.yml
Each of these vars_files contain the variables and their corresponding values, for me to reference the variable name in my playbook tasks.
I have already seen this question, ERROR! vars file vars not found on the Ansible Controller , but I am still unable to resolve my issue.
In the 'variables' section of Ansible Controller, I have already tried these:
vars_files:
- /roles/Create/vars/appendvars.yml
- /roles/Delete/vars/appendvars.yml
vars_files:
- appendvars.yml
- appendvars.yml
vars_files:
- /roles/Create/vars/appendvars.yml
- /roles/Delete/vars/appendvars.yml
vars_files:
- /var/lib/awx/projects/Windows/roles/Create/vars/appendvars.yml
- /var/lib/awx/projects/Windows/roles/Delete/vars/appendvars.yml
But I still get the exact same error message. What and where do I need to change to fix this error?
Based on @β.εηοιτ.βε 's suggestions,
In /roles/Create/vars/main.yml, I removed:
vars_files:
- /var/lib/awx/projects/Windows/roles/Create/vars/appendvars.yml
which was causing the warning: "[WARNING]: Found variable using reserved name: vars_files", and replaced it with all the variables from /roles/Create/vars/appendvars.yml
Did the same for the 'Delete' role too.
Correct playbook:
- name: Create from data
hosts: localhost
roles:
- role: Create
- name: Delete from data
hosts: localhost
roles:
- role: Delete