Lab 1 - Solution

Mandatory

Check the infrastructure

  • Login on srv.<firstname>.lab as ansible user

  • check the ansible version (2.x)

  • try to connect to the other servers via ssh and accept the ssh host keys
    • web1.<firstname>.lab
    • web2.<firstname>.lab
    • db.<firstname>.lab
ansible --version
ssh web1.<firstname>.lab
ssh web2.<firstname>.lab
ssh db.<firstname>.lab

Git Installation

  • Connect to your srv.<firstname>.lab as ansible user
  • Switch to root via sudo
  • Install git
ssh -l ansible srv.firstname.lab
sudo su -
apt-get install git

Create a git repo

  • as ansible user
  • create a local git repo in /home/ansible/training
  • create a file e.g README.md and add it to your git repo
  • make your first git commit
  • check the log
mkdir /home/ansible/training
cd /home/ansible/training

git init

vi README.md
git status
git add README.md
git commit -m 'first commit'

git log

Optional

Checkout a public repository

cd /tmp

# clone repo
git clone https://github.com/pstauffer/pstauffer.github.io.git

# edit readme
vi README.md

# print out the working tree status
git status

# print out the differences of the readme
git diff README.md