Ansible
Agentless configuration management.
Ansible is taught here in 12 lessons, running from Inventories and ad-hoc commands through to Scaling: dynamic inventory and AWX. Each lesson takes one topic, shows the working code, and links onward to the next, so the course can be read straight through in order.
| Track | DevOps & Tooling |
| Lessons | 12 |
| Level | Beginner to intermediate |
| Reading time | about 3 hours |
| Prerequisites | Helpful, but not required: Bash Scripting |
Lessons
- Inventories and ad-hoc commandsDescribe your machines in an inventory, connect over SSH without installing an agent, and run one-off tasks from the command line.
- Playbooks and modulesA playbook is YAML that states the desired end result: plays, tasks, module arguments, variables and handlers.
- Roles, Vault and idempotencyPackage reusable automation as roles, keep secrets encrypted with Vault, and write tasks that converge instead of repeating themselves.
- Installing Ansible and setting up a control nodeInstall the package or the pip distribution, configure ansible.cfg with a predictable precedence, set up SSH keys and become, install collections, and check connectivity.
- Variables, facts and Jinja2 templatingVariable precedence, defaults and vars files, magic variables, gathered and custom facts, the template module, and Jinja2 filters, tests and conditionals.
- Conditionals, loops and handlers in depthwhen expressions and registered results, loop and its controls, until with retries, changed_when and failed_when, and handler ordering with flush_handlers.
- Managing files, packages and servicescopy, template and file, lineinfile and blockinfile, the package abstraction, systemd and service management, and handler-driven restarts.
- Users, SSH keys and secure defaultsCreate users and groups, manage authorized keys, write sudoers rules safely, set permissions and sysctl, and keep Vault secrets out of the logs.
- Collections, Galaxy and the module ecosystemCollections versus roles, installing from a requirements file, FQCN module names, the ansible-galaxy commands, and evaluating a third-party role before you depend on it.
- Error handling, blocks and rescueblock, rescue and always, ignore_errors and failed_when, asserting prerequisites, retries and timeouts, and making a failed run safe to repeat.
- Testing automation: lint, check mode and Moleculeansible-lint profiles and rules, --check and --diff with their limits, Molecule scenarios on containers, and running the whole thing in CI.
- Scaling: dynamic inventory and AWXCloud and CMDB inventory plugins, inventory caching, delegation and serial strategies, delegated facts, and a controller with AWX or Automation Platform workflows.
More in DevOps & Tooling
Git Linux Docker Kubernetes Nginx CI / CD Bash Scripting
FAQ
How long does the Ansible course take?
It has 12 lessons, about 3 hours of reading. Expect roughly twice that if you type out and run every example.
Do I need prior experience for Ansible?
Not strictly. It helps to have read Bash Scripting first, because some lessons build on it, but every lesson explains its own assumptions.
What should I read after Ansible?
This is the last course in DevOps & Tooling right now. Browse the other tracks from the courses index to go sideways.