Summary
A summary of the content covered in the chapter.
We'll cover the following
This chapter introduced Site
, Ansible roles, how to create and version them, and how to use the Ansible tooling to ensure productivity and reusability.
Configuration management
We started by introducing configuration management as a system engineering process to establish and maintain the consistency of your infrastructure through automation.
Configuration changes flow through a system in response to the following events:
- A new machine has been deployed.
- A configuration modification has been requested.
- Validation of the current configuration is required.
Site
Site is a term used in Ansible’s documentation to define an application’s holistic configuration, service, or environment.
You created a site.yml
file to centralize your automation configurations. To reuse the existing playbooks, you used the import_playbook
method.
Ansible roles
We introduced Ansible roles because they simplify writing complex playbooks by breaking them into multiple files and providing a framework for developing a fully independent collection of variables, tasks, files, templates, and modules.
We looked into the role directory layout that Ansible recognizes;
|-- roles/| |-- chocolatey/| | |-- tasks/| | | |-- main.yml| | |-- handlers/| | | |-- main.yml| | |-- files/| | |-- templates/| | |-- vars/| | | |-- main.yml| | |-- defaults/| | | |-- main.yml| | |-- meta
In the end, you created your first role, chocolatey
.
Decouple the Ansible roles
To manage your infrastructure as code, we introduced Ansible Galaxy roles.
Ansible Galaxy roles allow you to decouple the role from the core Ansible repository. Galaxy roles are stored in their own git repository, making it possible to develop and version the role independently.
You first created another repository for your role, chocolatey
. We looked into the requirements.yml
to make use of your newly created role repository.
- src: https://github.com/Duffney/chocolatey.gitscm: gitversion: "v1.0"name: chocolatey
We looked into the following options with the ansible-galaxy
command:
init
: To auto-generate the role directory structure.install
: To install the Galaxy role.
Lastly, you used release tags
to version Ansible roles.
Delete the environments
In case you are going to visit the rest of the course later, you can delete the infrastructure to avoid any unexpected bills.
Disclaimer: Run the playbook at your own risk!
It is highly recommended you use a development AWS account and Azure subscription before executing these playbooks.
You can review the playbooks in the sections for Deploy to Azure and Deploy to AWS to delete the infrastructure.
Get hands-on with 1300+ tech skills courses.