17 part series

Ansible From Basics to Advanced

Learn Ansible from the ground up to advanced topics: the agentless architecture, inventory, playbooks, modules, variables/templates, roles, vault, writing custom modules, and project-design best practices. Every hands-on part ships real code at github.com/nghiadaulau/ansible-series, practiced on EC2.

1

What Ansible Is and Why You Should Use It

Series opener: the configuration-management problem Ansible solves, why 'agentless' and 'idempotent' are the two most important keywords, the core concepts (control node, inventory, playbook, module, role), and the roadmap from basics to writing your own module.

Kai··5 min read·DevOpsAutomation
2

Ansible Architecture: Control Node, Inventory, Module and SSH

Deep dive into Ansible's architecture: control node, managed node, inventory, module. And exactly what happens when you run a command — Ansible packages the module, ships it over SSH to the host, runs it with the host's Python, gets JSON back. Observe it for real with -vvv.

Kai··5 min read·DevOpsArchitecture
3

Installation and Your First Ad-hoc Commands

Set up the control node (install Ansible), prepare a host to manage, write the config and inventory files, then run your first ad-hoc commands: ping, command, shell, setup, and become to run as root.

Kai··4 min read·DevOpsAutomation
4

Inventory: Static, Dynamic, Groups and Variables

Inventory is where Ansible knows which machines to manage. This article: write a static inventory (INI/YAML), gather hosts into groups and nested groups, assign variables via group_vars/host_vars, target with patterns, and dynamic inventory for the cloud.

Kai··4 min read·DevOpsAnsible
5

Playbook: Structure and Tasks

The playbook is the heart of Ansible — a YAML file describing desired state. This article: the structure of plays and tasks, writing and running your first playbook to install a web server, reading the PLAY RECAP, FQCN, and check mode (dry-run).

Kai··4 min read·DevOpsAnsible
6

Modules and Idempotency

Deep dive: how a module works internally to achieve idempotency — read the current state, compare to desired, change only the difference, then report changed. Why command/shell aren't idempotent, check mode, and a tour of common modules.

Kai··5 min read·DevOpsAnsible
7

Variables, Facts and Templates (Jinja2)

Make playbooks flexible: variables (declared in many places, with a precedence order), facts (host information Ansible gathers automatically), and Jinja2 templates to generate config files dynamically from variables and facts. Watch the rendered file appear on a real host.

Kai··5 min read·DevOpsAnsible
8

Handlers, Loops and Conditionals

Control playbook flow: loop to repeat a task over many values, when to run conditionally, handlers to react to changes (restart on config change), and block/rescue for clean error handling. With real run logs.

Kai··5 min read·DevOpsAnsible
9

Roles: Organizing Reusable Code

As a playbook grows, you need organization. A role is how Ansible packages tasks, handlers, templates, and variables into a reusable unit with a standard directory structure. This article: create a role with ansible-galaxy init, fill it in, and use it in a playbook.

Kai··4 min read·DevOpsAnsible
10

Ansible Galaxy and Collections

Ansible's modern packaging and distribution: a collection bundles modules, roles, and plugins under one namespace; FQCN for explicit calls; installing collections from Galaxy with requirements.yml; and distinguishing ansible-core from the full ansible package.

Kai··3 min read·DevOpsAnsible
11

Ansible Vault: Managing Secrets

Passwords and API keys can't sit in plaintext in Git. Ansible Vault encrypts secrets with AES256, decrypting automatically at run time. This article: encrypt/view/edit secret files, encrypt_string for individual values, using them in a playbook, and best practices.

Kai··4 min read·DevOpsSecurity
12

Writing a Custom Module in Python

Deep dive: write your own Ansible module in Python. Understand AnsibleModule, argument_spec, exit_json/fail_json, supporting check_mode, and the pattern for achieving idempotency. This is where the mechanism from Article 1 (shipping a module over SSH) comes full circle.

Kai··5 min read·DevOpsAnsible