Ansible in a Minute
Learn one useful Ansible thing at a time, quickly.
A growing library of small, practical Ansible lessons. Each guide teaches one key concept, operator task, or Certified Collection use case.
Tracks
Browse A–ZRecent guides
AAP 2.7 ·
Review job status in AAP 2.7
Open Jobs in AAP 2.7 to see whether a run is successful, failed, or still running.
Ansible Core ·
Use default to handle an undefined variable
Use the default filter so a task still runs when a variable is undefined.
Ansible Core ·
Use delegate_to to run a task on another host
Use delegate_to so a task runs on localhost (or another host) while the play still targets the current inventory host.
Ansible Core ·
Use list to loop over dictionary keys
Pipe dict.keys() through the list filter so a loop works on Python 3.
Ansible Core ·
Use now to get the current time in a template
Use now() when you need the current time, not the time facts were gathered.
Ansible Core ·
Use query to get lookup results as a list
Use query (or q) when a lookup must return a list you can loop over.
AAP 2.7 ·
Use a survey to set extra variables in AAP 2.7
Use a job template survey in AAP 2.7 so launch answers become extra variables in the playbook.
Ansible Core ·
Use truthy to test whether a value is true
Use the truthy test in when to treat a non-empty or true-like value as true.
AAP 2.7 ·
View inventories in AAP 2.7
Open Inventories in AAP 2.7 to see available inventories, status, and hosts before you run a job.
Certified Collections ·
Create a Kubernetes namespace
Use kubernetes.core to create a Kubernetes namespace with a clear name.
Certified Collections ·
Create an Azure resource group
Use azure.azcollection to create an Azure resource group in a chosen region.
Certified Collections ·
Ensure a Windows service is started
Use ansible.windows to make sure a Windows service is running and set to automatic start.
Ansible Core ·
Use notify and handlers to run a task after a change
Use notify with a handler so Ansible restarts a service only after a config file changes.
Ansible Core ·
Use loop to run a task for each item in a list
Use loop to install each RHEL package name in a list with one package task.
Ansible Core ·
Use run_once to run a task on a single host
Use run_once so Ansible prints a cluster-wide message once instead of on every host.
Ansible Core ·
Use block rescue always to handle a failed task
Use block, rescue, and always to recover from a failed task and still run cleanup.
Ansible Core ·
Use search to match a pattern anywhere in a string
Use the Jinja search test in when to match a regex pattern anywhere in a string.
Ansible Core ·
Use until to retry a task until a condition is met
Use until with retries and delay to poll a task until a condition is true.
Ansible Core ·
Use when to run a task only if a condition is true
Use when to skip a task unless a condition evaluates to true.
Certified Collections ·
Add a VLAN to a Cisco IOS switch
Use cisco.ios to create a VLAN on a Cisco IOS switch.
Subscribe for updates
Get an email whenever we publish new guides and blog posts. Unsubscribe anytime.
By subscribing you agree we may email you about Ansible in a Minute and related Level Up Labs updates. We store your address in the same lead sheet as our contact form.