Ansible Introduction
@dylanninin
2020-09-10
Content
• Hello World
• What & Why
• Fundamental
• Advanced
• Best Practices
• Q&A
Hello World
『 $ pip install ansible 』
server-guard: playbook
What is Ansible
A simple but powerful IT automation System
TEAM IMPACT
• Save time and be more productive
• Eliminate repetitive tasks
• Fewer mistakes & errors
• Improve collaboration and job satisfaction
ENTERPRISE IMPACT
• Overcome complexity
• More resources for innovation
• Increase accountability and compliance
The Value of Automation
Why Ansible
SIMPLE
Human readable automation
No special coding skills needed
Tasks executed in order
Get productive quickly
POWERFUL
App deployment
Configuration management
Workflow orchestration
Orchestrate the app lifecycle
AGENTLESS
Agentless architecture
Uses OpenSSH and WinRM
No agents to exploit or update
Predictable, reliable and secure
A simple but powerful IT automation System
Fundamental
Architecture
https://www.edureka.co/blog/what-is-ansible/
Inventory: hosts and groups
format: INI
https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html
format: YAML
-i inventory
-l subnet
Inventory: hosts and groups
Module: discrete units of code
within command line
within playbook
https://docs.ansible.com/ansible/latest/user_guide/modules_intro.html
Module: discrete units of code
https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html
Module
https://docs.ansible.com/ansible/latest/modules/modules_by_category.html
Playbook
https://www.oreilly.com/library/view/ansible-up-and/9781491979792/
server-guard: playbook
Playbook
Variables
https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html
- host_vars
- group_vars
- playbook
Variables
https://docs.ansible.com/ansible/2.3/playbooks_variables.html
priority
Templates
https://docs.ansible.com/ansible/latest/modules/template_module.html
Templates
https://jinja.palletsprojects.com/en/2.11.x/
Setup: Local Environment
https://www.vagrantup.com/
Layout
server-guard: playbook
ToolKit
1. ansible: execute via command line
2. ansible-playbook: run yaml playbook
3. ansible-vault: encryption/decryption of files
Advanced
YAML
https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html
Debug
ansible -v, —verbose
SSH
SSH: based on SSH
Python Interpreter
Bootstrap with raw
gitlab: playbook/hostname.yml
API
python runner.py
gitlab: playbook/runner.py
Plugins
https://docs.ansible.com/ansible/latest/plugins/plugins.html
Plugins - ngx_directive
Plugins - ngx_directive
Performance
https://www.ansible.com/blog/ansible-performance-tuning
OpenSSH:
- ControlPersist
- pipelining
Best Practices
https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html
Automated Your Workflow
Role: for easy sharing
https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html
role layout role usage
Galaxy: official sharing hub
https://galaxy.ansible.com/
Tower: centralized dashboard
https://www.ansible.com/products/tower
Q & A

Ansible Introduction