Ansible
a tool for automation of * application deployment * configuration management * cloud provisioning * ad-hoc task-execution * multinode orchestration
* open source * [www.ansible.com](https://www.ansible.com) * current version: 2.4.1.0 * maintained by RedHat
## Differences to Puppet * no master server * no agents * serial execution * push vs. pull
## All you need is * a control machine * some target servers * a little knowledge
## Control machine (typically the users workstation) * Linux * Python 2/3 * SSH client * and Ansible Ansible is available via Pip, Yum, Apt, tar.gz ... or as Docker Image `ansible/ansible` on DockerHub
## target servers * Linux * SSH * Python 2.6 * Windows * Powershell
## Useful knowledge * YAML * General linux knowledge * It's easy to learn
## Ansible offers * Idempotent execution ! * Lots of modules * Linux administration * VMWare ESX * Docker * ...
## Ansible offers * Authentication via SSH Key, Password * Privilege escalation (sudo) * Template engine Jinja2 (Turing complete) * Differnt types of Plugins * Check-Mode * Vault for storing secrets * Rolling updates
## How does it work * connects using SSH to remote * Setup phase --> Fact gathering * copy generated python code * execute code
## How to use 1. Ad-Hoc commands 2. Playbooks
## Ad-Hoc quick & dirty from the command line ```bash $ ansible my-server -m setup $ ansible my-server -a "uname -a" $ ansible my-server [-m command] -a "/sbin/reboot" ```
## Playbooks * Playbooks are code * typically stored in SCM ```bash $ ansible-playbook my-playbook.yml $ ansible-playbook -i inventories/my-site.ini my-playbook.yml ```
## Elements * Inventory * Task * Playbook * Role * Variable
## Inventory * Ini-file syntax * Contains host groups * Variables per host or host group * Groups can be hierarchical * Wildcards for server names * Inventory scripts / plugins
## Task * Specifies what to to * Module + parameters * Options * Conditions * Loops
## Playbook * Contains plays * specifies targets (host groups) * contains tasks * can include roles
## Role * Reusable * Contains tasks * Can include other roles * Defines default variables
## Variable Can be defined in * Role * Playbook * Inventory * Command Line * [Variable precedence](http://docs.ansible.com/ansible/latest/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable) list contains 21 entries
### Ansible Tower commercial web based UI for Ansible ### Ansible Galaxy Online repository for sharing roles
# The end.