Commit 9d18e1b0e489f05e1ac3839cc3d351b99044e7d0

Authored by Lars Tiede
1 parent 4039e577

small improvements

Showing 1 changed file with 8 additions and 5 deletions   Show diff stats
1 Utviklerlunsj: Ansible 1 Utviklerlunsj: Ansible
2 ====================== 2 ======================
3 3
  4 +The presentation is available as [keynote](presentation.key) and [pdf](presentation.pdf) files.
  5 +
  6 +
4 How to install the demo environment 7 How to install the demo environment
5 ----------------------------------- 8 -----------------------------------
6 9
7 -First, install [Vagrant](https://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/). Both installs are easy and fairly quick. 10 +First, install [Vagrant](https://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) on your Linux, Mac, or Windows box. Both installs are easy and fairly quick.
8 11
9 Then, clone this repository somewhere and, in a terminal, cd into the directory you cloned the repo into. There: 12 Then, clone this repository somewhere and, in a terminal, cd into the directory you cloned the repo into. There:
10 13
@@ -50,7 +53,7 @@ First, cd to /vagrant, which is the directory containing the cloned repository, @@ -50,7 +53,7 @@ First, cd to /vagrant, which is the directory containing the cloned repository,
50 53
51 vagrant@demo-control:/vagrant$ ansible all -i inventory/demo -m ping 54 vagrant@demo-control:/vagrant$ ansible all -i inventory/demo -m ping
52 55
53 -You need to add the host keys now. This happens only the first time you connect to the hosts, as usual with SSH. 56 +You need to say yes to adding target1's and target2's host keys now. This happens only the first time you connect to the hosts, as usual with SSH.
54 57
55 Run a few other commands to get a feel for what's happening. 58 Run a few other commands to get a feel for what's happening.
56 59
@@ -63,7 +66,7 @@ Here's one that spews out a lot of info about target1: @@ -63,7 +66,7 @@ Here's one that spews out a lot of info about target1:
63 66
64 vagrant@demo-control:/vagrant$ ansible target1 -i inventory/demo -m setup 67 vagrant@demo-control:/vagrant$ ansible target1 -i inventory/demo -m setup
65 68
66 -Since Ansible s using SSH under the hood and you will very likely require root privieleges on your target systems, it is important to be able to get root privileges in one way or another. If you don't specify anything to that effect, Ansible will just try to log in as "the current user": 69 +Since Ansible uses SSH under the hood, and you very likely require root privileges on your target systems at some point, it is important to be able to get root privileges in one way or another. If you don't specify anything to that effect, Ansible will just try to log in as "the current user":
67 70
68 vagrant@demo-control:/vagrant$ ansible target1 -i inventory/demo -m shell -a "whoami" 71 vagrant@demo-control:/vagrant$ ansible target1 -i inventory/demo -m shell -a "whoami"
69 72
@@ -78,11 +81,11 @@ On our Vagrant boxes, passwordless SSH for the root user is not set up, but the @@ -78,11 +81,11 @@ On our Vagrant boxes, passwordless SSH for the root user is not set up, but the
78 81
79 Let's *do* something. 82 Let's *do* something.
80 83
81 -Say we want pip (a Python package manager) on one of the target machines. We tell Ansible that we want the apt package named "python-pip" present: 84 +Say we want to have pip (a Python package manager) installed on one of the target machines. We tell Ansible that we want the apt package named "python-pip" present:
82 85
83 vagrant@demo-control:/vagrant$ ansible target1 --sudo -i inventory/demo -m apt -a "pkg=python-pip state=present" 86 vagrant@demo-control:/vagrant$ ansible target1 --sudo -i inventory/demo -m apt -a "pkg=python-pip state=present"
84 87
85 -Note that we didn't say "install python-pip", but rather "have python-pip installed". It is up to Ansible, more specififcally the 'apt' module, to figure out whether anything has to be done or not. Go on, just do the same thing again. All you get back now is "changed: false". So Ansible only does something if something needs to be done. That's why you specify what state you want in the end, not how to get there. That last bit is an implementation detail you usually don't concern yourself with! 88 +Note that we didn't say "install python-pip", but rather "have python-pip installed". It is up to Ansible to figure out whether anything has to be done or not. Go on, just do the same thing again. All you get back now is "changed: false". So Ansible only does something if something needs to be done. That's why you specify what state you want in the end, not how to get there. That last bit is an implementation detail you usually don't concern yourself with!
86 89
87 If you want to break the rules, however, nothing stops you from running "apt-get install -y python-pip" with the "shell" module. 90 If you want to break the rules, however, nothing stops you from running "apt-get install -y python-pip" with the "shell" module.
88 91