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

Automation Made Simple with Ansible

Automation Made Simple with Ansible

Short talk presented at the first DigitalOcean Berlin meetup

Erika Heidi

April 20, 2016
Tweet

More Decks by Erika Heidi

Other Decks in Programming

Transcript

  1. Automation Made Simple with Ansible @erikaheidi / DigitalOcean Meetup Berlin

    Ansible • Simple and straightforward language (YAML) • Agentless Architecture • Huge collection of built-in modules • Great community, very popular on Github
  2. Automation Made Simple with Ansible @erikaheidi / DigitalOcean Meetup Berlin

    Inventories #/etc/ansible/hosts [dev] 192.168.30.33 [prod] myserver.com otherserver.com
  3. Automation Made Simple with Ansible @erikaheidi / DigitalOcean Meetup Berlin

    Playbook Example --- - hosts: all become: true tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Nginx apt: name=nginx state=latest
  4. Automation Made Simple with Ansible @erikaheidi / DigitalOcean Meetup Berlin

    Playbook Resources • Variables • Loops • Conditionals • Templates • Ansible Vault
  5. Automation Made Simple with Ansible @erikaheidi / DigitalOcean Meetup Berlin

    Playbook --- - hosts: all become: true vars: packages: ["nginx", "vim"] message: "1st DigitalOcean Berlin Meetup, YAY!" tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Packages apt: name={{ item }} state=latest with_items: packages - name: Change Nginx index file template: src=index.tpl dest=/usr/share/nginx/html/index.html notify: restart nginx handlers: - name: restart nginx service: name=nginx enabled=yes state=restarted
  6. Automation Made Simple with Ansible @erikaheidi / DigitalOcean Meetup Berlin

    Playbook --- - hosts: all become: true vars: packages: ["nginx", "vim"] message: "1st DigitalOcean Berlin Meetup, YAY!" tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Packages apt: name={{ item }} state=latest with_items: packages - name: Change Nginx index file template: src=index.tpl dest=/usr/share/nginx/html/index.html notify: restart nginx handlers: - name: restart nginx service: name=nginx enabled=yes state=restarted
  7. Automation Made Simple with Ansible @erikaheidi / DigitalOcean Meetup Berlin

    Playbook --- - hosts: all become: true vars: packages: ["nginx", "vim"] message: "1st DigitalOcean Berlin Meetup, YAY!" tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Packages apt: name={{ item }} state=latest with_items: packages - name: Change Nginx index file template: src=index.tpl dest=/usr/share/nginx/html/index.html notify: restart nginx handlers: - name: restart nginx service: name=nginx enabled=yes state=restarted
  8. Automation Made Simple with Ansible @erikaheidi / DigitalOcean Meetup Berlin

    Playbook --- - hosts: all become: true vars: packages: ["nginx", "vim"] message: "1st DigitalOcean Berlin Meetup, YAY!" tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Packages apt: name={{ item }} state=latest with_items: packages - name: Change Nginx index file template: src=index.tpl dest=/usr/share/nginx/html/index.html notify: restart nginx handlers: - name: restart nginx service: name=nginx enabled=yes state=restarted
  9. Automation Made Simple with Ansible @erikaheidi / DigitalOcean Meetup Berlin

    Playbook --- - hosts: all become: true vars: packages: ["nginx", "vim"] message: "1st DigitalOcean Berlin Meetup, YAY!" tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Packages apt: name={{ item }} state=latest with_items: packages - name: Change Nginx index file template: src=index.tpl dest=/usr/share/nginx/html/index.html notify: restart nginx handlers: - name: restart nginx service: name=nginx enabled=yes state=restarted
  10. Automation Made Simple with Ansible @erikaheidi / DigitalOcean Meetup Berlin

    Playbook --- - hosts: all become: true vars: packages: ["nginx", "vim"] message: "1st DigitalOcean Berlin Meetup, YAY!" tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Packages apt: name={{ item }} state=latest with_items: packages - name: Change Nginx index file template: src=index.tpl dest=/usr/share/nginx/html/index.html notify: restart nginx handlers: - name: restart nginx service: name=nginx enabled=yes state=restarted