7. ANSIBLE PLAYBOOKS
• Playbooks are text file written in YAML format. Compared to the languages
used in other configuration management tools such as puppet, the
syntax used in playbook is much easier to write and comprehend.
• In comparison with ad-hoc commands, playbooks are used in complex
scenarios, and they offer increased flexibility.
• Playbooks use YAML format, so there is not much syntax needed, but
indentation must be respected. Ansible playbooks tend to be more of a
configuration language than a programming language.
• Like the name is saying, a playbook is a collection of plays. Through a
playbook, you can designate specific roles to some of the hosts and
other roles to other hosts. By doing so, you can orchestrate multiple
servers in very diverse scenarios, all in one playbook.
@2020 copyright KalKey training
10. COMMANDS
• ansible-playbook playbook.yml –syntax-check //checking the
syntax of the playbook
• ansible-playbook playbook.yml //run the
playbook
• ansible-playbook –i inventory playbook.yml // run the
playbook with custom inventory
• ansible-playbook --step playbook.yml //run the playbook
with step by step execution
@2020 copyright KalKey training
11. MANAGING VARIABLES
• Variables in Playbook
• Host variables and group variables
• Managing Facts
@2020 copyright KalKey training