Lab 2 links and tips

View previous topic View next topic 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.

https://app.box.com/s/pgs2i8irrtgzptv9kck0tlxrsa0aim33
https://app.box.com/s/bn9imy39qcnruy90c3x04stztcfr241l


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: https://help.ubuntu.com/community/SSH/OpenSSH/Configuring

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:
http://www.linuxproblem.org/art_9.html

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:

[whatever]
1.2.3.4

You can name the webserver group whatever you want and make as many as you want, replace 1.2.3.4 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:

[whatever]
1.2.3.4
1.2.3.5
1.2.3.6
1.2.3.7

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

Alex Cohen
Admin

Posts : 4
Join date : 2016-01-04

View user profile http://ritnssa713.forumotion.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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