This repo is meant to be used as part of a presentation to introduction people to Ansible. Each branch represent a lesson, and the presenter should iterate through each branch describing each Ansible concept. A minimum of 2 Linux systems is required for demonstrating concepts. Talking points and links to documentation are provided in for each branch.
Clean install directory layout.
- Look at the ansible.cfg file. The file is well documented but you can get more details at the Ansible Configuration file link
- Take a look at the hosts file. This is where you can define your inventory, some examples are provided. For more details see the Ansible Inventory documentation
Populate the inventory file and simple playbook.
- Inventory, demonstrating the concept of groups, group of groups, and aliases. Read more Ansible Inventory documentation
- Simple playbook that will check to make sure it can talk to each host via ssh. Read:
Use shell module, how to register(store) output from the shell command into a variable, and use debug module to print the values to the screen.
- Run a shell command to gather disk usage and store results in a variable. Read:
- Use the debug module to print out the variable contents in two different ways.
Shell commands will always report a change even if you are just doing a directory listing. Behavior can be overwritten with changed_when property.
Playbook to copy a file demonstrating rename from src to dest and backup options.
Copy more than one file in a task, demonstrating the with_items feature of Ansible
A continuation of standard loops (with_items) using list of hashes.
Concept of group and host variables in reference to the inventory, and how to use the template module to render templates as files on destination system.
Group/Host variables organizational layouts options.
Variable overwrite concept and Variable precedence
Ansible roles and structure, demonstrating a role with 3 tasks
Choosing template over copy and how comment filter in templates makes it a better choice over copy
JINJA2 syntax in combination with group_vars, demonstrating for
loop and if
conditional
- jinja: for
- jinja: if
- Group_vars/all:
Run specific parts of a playbook with tags.