← Categories

Automation

Ansible and Infrastructure as Code: the agentless model, idempotency, playbooks, roles, IaC.

Ansible

Agentless automation: ad hoc commands, idempotency, playbooks, roles.

01 · theory
What is Ansible

Agentless push model, control node and managed nodes over SSH. Why you need it and what to install.

12 min · intro
02 · theory
Inventory and ad-hoc commands

Inventory in ini and yaml, host groups, ad-hoc commands with -m, the ping/command/shell/copy modules.

13 min · easy
03 · theory
ansible.cfg and basic settings

Where ansible.cfg lives and the search order. host_key_checking, inventory, remote_user, become.

12 min · easy
04 · theory
Running without Python on the host

A managed node usually needs Python. The raw module, gather_facts: no, bootstrapping Python, and the script module.

12 min · medium
05 · theory
Idempotency and why "bashible" is bad

changed vs ok, why command/shell aren't idempotent, creates/removes, changed_when, --check and --diff.

14 min · medium
06 · theory
Your first playbook

The structure of a YAML playbook: hosts, become, tasks, handlers, notify, vars, when, loop, Jinja2 templates, and block/rescue/always. Running ansible-playbook.

15 min · medium
07 · theory
Roles and folder structure

tasks/handlers/templates/files/vars/defaults/meta, autoloading main.yml, ansible-galaxy init, defaults vs vars.

15 min · medium
08 · theory
Variables, facts, and precedence

Where to declare variables, what facts are (ansible_facts), register, set_fact, and how Ansible resolves conflicts by precedence.

15 min · medium
09 · theory
Safe production runs

Dry run with --check and --diff, narrowing with --limit, tags, and a gradual rolling update with serial. How to ship changes without taking down production.

14 min · medium
10 · theory
Dynamic inventory and collections

Static inventory doesn't scale in the cloud. Inventory plugins (AWS, Yandex Cloud), grouping by tags, and collections from Galaxy.

16 min · medium
11 · theory
Secrets: Ansible Vault

Passwords and keys can't go into git in plaintext. ansible-vault encrypts whole files or single values, and in CI the password comes from a protected variable.

13 min · medium
12 · quiz
Check: Ansible

Ten questions: the agentless model, idempotency, ad-hoc commands, playbooks, roles, rolling updates, and dynamic inventory. You can retake it.

10 min · easy

Infrastructure as Code

The idea behind IaC, Terraform, GitOps, modules, remote state.