Skip to content

Ansible

inventory file (example)

[webservers]
web1.example.com
web2.example.com
192.0.2.42

[db-servers]
db1.example.com
db2.example.com

ansible.cfg (example)

[defaults]
remote_user = devops
inventory = inventory

[privilege_escalation]
become = False
become_method = sudo
become_user = root
become_ask_pass = False

To verify your playbook you can use the command below:
ansible-playbook --syntax-check

To perform a dry run for your playbook you can use the command:
ansible-playbook -C

dynamic inventory files
References
Working With Dynamic Inventory: Ansible Documentation
https://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html
Developing Dynamic Inventory: Ansible Documentation
https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html

Leave a Reply

Your email address will not be published. Required fields are marked *