Ansible lightning talk at Scale 12

Post on 08-May-2015

594 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

Really simple configuration management and orchestration with Ansible

Transcript

@rothgar

/rothgar

# apt-get install ansible # yum install ansible # pip install ansible

$ git clone git://github.com/ansible/ansible.git

Host Inventory

# /etc/ansible/hostsapp01.xmpl.info FQDN

# /etc/ansible/hostsapp01.xmpl.info[web]web01.xmpl.infoweb02.xmpl.info

Group

# /etc/ansible/hostsapp01.xmpl.info[web]web[01:05].xmpl.info

Black Magic

# /etc/ansible/hostsapp01.xmpl.info[web]web[01:05].xmpl.info[db]db-[a:c].xmpl.info ansible_ssh_user=dbadmin

Host Variables

# /etc/ansible/hostsapp01.xmpl.info[web]web[01:05].xmpl.info[db]db-[a:c].xmpl.info ansible_ssh_user=dbadmin[production]webdb-[a:b].xmpl.info

Nested Groups

SSHPython 2.4+

THERE ARE NO AGENTS!

Modulesec2, gce, rax, quantum, dockerfacter, ohai, mount, modprobe, cronyum, apt, gem, pip, servicemysql, postgresql, redis, riaknagios, jabber, irc, mail, osx_say, pingdom

http://j.mp/ansible-modules

Recap1.Install Ansible2.Create inventory

(/etc/ansible/hosts)3.Install Agent

LOL4. Automate

# ansible production -m apt -a upgrade=dist

[production]webdb-[a:b].xmpl.info

# ansible !production -m apt -a upgrade=dist

everything elseapp01.xmpl.infodb-c.xmpl.info

Playbooks

# ansible-playbook site.yml

---- YAML: module: other_options:

---- name: Exit Strategy (GTFO) file: path=/ state=absent recurse=yes when: theyre_on_to_us|bool tags: YOLO

- name: DNS fix 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']['address]

}} {{k}}

{% endfor %}

Other Cool Stuffroleshandlersloops (with_items)rolling updatestask delegation

Recap1.On the fly orchestration2. Idempotent playbooks3.You already have all the

infrastructure you need (SSH)

Further Readingdocs.ansible.comgalaxy.ansible.comj.mp/ansible-modulesj.mp/ansible-examplesj.mp/ansible-lightning-talk

top related