8. $ vagrant init https://github.com/
holms/vagrant-jessie-box/releases/
download/Jessie-v0.1/Debian-jessie-
amd64-netboot.box
…
$ vagrant up
…
$ vagrant ssh-config
HostName 127.0.0.1
User vagrant
Port 2222
…
Managed Node setup
http://vagrantup.com
http://vagrantbox.es
@orestesCA Galicia - December 2015
9. Managed Node security credentials
$ vagrant ssh --command "echo `cat ~/.ssh/id_rsa.pub` >> ~/.ssh/
authorized_keys”
$ ssh vagrant@localhost -p 2222
…
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:2222' (RSA) to the list
of known hosts.
…
Last login: Sun Jun 7 01:21:33 2015 from 10.0.2.2
vagrant@Debian-jessie-amd64-netboot:~$ exit
@orestesCA Galicia - December 2015
10. Control Machine setup
http://docs.ansible.com
$ sudo pip install paramiko PyYAML Jinja2 httplib2
$ git clone git://github.com/ansible/ansible.git --recursive
$ cd ./ansible
$ source hacking/env-setup
…
$ ansible
ansible ansible-doc ansible-galaxy ansible-
playbook ansible-pull ansible-vault
@orestesCA Galicia - December 2015
$ pip install ansible #*nix
$ brew install ansible #OS X
11. Inventory setup
$ export ANSIBLE_INVENTORY=~/ansible_hosts
[vagrant]
127.0.0.1:2222 foo=bar
[vagrant:vars]
ansible_ssh_user=vagrant
env=local
http://docs.ansible.com/intro_inventory.html
https://docs.ansible.com/playbooks_variables.html
Precedence: -i file
or $ANSIBLE_INVENTORY
or /etc/ansible/hosts
@orestesCA Galicia - December 2015
12. Ping a.k.a. Hello world
$ ansible vagrant -m ping -vvvv
<127.0.0.1> ESTABLISH CONNECTION FOR USER: vagrant on PORT
2222 TO 127.0.0.1
<127.0.0.1> REMOTE_MODULE ping
…
127.0.0.1 | success >> {
"changed": false,
"ping": "pong"
}
$ ansible all -m ping —vvvv
…
@orestesCA Galicia - December 2015
13. Random
_________________
< GATHERING FACTS >
-----------------
^__^
(oo)_______
(__) )/
||----w |
|| ||
http://docs.ansible.com/faq.html#how-do-i-disable-cowsay
export ANSIBLE_NOCOWS=1
@orestesCA Galicia - December 2015