debug module
The module that prints a message or the value of a variable during a run and never changes anything.
In more detail
Give it msg with text, or var with a variable name to print that variable. It is the safest way to learn the shape of a playbook and to inspect facts and registered results. Avoid pointing it at secrets, because whatever it prints ends up in terminal output and logs.
Example
ansible.builtin.debug:
var: ansible_facts.hostnameRelated terms
- Ansible variable — A named value, such as http_port or site_name, that tasks and templates refer to instead of writing the value in directly.
- fact — A variable Ansible discovers about a host itself, such as its operating system, host name, memory or network addresses.
- register — The task keyword that saves a task's result in a named variable so later tasks can read it.
Taught in
- Installing Ansible — Ansible Configuration Management at Scale
- Your First Ad Hoc Command — Ansible Configuration Management at Scale
- Connections And Privilege Escalation — Ansible Configuration Management at Scale
- Playbook Syntax And YAML — Ansible Configuration Management at Scale
- Variables And Precedence — Ansible Configuration Management at Scale
- Gathering Facts — Ansible Configuration Management at Scale
- Conditionals — Ansible Configuration Management at Scale
- Loops — Ansible Configuration Management at Scale
- Error Handling With Block, Rescue And Always — Ansible Configuration Management at Scale
- Securing Data With Ansible Vault — Ansible Configuration Management at Scale
- Variables And Where They Win: group_vars, host_vars And Play Vars — RHCE in Ansible (EX294): Automate Red Hat Systems
- Facts And Magic Variables: Let Each Node Describe Itself — RHCE in Ansible (EX294): Automate Red Hat Systems
- Conditionals: register, when, changed_when And failed_when — RHCE in Ansible (EX294): Automate Red Hat Systems
- Storage: Partitions, Volume Groups And Volumes Where The Disk Exists — RHCE in Ansible (EX294): Automate Red Hat Systems
- Ansible Vault: Secrets Encrypted, Runs Without A Prompt — RHCE in Ansible (EX294): Automate Red Hat Systems
- Drill: Storage Only Where The Disk Exists — RHCE in Ansible (EX294): Automate Red Hat Systems