Ansible module Debug
The ansible module debug outputs contents of variables.
For insance here a variable associated with a specific host:
- name: Show all variables/facts known for a host
debug:
var: hostvars['myserver.example.com']
verbosity: 1 # default verbosity is 0, max verbosity is 4
So it displays:
- Facts they gathered about the host: all things Ansible gathers about the host. Things like IP addresses, disk space etc.
- Facts from host vars and group vars: if we have variables defined for the specified host in host_vars or group_vars, they are displayed too.
- Facts defined in the role: for example in defaults/main.yaml
- All other variables that set during the execution of the playbook: variables for the playbook, variables specified on the commandline or facts registered during the exectution of the playbook.
Example how to specify a variable on the command line:
ansible-playbook example_playbook.yml -e "example_variable=example_value"