Lab 2 links and tips

Go down

Lab 2 links and tips

Post by Alex Cohen on Wed Feb 17, 2016 11:27 am

I'm gonna add more stuff later, but here's some notes I made about using ansible and writing playbooks.  If you've never used ansible to talk to computers other than the local host or if you've never wrote a playbook before take a look at these.

Ok so to start this lab make a second Ubuntu machine.  You will need to be able to SSH into this machine to be able to use ansible to control it.  First open port 22 on the new machine so you can do this.  So install OpenSSH by following these steps to open port 22:

On the old machine from last lab you will need to make an SSH key and copy that key into the .ssh directory on the new one by following the directions at this link:

Next on your old machine go into the /etc/ansible/hosts file and create a web server group by adding something like this at the bottom of the file:


You can name the webserver group whatever you want and make as many as you want, replace with the ip address of your new ubuntu machine now you should be able to send commands to the new machine from the old using ansible.  To test this try using this command:

ansible whatever -m ping

You can also try this:

ansible all -m ping

Once this works just make 3 clones of the new machine add all the ip addresses to the bottom of /etc/ansible/hosts like this:


And your done with the lab.  Just run a playbook twice like you did for the last lab to test the idempotancy.

Alex Cohen

Posts : 4
Join date : 2016-01-04

View user profile

Back to top Go down

Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum