I would like add my hostnames with external files.
I have used in my playbook master vars_files
to add my hostnames, and it doesn't seem to be working.
I need to add the hostnames in external files from my ansible's project.
I cannot used hosts files and group, because I use Ansible Tower (3.2.2) and it have already his own inventory.
Please note I can't, for some reasons, add my vars_files
in my Ansible's project.
I Have already tried to add the absolute path.
EDIT: Note the error message below is only via Ansible Tower execution.
With command line, it is working fine.
---
- hosts: "{{ hostnames }}"
# include vars from file
vars_files:
# this line doesn't work
- /project/ansible/home/ansible/ansible_scripts/vars/dev.yml
# this line doesn't work
# - /project/ansible/home/ansible/ansible_scripts/vars/dev.yml
# this line doesn't work
# - ../../../ansible/home/ansible/ansible_scripts/vars/dev.yml
# this line works fine
# - vars/dev.yml
# play roles
roles:
- check_info_servers
The error is:
ERROR! vars file project/ansible/home/ansible/ansible_scripts/vars/dev.yml was not found on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option