There are some specific Ansible configuration choices that I have made.
If you have your group_vars
and host_vars
in the root directory, and the hosts file in a different directory, Ansible will not pick up the group_vars
and host_vars
files. This is because Ansible will look for the group_vars
and host_vars
in the same directory as the hosts file. This only appears when using playbooks in a different directory to the hosts file.
Variables that are used in roles, should prefix their role name, i.e. the role webserver is webserver_port
.
Handlers should be named <role>::<action>
. i.e. nginx::reload
.
ansible -m debug -a "var=vars" <your_host>
- debug all variables for a given host