Skip to content

Ansible

Warning

Missing video.


If IAC gives us the ability to write code and get infrastructure, what gives us the ability to write code and get OS and application level configuration? Configuration As Code, or CAC. Ansible is a CAC tool.

Like Terraform, we define state and it's converted into reality for us. With Ansible, however, we're defining the state we want our operating systems and software to be in. Things like users on a system, software that's installed, files that should be present, services/processes that should be running, and (much) more.

Ansible doesn't use HCL2 like Terraform, but instead uses YAML (Yet Another Markup Language) to define state. This state is then parsed by Ansible in a linear fashion (unlike Terraform, which produces a graph and then executes in the correct order based on what depends on what).

Ansible gives us the ability to define the state of our operating systems as code, which gets us all the exact same benefits that IAC gave us - basically everything developers have had for decades, like CI/CD.

Curated Materials

First, get Ansible installed on your system. We highly recommend you use a Python virtual environment, something you've already done when you made Tightly:

python3 -m venv venv
source venv/bin/activate
pip install ansible
try python if python3 does not work

You might not need to use python3. You might be able to get away with just typing python depending on your platform and a lot of other factors. Just use whatever gets you a Python 3 (not 2) virtual environment.

Once you've got Ansible installed, move onto this excellent tutorial from Digital Ocean (a pretty cool Cloud provider.) This tutorial is very comprehensive and will prepare you for this topic's projects and challenges.

Ansible can get more complicated than this. You can write your own modules in Python, custom inventories, collections, and more. But for now, you're simply interested in the concept and the basics.

Project(s)

Warning

Missing content.

Challenges

Warning

Missing content.