Slide 1

Slide 1 text

An By Steve Teo 1 Ansible Automation made simple

Slide 2

Slide 2 text

Agenda Why, What, How Ansible

Slide 3

Slide 3 text

Agenda Why, What, How Ansible Key Concepts

Slide 4

Slide 4 text

Agenda Why, What, How Ansible Key Concepts Code and Demo

Slide 5

Slide 5 text

Why Ansible? As the ‘environment’ guy, I rather drink coffee than change 42 expiring passwords manually

Slide 6

Slide 6 text

Why Ansible? As the ‘environment’ guy, I need a way of standardizing every environment to reduce environment complexity

Slide 7

Slide 7 text

Why Ansible? As the ‘deployment’ guy, I need a way of automating deployments across multiple environments in a reliable, repeatable fashion

Slide 8

Slide 8 text

Why Ansible? As the ‘automation’ guy, I need an automation solution which works in a severely restricted environment

Slide 9

Slide 9 text

Into the Past

Slide 10

Slide 10 text

What is Ansible? Simple, Powerful open-source automation engine Written in Python Competes with Chef, Puppet, Salt Stack Since 2012 by Michael Deehan

Slide 11

Slide 11 text

What is Ansible? Ad-hoc Task Execution Configuration management Application Deployment Multi-Node Orchestration Cloud Provisioning

Slide 12

Slide 12 text

Open-Source github.com/ansible/ansible 968+ Contributors 9503+ ★

Slide 13

Slide 13 text

Low Barrier to Entry Operates over SSH Agentless => Low Footprint Control Machine: > Python 2.6 Managed Nodes: > Python 2.4 No Database

Slide 14

Slide 14 text

Master and Minions

Slide 15

Slide 15 text

How do I install it? From Source git clone git://github.com/ansible/ansible.git –recursive cd ./ansible source ./hacking/env-setup Package Managers sudo pip install ansible brew install ansible sudo yum install ansible Easiest Offline Non-Root Installation pip local + virtualenvwrapper + ansible => portable tarball

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

Key Concepts

Slide 18

Slide 18 text

Ansible Architecture Credits: http://terry.im/wiki/terry/Ansible.html

Slide 19

Slide 19 text

Playbooks Recipe book, consists of ‘plays’ => Mapping between tasks and hosts Declared in English and YAML => Say what, not how Executed in the order it was written => No dependency graph

Slide 20

Slide 20 text

Eg. Change Password

Slide 21

Slide 21 text

Eg. Install Packages

Slide 22

Slide 22 text

Inventory List of hosts in your ‘inventory’ in INI style Can be grouped together, groups of groups too

Slide 23

Slide 23 text

Task Structure arguments module documentation variable loop

Slide 24

Slide 24 text

Modules Ansible is battery packed Ships with over 250 modules, split into core and extras http://docs.ansible.com/modules.html Modules are idempotent, avoids a whole set of problems abs(abs(x)) ≡ abs(x)

Slide 25

Slide 25 text

Module Idempotence

Slide 26

Slide 26 text

Frequently Used Modules Packages apt, yum, homebrew, pkg Command Execution command, shell System cron, service, supervisor File operations copy, template, file, fetch synchronize, unarchive User Management user, group Network get_url

Slide 27

Slide 27 text

Windows Modules? Powered by PowerShell Remoting win_chocolatey Installs packages using chocolatey win_feature Installs and uninstalls Windows Features win_get_url Fetches a file from a given URL win_group Add and remove local groups win_msi Installs and uninstalls Windows MSI files win_ping A windows version of the classic ping module win_service Manages Windows services win_stat returns information about a Windows file win_updates Lists / Installs windows updates win_user Manages local Windows user accounts

Slide 28

Slide 28 text

Variables Can be defined in inventory => all, group, host level Can be defined inlined Can be defined from included files and roles Can have defaults in roles Can be overridden at the command line level Referenced in tasks or templates

Slide 29

Slide 29 text

Roles Organizational abstraction which separate tasks from the hosts that it needs to run on DRY, Can be reused and redistributed Convention over configuration approach Global Repository => https://galaxy.ansible.com/

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Map Hosts to Roles

Slide 32

Slide 32 text

The Command Line ansible ansible-doc ansible-galaxy ansible-playbook ansible-pull ansible-vault

Slide 33

Slide 33 text

Code & Demo

Slide 34

Slide 34 text

Other Key Concepts

Slide 35

Slide 35 text

Multiple Environments ├── │ └── ├── │ ├── │ │ ├── │ │ ├── │ │ └── │ └── ├── │ ├── │ │ ├── │ │ ├── │ │ └── │ └──

Slide 36

Slide 36 text

Multiple Environments –

Slide 37

Slide 37 text

Role Dependencies http://docs.ansible.com/playbooks_roles.html #role-dependencies

Slide 38

Slide 38 text

Rolling Deployment http://docs.ansible.com/playbooks_delegation.html

Slide 39

Slide 39 text

Cloud Provisioning Provisioning modules Amazon Azure Digital Ocean Docker Google Linode OpenStack Rackspace VMWare http://docs.ansible.com/list_of_cloud_modules.html

Slide 40

Slide 40 text

Cloud Provisioning Inventory is never static Inventories can be specified as a script, manifest generated only at run-time http://docs.ansible.com/intro_dy namic_inventory.html

Slide 41

Slide 41 text

Best Practices http://docs.ansible.com/playbooks_best_pra ctices.html https://www.reinteractive.net/posts/167- ansible-real-life-good-practices http://rosstuck.com/multistage- environments-with-ansible/ http://goodcode.io/blog/ansible-tips/

Slide 42

Slide 42 text

Ansible Tower

Slide 43

Slide 43 text

Ansible Tower Mission Control Dashboard Role Based Access Control Push Button Job Runs Job Scheduling Audit Trail Free only up to 10 Nodes

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

Thank You Any Questions? M: Steve Teo E: [email protected] T: @kelltainer