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
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 started • Easy to extend • Agent-less
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
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)
Concepts
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 ...
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)
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
Tool Belt CLI
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
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
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
Questions?
Live Demo
Next Meetup and Feedback
Recommend
More recommend
Explore More Topics
Stay informed with curated content and fresh updates.