EasyEnv
Engineering/Courses/Catalog/Ansible/Variables and Facts
Ansible
IntermediateLesson 5 of 1230 min · hands-on

Variables and Facts

Part of the Ansible course

Write a playbook with the port number, the site name, and the package versions typed directly into the tasks, and it works, once, on the one machine you tested it against. Point the same playbook at a second server with a different IP range or a different amount of memory, and you either edit the file by hand before every run or you accept that it quietly does the wrong thing.

Think about a form letter, the kind a business sends to a thousand customers with the same paragraph structure every time: "Dear ___, your account ending in ___ is due for renewal on ___." Nobody retypes the whole letter for each customer. They write it once with blanks, then fill the blanks in per recipient from a list. A playbook has exactly the same shape as that letter. ...

Want to learn Ansible Variables and Facts in a real environment?

Click below, get a fresh Linux box with Ansible ready to go, and work through Variables and Facts hands-on with an AI tutor that knows your code.

Start this lessonVariables and Facts

What you'll learn

  • Variables in playbooks
  • Vars files
  • Group_vars
  • Host_vars
  • Facts
  • Variable precedence basics

Read this lesson in your language

All lessons in this course

12 lessons
  1. 1What Is Ansible20 min
  2. 2Inventory and Ad Hoc Commands25 min
  3. 3Your First Playbook30 min
  4. 4Tasks, Modules, and Handlers30 min
  5. 5Variables and Facts30 min
  6. 6Templates with Jinja230 min
  7. 7Loops and Conditionals30 min
  8. 8Roles and Galaxy35 min
  9. 9Vault and Secrets25 min
  10. 10Tags and Debugging25 min
  11. 11Collections and Plugins25 min
  12. 12Capstone: Multi Host Deploy60 min

Explore other courses

Variables and Facts - Ansible (English) | Engineering Courses