Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Ansible

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →
Ramez Hanna
September 03, 2013

Introduction to Ansible

ansible introduction at the devopsfinland meetup

Ramez Hanna

September 03, 2013

Transcript

28 slides
  1. Ramez Hanna Husband and a Father Sys Admin / Continuous

    integration Get It Done @informatiq
  2. I love the idea high barrier to entry puzzled by

    the logic of it no adhoc and not that simple
  3. I am lazy ! I want Easy to learn Fast

    deploy (i.e. no infra to setup) No FW changes No PKI / SSL Clear logic Simple linguistics
  4. “Ansible is a radically simple IT orchestration engine that makes

    your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems.” -- ansibleworks.com
  5. Baby Steps $ ansible -i hosts demo01 -m "ping" 192.168.122.225

    | success >> { "changed": false, "ping": "pong" } $ ansible -i hosts dbmaster -m "user" -a "name=test" -s 192.168.122.225 | success >> { "changed": true, "comment": "", "createhome": true, "group": 1001, "home": "/home/test", "name": "test", "shell": "/bin/sh", "state": "present", "system": false, "uid": 1001 }
  6. $ ansible -i hosts dbmaster -m"user" -a"name=test" --sudo ansible inventory

    target module arguments sudo $ ansible -i hosts dbmaster -m shell -a 'echo $TERM' 192.168.122.225 | success | rc=0 >> screen-256color
  7. Modules • package management • files • databases • ssh

    keys • transfer files • services • edit files • etc …
  8. Facts $ ansible dbmaster -m setup dbmaster | success >>

    { "ansible_facts": { "ansible_all_ipv4_addresses": [ "10.0.1.224" ], "ansible_all_ipv6_addresses": [ "fe80::4b3:6fff:fec5:c942" ], "ansible_architecture": "x86_64", "ansible_bios_date": "NA", "ansible_bios_version": "NA", "ansible_cmdline": { "ro": true, "root": "/dev/xvda1" }, ...
  9. Playbooks A recipe or a transcript Playbooks can declare configurations

    They can also orchestrate steps of any manual ordered process Load and fire playbook describe the operation, the inventory decides which hosts to apply Staging / Production
  10. - hosts: webservers vars: http_port: 80 max_clients: 200 user: root

    tasks: - name: ensure apache is at the latest version yum: pkg=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf notify: - restart apache - name: ensure apache is running service: name=httpd state=started handlers: - name: restart apache service: name=httpd state=restarted

More Decks by Ramez Hanna

Other Decks in Technology