Hands-on Lab·Ansible
Common Ansible Modules
Six modules that do not belong to any one administration task but turn up in almost every real playbook. Each solves a problem the earlier guides work around: deriving a value, fetching something, talking to an API, waiting properly instead of sleeping, reading a remote file, and running something longer than the SSH timeout.
Plays and Playbooks Guide 17 of 45 Intermediate
- OSUbuntu 26.04 LTS
- ansible-core2.20.1
- Python3.14.4
- TimeAbout 17 min
- Reviewed23 August 2026
Written against the versions above. `set_fact` creates a variable with very high precedence - above almost everything except role parameters and `-e`. That makes it powerful and easy to misuse: a `set_fact` in one role silently overrides a carefully placed default in another.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| ANS-CTL01 | 192.168.0.36 | Ubuntu 26.04 LTS | Ansible Control Node | 2 Core | 3 GB | 50 GB |
| ANS-A01 | 192.168.0.37 | Ubuntu 26.04 LTS | Managed Node (group: web) | 2 Core | 3 GB | 50 GB |
Before you start
- A control node configured as shown in the first step, and a managed node with outbound internet access.
- The session downloads a small file to
/tmpon thewebhost and removes it.
-
The configuration this guide assumes
-
set_fact computes a variable
-
get_url and slurp
-
uri talks to an API
-
wait_for something to be ready
-
async for something longer than the timeout