Module 13 - Ansible

Lab 1: Install Ansible & Set Up Inventory

  • How do you install Ansible on a Linux machine?

  • How do you create an inventory file named hosts?

  • How do you add a remote server entry inside the inventory?


Lab 2: Run Your First Ad-Hoc Commands

  • How do you use an Ansible ad-hoc command to get OS information?

  • How do you check uptime using an ad-hoc command?

  • How do you list directory contents on a remote server using Ansible?


Lab 3: Create a Simple Playbook

  • How do you write a playbook install_apache.yml that installs Apache on Linux servers?

  • How do you start the Apache service from the playbook?

  • How do you run the playbook and verify the web server is running?


Lab 4: Copy Files and Directories

  • How do you write a playbook that uses the copy module to upload a file to /opt/info.txt?

  • How do you set file permissions and owner with the copy module?


Lab 5: Gather Facts & Print System Details

  • How do you create a playbook that gathers system facts?

  • How do you use the debug module to print:

    • OS type

    • IP address

    • Memory size


Lab 6: Playbook with Handlers

  • How do you install Apache in a playbook?

  • How do you deploy a template file using the template module?

  • How do you restart Apache only when configuration changes using handlers?


Lab 7: Deploy Docker Using Ansible

  • How do you install Docker using an Ansible playbook?

  • How do you start the Docker service?

  • How do you add users to the docker group using Ansible?


Lab 8: Dynamic Inventory for AWS

  • How do you configure Ansible to use the aws_ec2 dynamic inventory plugin?

  • How do you filter instances by tag (e.g., Environment=Dev)?

  • How do you run a playbook against dynamically discovered AWS EC2 instances?


Lab 9: Provision EC2 Instances with Ansible AWS Modules

  • How do you create an EC2 instance using the amazon.aws.ec2_instance module?

  • How do you add:

    • Tags

    • Key pair

    • Security groups

  • How do you configure the new instance using dynamic inventory?


Lab 10: Create Your First Ansible Role

  • How do you generate a new role structure using Ansible?

  • How do you write role tasks to install and start Apache?

  • How do you use this role inside a playbook?

Last updated