Ansible Basics: Getting Started

When Scale landed on my lap, I didn’t speak Ansible. I don’t know that I would say I do, today, but I’ve certainly ground out a bunch of playbooks that have made the process a lot more palatable, and made the care and feeding of my clusters more manageable.

Server Build

See more: Ansible Basics: Server and Version Control

Ansible Parts and Pieces

There are only a few things to know to get started with Ansible, and they are fairly straightforward, if you know the vocabulary. I’ve expanded these into their own topics.

See more: Ansible Basics: Inventory

See more: Ansible Basics: Variables

So now we’re set up! Onward to running playbooks.

Running the Playbooks

On your ansible host, now that you’ve got your inventory and variables, its time to write a playbook that DOES something! I’ll post some examples of those in other topics, but the anatomy of the command is as follows:

ansible-playbook playbookname.yaml -e@vars.yaml -i inventory.yaml -l "100" -e "other_variables=1"

We can take this apart pretty easily!

  • ansible-playbook is the binary we’re running, the application that processes the whole mess.
  • playbookname.yaml is the file that tells ansible what it’s doing.
  • -e@vars.yaml is our big variable file. We reference it here
  • -i inventory.yaml is the inventory file, which will specifiy the hosts that this playbook will target. We reference it here
  • -l "100" allows us to “limit” the playbook run to a comma separated list. In this example, we are only running this playbook on the host “100”.
  • -e "other_variables=1" allows us to specify any other variables that are not in our vars.yaml

Here is the playbook tag, that’ll show you all the topics posted about playbooks!

Interpreting Results

– more soon here –