Ansible Advanced training
docker run -it -d mmumshad/ubuntu-ssh-enabled
Setup Ansible controller
docker run -d \
--name ansible-controller \
-v /Users/pnamburi/git/ansible-advanced-training:${HOME_DIR}/ansible-training \
-it \
mmumshad/ubuntu-ssh-enabled
Login to controller and install ansible
docker exec -it ansible-controller bash
apt-get update -y
apt-get install ansible -y
apt-get install python -y
apt-get install sshpass -y
Create Ansible targets.
docker run -d \
--name target1 \
-it \
mmumshad/ubuntu-ssh-enabled
docker run -d \
--name target2 \
-it \
mmumshad/ubuntu-ssh-enabled
docker run -d \
--name target3 \
-it \
mmumshad/ubuntu-ssh-enabled
docker inspect <containerid> |grep IPAddress
Verify the ip addresses of all docker containers.
Execute below command on all target containers.
apt-get update -y && apt-get install python -y
Execute below commands from the ansible-controller.
cd /ansible-training
ansible target* -m ping -i inventory.txt
If you receive an error about Hostkey checking, you can try to connect to other containers through ssh and this issue should be resolved.