@rothgar
/rothgar
# apt-get install ansible
# yum install ansible
# pip install ansible
$ git clone git://github.com/ansible/ansible.git
Host Inventory
# /etc/ansible/hosts
app01.xmpl.info

FQDN
# /etc/ansible/hosts
app01.xmpl.info
[web]
Group
web01.xmpl.info
web02.xmpl.info
# /etc/ansible/hosts
app01.xmpl.info
[web]
web[01:05].xmpl.info
Black Magic
# /etc/ansible/hosts
app01.xmpl.info
[web]
web[01:05].xmpl.info
[db]
db-[a:c].xmpl.info ansible_ssh_user=dbadmin
Host Vari...
# /etc/ansible/hosts
app01.xmpl.info
[web]
web[01:05].xmpl.info
[db]
db-[a:c].xmpl.info ansible_ssh_user=dbadmin
[producti...
THERE ARE NO AGENTS!
SSH
Python 2.4+
Modules
http://j.mp/ansible-modules

ec2, gce, rax, quantum, docker
facter, ohai, mount, modprobe, cron
yum, apt, gem, pip...
Recap
1. Install Ansible
2. Create inventory (/etc/ansible/hosts)
LOL
3. Install Agent
4. Automate
# ansible production -m apt -a upgrade=dist
everything else
app01.xmpl.info
db-c.xmpl.info

[production]
web
db-[a:b].xmpl...
Playbooks
# ansible-playbook site.yml
--- YAML:
module:
other_options:
--- Exit Strategy (GTFO)
- name:
file: path=/ state=absent
recurse=yes
when: theyre_on_to_us|bool
tags: YOLO
--- DNS fix
- name:
template: src=hosts.j2
dest=/etc/hosts
owner=root group=root
mode=0644
#/etc/hosts
127.0.0.1 localhost {{ansible_hostname}}
{% for k,v in hostvars.iteritems() %}
{{v['ansible_eth0']['ipv4']['ad...
Other Cool Stuff
roles
handlers
loops (with_items)
rolling updates
task delegation
Recap
1. On

the fly orchestration
2. Idempotent playbooks
3. You already have all the
infrastructure you need (SSH)
Further Reading
docs.ansible.com
galaxy.ansible.com
j.mp/ansible-modules
j.mp/ansible-examples
j.mp/ansible-lightning-talk
Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12
Upcoming SlideShare
Loading in...5
×

Ansible lightning talk at Scale 12

733

Published on

Really simple configuration management and orchestration with Ansible

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
733
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ansible lightning talk at Scale 12

  1. 1. @rothgar /rothgar
  2. 2. # apt-get install ansible # yum install ansible # pip install ansible $ git clone git://github.com/ansible/ansible.git
  3. 3. Host Inventory
  4. 4. # /etc/ansible/hosts app01.xmpl.info FQDN
  5. 5. # /etc/ansible/hosts app01.xmpl.info [web] Group web01.xmpl.info web02.xmpl.info
  6. 6. # /etc/ansible/hosts app01.xmpl.info [web] web[01:05].xmpl.info Black Magic
  7. 7. # /etc/ansible/hosts app01.xmpl.info [web] web[01:05].xmpl.info [db] db-[a:c].xmpl.info ansible_ssh_user=dbadmin Host Variables
  8. 8. # /etc/ansible/hosts app01.xmpl.info [web] web[01:05].xmpl.info [db] db-[a:c].xmpl.info ansible_ssh_user=dbadmin [production] web Nested Groups db-[a:b].xmpl.info
  9. 9. THERE ARE NO AGENTS! SSH Python 2.4+
  10. 10. Modules http://j.mp/ansible-modules ec2, gce, rax, quantum, docker facter, ohai, mount, modprobe, cron yum, apt, gem, pip, service mysql, postgresql, redis, riak nagios, jabber, irc, mail, osx_say, pingdom
  11. 11. Recap 1. Install Ansible 2. Create inventory (/etc/ansible/hosts) LOL 3. Install Agent 4. Automate
  12. 12. # ansible production -m apt -a upgrade=dist everything else app01.xmpl.info db-c.xmpl.info [production] web db-[a:b].xmpl.info # ansible !production -m apt -a upgrade=dist
  13. 13. Playbooks
  14. 14. # ansible-playbook site.yml
  15. 15. --- YAML: module: other_options:
  16. 16. --- Exit Strategy (GTFO) - name: file: path=/ state=absent recurse=yes when: theyre_on_to_us|bool tags: YOLO
  17. 17. --- DNS fix - name: template: src=hosts.j2 dest=/etc/hosts owner=root group=root mode=0644
  18. 18. #/etc/hosts 127.0.0.1 localhost {{ansible_hostname}} {% for k,v in hostvars.iteritems() %} {{v['ansible_eth0']['ipv4']['address] }} {{k}} {% endfor %}
  19. 19. Other Cool Stuff roles handlers loops (with_items) rolling updates task delegation
  20. 20. Recap 1. On the fly orchestration 2. Idempotent playbooks 3. You already have all the infrastructure you need (SSH)
  21. 21. Further Reading docs.ansible.com galaxy.ansible.com j.mp/ansible-modules j.mp/ansible-examples j.mp/ansible-lightning-talk
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×