Lab 2: Variables & Templates

Beginner 45 minutes Beginner Labs

Learning Objectives

  • Define and use variables in playbooks
  • Use facts to gather system information
  • Create and deploy Jinja2 templates
  • Understand variable precedence

Progress

0 of 3 tasks completed

Tasks

1
Define Variables
Create variables for application name, version, and port number
2
Use Variables in Tasks
Create a configuration file using the variables you defined
3
Use System Facts
Display system information using Ansible facts
Hints for Task
    Playbook
    Inventory
    --- - name: Variables and Templates Lab hosts: localhost gather_facts: yes # Task 1: Define your variables here vars: # Add variables here tasks: # Task 2: Create a config file using variables # Add your code here # Task 3: Display system facts # Add your code here
    localhost ansible_connection=local
    Output
    Waiting for playbook execution...