June 2020
Intermediate to advanced
410 pages
9h 52m
English
Some execution failures derive from the state of the target machine. The most common problem of this kind is the case where Ansible expects a file or variable to be present, but it's not.
Sometimes, it can be enough to print the machine facts to find the problem.
To do so, we need to create a simple playbook, called print_facts.yaml, which contains the following content:
---- hosts: target_host tasks: - name: Display all variables/facts known for a host debug: var: hostvars[inventory_hostname]
This technique will give you a lot of information about the state of the target machine during Ansible execution.