Chapter 01 · Fundamentals of Automation
Fundamentals of Automation
What is configuration management?
Configuration management aims to describe and maintain the desired state of a system: installed packages, running services, files present with the correct content, users, permissions, settings, and so on. The central idea is to declare what you want, rather than write scripts specifying how to click through everything to achieve it.
Key term: idempotence. Running the same automation ten times should not accumulate side effects; instead, it should converge towards the same state.
Objectives of this type of tool
- Reproducibility: the same configuration everywhere, every time.
- Traceability: configuration is stored as code (Git), providing a history and enabling reviews.
- Reduction of human error: especially mistakes made at 2 a.m.
- Speed: deploy, fix and rebuild faster.
- Standardisation: the same patterns and conventions.
How does Ansible compare with Puppet or Chef?
In very broad terms:
| Tool | Approach | Typical characteristics |
|---|---|---|
| Ansible | Agentless (SSH/WinRM), YAML | Easy to get started with, readable, excellent for orchestration and configuration management (CM) |
| Puppet | Agent-based (often), DSL | Strong at maintaining state continuously; large enterprise ecosystem |
| Chef | Agent-based, Ruby DSL | Highly programmable and powerful, but more developer-oriented and heavyweight |
Key takeaway: Ansible prioritises accessibility and a push model over SSH. Historically, Puppet and Chef have relied more on always-on agents (although the reality is more nuanced).
Practical exercise (optional): observe the chaos, then bring it under control
Objective: see what goes wrong without a tool, then understand what is expected of a configuration management tool.
- On
node1, take a snapshot, then manually installnginx, start it and modify the home page. - On
node2, take a snapshot, then installapache2, start it and create a different home page. - Write down everything you did (or try to remember it, just for a laugh).
- Restore the previous snapshots of both VMs to undo the effects of the exercise.
- Conclusion: configuring systems manually is not a strategy; it is a way to make configurations drift apart.
Multiple-choice quiz
1) Idempotence means:
- A. Everything runs faster
- B. Repeating an action converges towards the same state
- C. Everything can be done without root privileges
2) Configuration management is primarily used to:
- A. Draw diagrams
- B. Describe and maintain a target state for systems
- C. Replace backups
3) Ansible is often described as:
- A. Agentless and controlled over SSH
- B. A compiled programming language
- C. A hypervisor
Answer key
1) B · 2) B · 3) A