-
Install Oracle Virtual Box: https://www.virtualbox.org/
-
Install Vagrant: https://www.vagrantup.com/downloads.html
-
In a new Directory copy this respository:
https://github.com/bisrikarim/Ansible-labs.git
- Start the vagrant instance.
vagrant up
- It depends on your ip addresses, add those line in /etc/hosts file in all servers
$ nano /etc/hosts
192.168.30.231 ansible-control
192.168.30.232 db01
192.168.30.233 web01
192.168.30.234 web02
192.168.30.235 loadbalancer
- SSH into the ansible-control virtual machine.
vagrant ssh ansible-control
- Install Ansible in control-ansible server
$ sudo apt install ansible -y
- Install Python in all machines
$ sudo apt install python -y
- Generate an SSH key pair in ansible-control server
$ ssh-keygen
- Copy the SSH key pair in all other servers
$ ssh-copy-id db01 && ssh-copy-id web01 && ssh-copy-id web02 && ssh-copy-id loadbalancer
- Test ssh connection to all other servers
$ ssh vagrant@db01
$ ssh vagrant@web01
$ ssh vagrant@web02
$ ssh vagrant@loadbalancer