Lab 5 - Playbooks

Mandatory

Your first playbook

  • Connect to your srv.<firstname>.lab as ansible user
  • Switch into your git repo /home/ansible/training
  • create a playbook with the filename ntp-debian.yml
  • The playbook should run on the host web1.<firstname>.lab
  • Add a task to install ntp. (You can copy the task from your lab4.yml file)
  • Run your playbook (you will see changes)
  • Run the playbook again (no changes)

Second playbook

  • create a playbook with the filename ntp-redhat.yml
  • The playbook will run on host web2.<firstname>.lab
  • Create a task in YAML style for a ntp installation via yum
  • Run the playbook in the check-mode (--check)
  • Run your playbook (you will see changes)
  • Run the playbook again (no changes)

Import playbooks

  • Create a new playbook named ntp.yml

  • Import both playbooks

    • ntp-redhat.yml
    • ntp-debian.yml
  • Run the playbook step-by-step (--step)

Commit your changes

  • add all files to your git repo and commit it