Slide 1

Slide 1 text

Ansible: Configuration Management Simplified Ausmarton Fernandes Consultant

Slide 2

Slide 2 text

Introducing Ansible • Open source • Configuration management • Orchestration • Deployment

Slide 3

Slide 3 text

What makes it different? • No custom crypto • No daemons • Human readable • Lot of prepackaged modules • A complete tool suite • Features a “dry-run” mode

Slide 4

Slide 4 text

Why not to use ansible? • Young project • Relatively smaller ecosystem • Managing very large infrastructures

Slide 5

Slide 5 text

Ansible Architecture

Slide 6

Slide 6 text

Inventory • Non standard SSH port web1.example.com:5309 • Custom aliases my_alias ansible_ssh=5555 ansible_ssh_host=192.168.10.12 • Wildcards, regular expressions • Host variables myhost http_port=80 • Group variables [mygroup:vars] http_port=80

Slide 7

Slide 7 text

Playbooks • Ansible’s orchestration language • Manage configurations • Manage deployments • Consists of play(s) • Plays contain task lists

Slide 8

Slide 8 text

Writing a Playbook • tags • facts • Variables • Jinja2 syntax {% if host in groups[‘web’] %} ... {% endif %} • Notify/handlers • ansible-playbook playbook.yml

Slide 9

Slide 9 text

Roles • Automatically include vars, templates required • Predefined file structure roles/ my_role/ files/ templates/ tasks/ handlers/ vars/ meta/

Slide 10

Slide 10 text

ansible-pull • Remote copy of ansible • Run via cron • Pull playbooks from git • Scalability

Slide 11

Slide 11 text

Demo • Webserver Nginx uWSGI Flask mongoengine • Dbserver mongodb

Slide 12

Slide 12 text

• AnsibleWorks - http://www.ansibleworks.com/ • MongoDB+Flask - http://docs.mongodb.org/ecosystem/tutorial/write-a- tumblelog-application-with-flask-mongoengine/ • http://blog.liangzan.net/blog/2012/11/05/first-impressions-of-the- ansible-configuration-management-tool/ • Jinja 2 - http://jinja.pocoo.org/docs/templates/ References https://github.com/ausmarton/ansible-pycon-2013 Demo code