11.1 · What configuration management actually is
Definition. Configuration management is the practice of declaring the desired state of a running host — packages, files, services, users, kernel params — and using a tool to converge the actual state toward it, repeatedly and safely. It is distinct from infrastructure as code, which provisions the host itself (the VM, the disk, the network).
| IaC (Ch 10) | CM (this chapter) | |
|---|---|---|
| Operates on | Cloud / hypervisor APIs | OS inside the box |
| Lifetime | Resource lifecycle (create / update / destroy) | Continuous (every 30 min) |
| Example | "Create an EC2 m6i.large with 200 GB gp3." | "Ensure nginx 1.25 is installed, running, with this config." |
| Tools | Terraform, Pulumi, Bicep, CFN | Ansible, Chef, Puppet, Salt, DSC, Nix |
11.2 · The big four — origins & status
Ansible (2012)
Michael DeHaan, acquired by Red Hat 2015. Agentless, YAML playbooks, push over SSH/WinRM. Now Ansible Automation Platform (AAP). Open-source core: ansible-core 2.18 (Nov 2024).
Chef (2009)
Adam Jacob's "Opscode". Ruby DSL recipes → cookbooks → runlists. Agent (chef-client) pulls from Chef Server. Acquired by Progress 2020. Open-sourced again as Chef Infra.
Puppet (2005)
Luke Kanies — the original. Ruby DSL, declarative. Agent pulls catalog every 30 min from Puppet Server. Acquired by Perforce 2022. Puppet Open Source → OpenVox fork in 2024.
SaltStack (2011)
Thomas Hatch. Python; ZeroMQ message bus for sub-second push. Acquired by VMware 2020, then Broadcom 2023. Now Salt Project.
| Tool | Model | Language | Transport | 2026 status |
|---|---|---|---|---|
| Ansible | Push (or pull via ansible-pull) | YAML | SSH / WinRM | Still the most-used CM tool; AAP for the enterprise. |
| Chef Infra | Pull | Ruby DSL | HTTPS | Niche; strong in regulated finance. |
| Puppet / OpenVox | Pull | Puppet DSL (Ruby-ish) | HTTPS | Long-tail enterprise; OpenVox in 2024. |
| SaltStack | Push (event bus) or masterless | YAML + Jinja, Python | ZeroMQ | Strong in telco / large fleets. |
11.3 · Why CM faded
Two forces hollowed out the CM mainstream after 2014:
- Immutable infrastructure — Netflix popularised the phrase in 2013: instead of mutating a live host, bake a new image (AMI) and roll the fleet. Mutation surface = drift surface; rebuild is cheaper than reconcile.
- Containers + Kubernetes — the application brings its own filesystem; the host just runs
containerd. The "interesting" config now lives in container images and K8s manifests, not in/etc.
11.4 · Where CM still wins in 2026
- Bare-metal servers — racked HPC, hypervisors, storage filers. No container abstraction; you still configure the host.
- Network gear — Cisco IOS, Juniper Junos, Arista EOS.
ansible-networkcollections speak NETCONF/SSH; Nornir for Python shops. - Windows fleets — domain joins, DSC (Desired State Configuration), GPO orchestration. Ansible + WinRM or PowerShell DSC.
- Regulated / air-gapped — defence, classified, OT plants. Pull-based agents over an internal mirror; signed catalogs.
- Hybrid cloud — when one playbook has to configure RHEL on prem, EC2, and an Azure VM identically.
- IoT / edge fleets — Raspberry Pi farms, kiosks, retail POS, vehicles. AWS IoT Greengrass + Ansible-pull on boot.
11.5 · Ansible — the canonical CM tool today
| Concept | What it is |
|---|---|
| Inventory | List of hosts (INI / YAML / dynamic plugin from EC2, Azure, GCP, Kubernetes). |
| Playbook | YAML file mapping hosts → ordered list of tasks. |
| Module | Idempotent unit of work (apt, copy, systemd, kubernetes.core.k8s). |
| Role | Reusable bundle: tasks/, handlers/, templates/, defaults/, meta/. |
| Collection | Distribution unit since v2.10 — roles + modules + plugins, versioned, published. |
| Galaxy | Public registry of roles + collections (galaxy.ansible.com). |
| AWX / AAP | Web UI, RBAC, scheduling, job templates, surveys. AAP is the supported Red Hat product. |
| ansible-lint | Style + correctness linter; CI-friendly. |
| Molecule | Role testing framework — spins Docker/Podman/EC2, applies role, verifies. |
# site.yml — minimal hardening playbook
- hosts: webservers
become: true
roles:
- common
- { role: nginx, nginx_version: '1.27' }
- { role: ufw, ufw_allowed_tcp: [22, 80, 443] }
tasks:
- name: Ensure unattended-upgrades is on
ansible.builtin.apt:
name: unattended-upgrades
state: present
11.6 · Agentless vs agent — the eternal trade-off
| Agentless (Ansible) | Agent (Puppet, Chef, Salt minion) | |
|---|---|---|
| How runs start | Push from a control node over SSH/WinRM. | Daemon on each host polls or listens. |
| Bootstrapping | SSH key + Python — trivial. | Install package + register cert — extra step. |
| Scale ceiling | Thousands per controller; uses mitogen / async / forks. | Tens of thousands per master (Salt: 100k+ minions documented). |
| Convergence cadence | When you run it. | Continuous — e.g. Puppet every 30 min by default. |
| Network direction | Outbound from controller. | Outbound from each host (firewall-friendly). |
| Failure blast radius | One bad task = wide push fan-out. | Self-healing if master is briefly down. |
11.7 · Idempotency — the central concept
Definition. An operation is idempotent if running it once or running it ten times produces the same end state. CM modules must be idempotent: state: present should be a no-op when the package is already installed.
shell: echo line >> /etc/hosts) silently corrupts state every 30 minutes. Prefer lineinfile / blockinfile / typed modules over raw shell / command.11.8 · Drift detection & compliance
- Puppet — agent runs every 30 minutes by default; reports back to PuppetDB; dashboards flag "out of sync".
- Ansible —
--checkmode (dry-run) +--diff; can be cron'd as a compliance scanner. - Salt —
state.highstate test=true;salt-run jobs.list_jobsfor audit. - OpenSCAP — NIST-driven configuration scanner; STIG, CIS, PCI profiles.
- InSpec (Chef) — Ruby DSL for compliance tests;
describe package('openssl') do its('version') { should cmp >= '3.0' } end. - Goss / dgoss / Serverspec — lightweight server-state assertions, often run inside Molecule.
11.9 · Bootstrapping & cloud-init
The modern pattern layers three tools so each does what it's best at:
- Packer (HashiCorp, BSL since 2023) — bake base image with kernel hardening, agents pre-installed.
- cloud-init — the de-facto multi-cloud first-boot agent (Ubuntu/Debian/RHEL/Amazon Linux). Handles networking, SSH keys, hostname.
- Ansible (or Chef/Salt) — the variable, environment-specific bits (app config, secrets, certificates).
11.10 · The modern alternative — Nix / NixOS
Definition. Nix (Eelco Dolstra, 2003 PhD thesis; v2.18 LTS in 2024) is a purely functional package manager. NixOS applies the same idea to the whole OS: the entire system is built from a deterministic expression in configuration.nix; switching configs is atomic and rollback-able.
| Property | Traditional CM | NixOS |
|---|---|---|
| State model | Convergent (drives existing state toward target) | Constructive (builds the target from scratch) |
| Rollback | "Run a previous playbook" — fragile | Reboot into a previous generation — atomic |
| Reproducibility | Best-effort | Bit-for-bit reproducible builds |
| Adoption | Mainstream | Niche but growing (Determinate Systems, Replit, Anduril) |
11.11 · Replacement strategy — phasing CM out gracefully
- Inventory the playbooks. Tag each by why it still exists:
host config ,app deploy ,network gear ,compliance . - App-deploy plays — migrate first; replace with a container image + K8s/Nomad manifest.
- Host-config plays — fold into Packer-baked AMIs + cloud-init for the volatile bits.
- Compliance plays — keep as scheduled
--checkruns; treat output as audit telemetry, not enforcement. - Network gear & air-gapped sites — keep CM indefinitely; there is no container alternative.