Ansible lightning talk at Scale 12

940
-1

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
940
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
11
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

×