Lab 3: Inventory Management

Beginner 40 minutes Beginner Labs

Learning Objectives

  • Create inventory with multiple groups
  • Use group variables
  • Target specific hosts and groups
  • Use host and group patterns

Progress

0 of 3 tasks completed

Tasks

1
Define Inventory Groups
Create inventory with webservers and databases groups
2
Use Group Variables
Create tasks that run only on specific groups
3
Use Host Variables
Set different variables for different hosts/groups
Hints for Task
    Playbook
    Inventory
    --- - name: Inventory Management Lab - Webservers hosts: webservers gather_facts: no tasks: # Add tasks for webservers here - name: Inventory Management Lab - Databases hosts: databases gather_facts: no tasks: # Add tasks for databases here
    [webservers] localhost ansible_connection=local server_type=web [databases] localhost ansible_connection=local server_type=db [all:vars] environment=production
    Output
    Waiting for playbook execution...