Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 1.69 KB

README.md

File metadata and controls

41 lines (27 loc) · 1.69 KB

Ansible Facts

Ansible Facts contain useful information during playbooks executions in order to take some decision or use them based on this information. On the other hand, it is a powerful tool to collect some extra information about the nodes which are beeing managed by Ansible.

In order to understand this lesson properly, a set of steps have been designed to be implemented in the following section.

ENJOY !!!

Steps

  • Create an inventory file named "inventory" with a group named "myinstance" and your internal instance IP assigned included
  • Create a playbook named "facts-playbook.yml" using "myinstance" as a hosts parameter and <studentxx> as a user. The playbook should use tasks to ensure that the following conditions are met on the managed hosts:
    • Create a folder /named "etc/ansible/facts.d"
    • Create a custom facts "/etc/ansible/facts.d/custom.fact" file with a variable named "haproxy_ip" which includes instance ip
    • Print local facts "haproxy_ip"
    • Create a new variable named "life_variable" with date content
    • Print variable "life_variable"
  • Before running your playbook, run the ansible-playbook --syntax-check command to verify that its syntax is correct
  • Run the playbook!

Useful Links

For more information, please visit:

License

BSD

Author Information

Asier Cidon - Cloud Consultant

[email protected]