- Create 2 host machines (vm's) using ubuntu live server 20.04
- Assign one to be the Ansible Control Host and the other to be the Managed Host
- Assign static IP's to both, make sure they're on the same network.
demo control node: user=sammy, pwd=password, ip=192.168.1.80
demo managed node: user=ansible, pwd=ansible, ip=192.168.1.81
- Initially both hosts only need a bare minimum install, basic Ubuntu + OpenSSH, no other apps.
- Log into the Control Node and do the following steps:
- Install ansible (see hw4 docs)
- establish a password based ssh connection from the control host to the managed host
- confirm user has sudoer (i.e. run '$ sudo -i')
- log out back to control node
- create SSH key pairs for Control Host
$ ssh-keygen
- push the public SSH key of the control node to the managed node (ssh)
$ ssh-copy-id -i ansible@192.168.1.81 (provide passwords when requested)
- attempt to ssh connect without password
- install ansible on control node
- edt '$ /etc/ansible/hosts' file and add the following line
[shards]
192.168.1.81
- test ansible ping to managed host
$ ansible shards -m ping -u ansible
- import the .zip file for hw4 and extract it in some folder
- from the extracted folder run the playbook with the following arguments
$ ansible-playbook playbook.yml -l shards -u ansible -kK~
- when playbook has run, ssh into managed host
- May have to run playbook second time
- from managed host, check docker containers, should be 1 primary and 2 secondary
$ sudo docker ps -a
- Done. If you don't see 1 primary and 2 secondary, re run the playbook once more and check back.