Lab 2 - Ansible Configuration & Inventory

Mandatory

Create the Ansible Configuration

  • Connect to your srv.<firstname>.lab as ansible user

  • Switch into your git repo /home/ansible/training

  • Create a ansible.cfg file and configure

    • inventory path to hosts
    • enable become

Create a static inventory

  • Create a hosts file

  • add all your servers to the inventory file

    • web1.<firstname>.lab
    • web2.<firstname>.lab
    • db.<firstname>.lab

Important

Don’t add srv.firstname.lab in your inventory.

Run some Ansible commands

  • Run uname on all servers
  • Run whoami on all servers

Commit your changes

  • add all files to your git repo and commit it

Optional

Run whoami as ansible user

Try out ansible-doc

  • print out all available modules
  • have a look at the ping module