Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12

704 views

Published on

AN INTRO TO THE SWISS ARMY KNIFE OF DEVOPS, CAPABLE OF HANDLING MANY POWERFUL AUTOMATION TASKS.

Published in: Internet
  • Be the first to comment

  • Be the first to like this

Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12

  1. 1. ANSIBLE AUTOMATION BEST PRACTICES FROM STARTUPS TO ENTERPRISES AN INTRO TO THE SWISS ARMY KNIFE OF DEVOPS, CAPABLE OF HANDLING MANY POWERFUL AUTOMATION TASKS. Keith Resar @KeithResar
  2. 2. @KeithResar Keith Resar: Bio Wear many hats Keith.Resar@RedHat.com Coder Open Source Contributor and Advocate Infrastructure Architect @KeithResar
  3. 3. WHAT IS ANSIBLE It’s a simple automation language that can perfectly describe an IT application infrastructure in Ansible Playbooks. It’s an automation engine that runs Ansible Playbooks. Ansible Tower is an enterprise framework for controlling, securing and managing your Ansible automation with a UI and restful API.
  4. 4. SIMPLE POWERFUL AGENTLESS Human readable automation No special coding skills needed Tasks executed in order Get productive quickly App deployment Configuration management Workflow orchestration Orchestrate the app lifecycle Agentless architecture Uses OpenSSH & WinRM No agents to exploit or update More efficient & more secure @KeithResar
  5. 5. HOW ANSIBLE WORKS ANSIBLE’S AUTOMATION ENGINE ANSIBLE PLAYBOOK PUBLIC / PRIVATE CLOUD CMDB USERS INVENTORY HOSTS NETWORKING PLUGINS API MODULES
  6. 6. HOW ANSIBLE WORKS ANSIBLE PLAYBOOK PLAYBOOKS ARE WRITTEN IN YAML Tasks are executed sequentially Invokes Ansible modules
  7. 7. HOW ANSIBLE WORKS MODULES MODULES ARE “TOOLS IN THE TOOLKIT” Python, Powershell, or any language Extend Ansible simplicity to entire stack
  8. 8. HOW ANSIBLE WORKS INVENTORY [web] webserver1.example.com webserver2.example.com [db] dbserver1.example.com
  9. 9. HOW ANSIBLE WORKS CMDB CLOUD: OpenStack, VMware, EC2, Rackspace, GCE, Azure, Spacewalk, Hanlon, Cobbler CUSTOM CMDB
  10. 10. PLAYBOOK EXAMPLE --- - name: install and start apache hosts: all vars: http_port: 80 max_clients: 200 remote_user: root tasks: - name: install httpd yum: pkg=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf - name: start httpd service: name=httpd state=running
  11. 11. PLAYBOOK EXAMPLE --- - name: install and start apache hosts: all vars: http_port: 80 max_clients: 200 remote_user: root tasks: - name: install httpd yum: pkg=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf - name: start httpd service: name=httpd state=running
  12. 12. PLAYBOOK EXAMPLE --- - name: install and start apache hosts: all vars: http_port: 80 max_clients: 200 remote_user: root tasks: - name: install httpd yum: pkg=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf - name: start httpd service: name=httpd state=running
  13. 13. PLAYBOOK EXAMPLE --- - name: install and start apache hosts: all vars: http_port: 80 max_clients: 200 remote_user: root tasks: - name: install httpd yum: pkg=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf - name: start httpd service: name=httpd state=running
  14. 14. PLAYBOOK EXAMPLE --- - name: install and start apache hosts: all vars: http_port: 80 max_clients: 200 remote_user: root tasks: - name: install httpd yum: pkg=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf - name: start httpd service: name=httpd state=running
  15. 15. PLAYBOOK EXAMPLE --- - name: install and start apache hosts: all vars: http_port: 80 max_clients: 200 remote_user: root tasks: - name: install httpd yum: pkg=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf - name: start httpd service: name=httpd state=running
  16. 16. ● 22,000+ stars & 7,100+ forks on GitHub ● 2600+ GitHub Contributors ● Over 1000 modules shipped with Ansible ● New contributors added every day ● 1400+ users on IRC channel ● Top 10 open source projects in 2014 ● World-wide meetups taking monthly ● Ansible Galaxy: over 7,000 Roles ● 250,000+ downloads a month ● AnsibleFests in NYC, SF, London COMMUNITY
  17. 17. MODULES
  18. 18. > ansible -m setup > ansible -m ping > ansible -m command -a ‘rm -rf /var/tmp/session’ > ansible -m copy -a ‘src=foo dest=/foo/bar’ AD-HOC COMMANDS
  19. 19. ● Static inventory ○ Ini-style syntax ● Dynamic inventory ○ Real-time pull of all assets from selected source ASSET INVENTORY
  20. 20. LOOKING AT THAT HELLO WORLD PLAYBOOK
  21. 21. MODULARITY USING ROLES While it is possible to write a playbook in one very large file (and you might start out learning playbooks this way), eventually you’ll want to reuse files and start to organize things. At a basic level, including task files allows you to break up bits of configuration policy into smaller files. Task includes pull in tasks from other files. Since handlers are tasks too, you can also include handler files from the ‘handler’ section. Roles in Ansible build on the idea of include files and combine them to form clean, reusable abstractions – they allow you to focus more on the big picture and only dive down into the details when needed.
  22. 22. CROSS PLATFORM – Linux, Windows, UNIX Agentless support for all major OS variants, physical, virtual, cloud and network HUMAN READABLE – YAML Perfectly describe and document every aspect of your application environment PERFECT DESCRIPTION OF APPLICATION Every change can be made by playbooks, ensuring everyone is on the same page VERSION CONTROLLED Playbooks are plain-text. Treat them like code in your existing version control. DYNAMIC INVENTORIES Capture all the servers 100% of the time, regardless of infrastructure, location, etc. ORCHESTRATION THAT PLAYS WELL WITH OTHERS Homogenize existing environments by leveraging current toolsets THE ANSIBLE WAY
  23. 23. RESOURCES Getting Started with Ansible https://www.ansible.com/get-started Ansible Essentials: Technical Overview https://redhat.com/.../do007-ansible-essentials Ansible Minneapolis Meetup https://www.meetup.com/Ansible-Minneapolis/
  24. 24. @KeithResar @KeithResar THANKS!

×