Use ansible_facts in Tasks
Branch on OS, memory and IP facts.
From Data to Decisions
Gathered facts are only useful if you act on them. Now you will pull values from ansible_facts straight into your tasks. 🌟
Reference a Fact
Use the same {{ }} syntax as any variable. Inside the braces, name the fact you want, like the host's distribution.
- debug:
msg: "OS is {{ ansible_distribution }}"All lessons in this course
- What Facts Are & Why They Matter
- Explore Facts with the setup Module
- Use ansible_facts in Tasks
- Disabling Fact Gathering for Speed