CertGrid CertGrid
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

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.

One managed node, which needs outbound HTTPS for the download and API steps.
Server NameIP AddressOSRolesCPURAMHDD
ANS-CTL01192.168.0.36Ubuntu 26.04 LTSAnsible Control Node2 Core3 GB50 GB
ANS-A01192.168.0.37Ubuntu 26.04 LTSManaged Node (group: web)2 Core3 GB50 GB

This guide includes

Use this for the modules that belong to no particular task and turn up everywhere. This matters because six of them cover the gaps - computing a value, fetching a URL, calling an API, waiting, and outrunning the timeout.

Before you start

  1. The configuration this guide assumes

  2. set_fact computes a variable

  3. get_url and slurp

  4. uri talks to an API

  5. wait_for something to be ready

  6. async for something longer than the timeout

Official sources