ansible wechat account ansible meetup shanghai august
play

Ansible Wechat Account Ansible Meetup Shanghai August 17th - PowerPoint PPT Presentation

Ansible Wechat Account Ansible Meetup Shanghai August 17th ansible.com wiredcraft.com Introduction What is Ansible? Ansible.com Gaining momentum Ansible on GitHub Very fast learning curve Python based Easy to get


  1. Ansible Wechat Account

  2. Ansible Meetup Shanghai August 17th

  3. ansible.com wiredcraft.com

  4. Introduction

  5. What is Ansible? • Ansible.com • Gaining momentum • Ansible on GitHub • Very fast learning curve • Python based • Easy to get started • Easy to extend • Agent-less

  6. Similar Tools • salt-stack: python based, server / agent (minions) • puppet: ruby based, server/agent - harder • chef: ruby based, server/agent - harder • capistrano: ruby based, more focused toward deployment work fl ow

  7. Install and Configuration Install • either through your package manager, yum / apt-get • or better through pip install ansible for the latest versions Configuration • environment variables • ansible.cfg in current folder, home dir or /etc/ansible Latest version are "preferred" as Ansible evolves very quickly with bug fixes and new features (4 months ago newest release and daily pull request)

  8. Concepts

  9. Ansible Concepts YAML • used everywhere; to list tasks, handlers, variables, etc. • it's the easiest way to have a structured yet reader friendly file structure (e.g. compared to json) Modules • atomic operations • manage idempotence • many are core, lots are community, covers from cloud service (aws), to lineinfile, to file, to ...

  10. Ansible Concepts Playbook • sequential list of operation • collection of tasks, handlers Tasks / Handlers • tasks: has a name, executes a module action, completes with either success / failure / skipped • handlers: "sleeping" tasks that can be invoked by a task upon completion (e.g. when config file change, restart service)

  11. Ansible Concepts Variables • host_vars - host specific variables • group_vars - group specific variables • file vars - external file that can be used to load some variables (syntax -e "@filename.yml" ) • vars registration - one can register variable during the execution of a playbook for future use Inventory • collection of hosts / groups

  12. Tool Belt CLI

  13. Tool Belt Ansible • used to run simple modules • ansible all -i hosts -m ping Ansible-playbook • used to execute a playbook • ansible-playbook -i hosts playbook.yml

  14. Tool Belt Ansible-vault • used to access and load secrets Ansible-galaxy • used to search, fetch roles • ansible-galaxy install user.roles fetch and install a role globally (in `/etc/ansible/roles`) • ansible-galaxy install -r roles.txt -p roles fetch and install roles defined in roles.txt file (similar to requirements.txt ) and save in roles folder

  15. Roles / Galaxy • Community driven collection of roles at http:// galaxy.ansible.com • Roles are collection of tasks / handlers used to tackle larger set of tasks - e.g. setup, install, configure nginx and the vhosts

  16. Questions?

  17. Live Demo

  18. Next Meetup and Feedback

Recommend


More recommend