1

SELF-SERVICE IT WITH ANSIBLE TOWER &

Chris Houseknecht Dave Johnson

June 2016

#redhat #rhsummit 2 . 1

THE HARD PART IS BUILDING THE MACHINE THAT BUILDS THE PRODUCT

—Dennis Crowley, Co-Founder/CEO of Foursquare 2 . 2

THOSE WHO ARE MOST SUCCESSFUL ARE CAPABLE OF ‘HIGHER LEVEL THINKING’ — THEY ARE ABLE TO STEP BACK AND DESIGN A ‘MACHINE’ CONSISTING OF THE RIGHT PEOPLE DOING THE RIGHT THINGS TO GET WHAT THEY WANT.

—Ray Dalio, Founder of Bridgewater Associates 2 . 3

"already allowed us to save at least 10-15 hours per week managing our systems"

"we’ve been able to cut down certain processes from 17 hours to 3 minutes" 2 . 4

CATALOG

AUTOMATION

PLATFORM 2 . 5

CATALOG

AUTOMATION

PLATFORM 2 . 6

CATALOG

AUTOMATION

PLATFORM 2 . 7

CATALOG

AUTOMATION

PLATFORM 3 . 1

#redhat #rhsummit 3 . 2

MICROSOFT AZURE

NEW ANSIBLE MODULES FOR AZURE DYNAMIC INVENTORY SYNC FULL SUPPORT FOR RESOURCE MANAGER

# #rhsummit 3 . 3

MICROSOFT AZURE

RESOURCE MANAGER

Resource Groups Template Deployment Tags Access Control

# Red Hat #rhsummit 3 . 4

MICROSOFT AZURE DYNAMIC INVENTORY

Updated dynamic inventory synchronization [1]

Automatically groups hosts by:

Resource Group Location Security Group Tag Key Tag Key : Value

Optionally, turn off one or all groupings Conditionally select hosts with matching group values Controll from azure_rm.ini

[1] https://github.com/ansible/ansible/blob/devel/contrib/inventory/azure_rm.py 3 . 5

MICROSOFT AZURE NEW AZURE MODULES

azure_rm_storageaccount azure_rm_storageblob azure_rm_securitygroup azure_rm_virtualnetwork azure_rm_subnet azure_rm_networkinterface azure_rm_publicipaddress azure_rm_resourcegroup azure_rm_virtualmachine azure_rm_deployment

3 . 6

MICROSOFT AZURE NEW AZURE MODULES

Core support Shared library Authentication Validation Tag handling Parameters

# Red Hat #rhsummit 3 . 7

MICROSOFT AZURE

NEW AZURE MODULES

Getting started with Azure guide [1]

Requirements and setup Authentication Creating a virtual machine Using dynamic inventory

# Red Hat #rhsummit

[1] http://docs.ansible.com/ansible/guide_azure.html 3 . 8

MICROSOFT AZURE

NEW AZURE MODULES

Pull Requests Welcome! Issues on Github at ansible/anible-modules-core #ansible on IRC Ansible Project and Ansible Development mailing lists on Google

# Red Hat #rhsummit 4 . 1

#redhat #rhsummit 4 . 2

WHAT IS ANSIBLE?

It’s a simple automation language that can perfectly describe an IT application infrastructure in Ansible Playbooks.

It’s an automation engine that runs Ansible Playbooks.

4 . 3

SIMPLE POWERFUL AGENTLESS

Human readable automation App deployment Agentless architecture

No special coding skills needed Configuration management Uses OpenSSH & WinRM

Tasks executed in order Workflow orchestration No agents to exploit or update

Get productive quickly Orchestrate the app lifecycle More efficient & more secure

4 . 4 4 . 5

PLAYBOOKS ARE WRITTEN IN YAML

Tasks are executed sequentially Invoke Ansible modules

4 . 6

MODULES ARE “TOOLS IN THE TOOLKIT”

Python, Powershell, or any language Extend Ansible simplicity to entire stack

4 . 7

Azure, EC2, OpenStack, VMware, Rackspace, GCE, Red Hat , CloudForms Hanlon, Custom CMDB

5 . 1

#redhat #rhsummit 5 . 2 WHAT IS ANSIBLE TOWER?

Ansible tower is an enterprise framework for controlling, securing and managing your Ansible automation – with a UI and restful API.

1 Role-based access control 2 Push-button deployment 3 Centralized logging 4 RESTful API 6 . 1

PLAYBOOKS!

#redhat #rhsummit 6 . 2

PLAYBOOKS

PLAY • BOOK

/'plā,book/

noun

A book containing a sports team's strategies and plays, especially in football.

#redhat #rhsummit 6 . 3

PLAYBOOKS

PLAY • BOOK

/'plā,book/

noun

A book containing a sports team's strategies and plays, especially in football.

#redhat #rhsummit 6 . 4

PLAYBOOKS

PLAY • BOOK

/'plā,book/

noun

A playbook is Ansible’s configuration, deployment, and orchestration language.

#redhat #rhsummit 6 . 5

PLAYBOOKS

PLAY • BOOK

/'plā,book/

noun A playbook is Ansible’s configuration, deployment, and orchestration language. A playbook can be used to manage configurations of and deployments to remote machines. At a more advanced level, they can sequence multi-tier rollouts and delegate actions to other hosts.

#redhat #rhsummit 6 . 6

PLAYBOOKS

PLAY • BOOK

/'plā,book/

noun A playbook is Ansible’s configuration, deployment, and orchestration language. A playbook can be used to manage configurations of and deployments to remote machines. At a more advanced level, they can sequence multi-tier rollouts and delegate actions to other hosts. Playbooks are human-readable, written in a simple text language called YAML.

#redhat #rhsummit 6 . 7

PLAYBOOKS

PLAY • BOOK

/'plā,book/

noun Playbooks are Ansible’s configuration, deployment, and orchestration language. A playbook can be used to manage configurations of and deployments to remote machines. At a more advanced level, they can sequence multi-tier rollouts and delegate actions to other hosts. Playbooks are human-readable, written in a simple text language calledYAML. A playbook is composed of one or more ‘plays’ in a list.

#redhat #rhsummit 6 . 8

PLAYBOOKS

- name: Create Virtual Machine hosts: localhost connection: local gather_facts: no tasks: - name: Create resource group azure_rm_resourcegroup: name: "{{ resourcegroup_name }}" location: eastus tags: "{{ tags }}"

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 9

PLAYBOOKS

- name: Create Virtual Machine hosts: localhost PLAY connection: local /plā/ gather_facts: no noun tasks: Maps a group of hosts to a set of - name: Create resource group tasks. azure_rm_resourcegroup: name: "{{ resourcegroup_name }}" location: eastus tags: "{{ tags }}"

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 10

PLAYBOOKS

- name: Create Virtual Machine hosts: localhost connection: local gather_facts: no tasks: - name: Create resource group azure_rm_resourcegroup: name: "{{ resourcegroup_name }}" location: eastus tags: "{{ tags }}"

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 11

PLAYBOOKS

- name: Create Virtual Machine hosts: localhost connection: local gather_facts: no tasks: - name: Create resource group azure_rm_resourcegroup: name: "{{ resourcegroup_name }}" location: eastus tags: "{{ tags }}"

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 12

PLAYBOOKS

- name: Create Virtual Machine hosts: localhost connection: local gather_facts: no tasks: - name: Create resource group azure_rm_resourcegroup: name: "{{ resourcegroup_name }}" location: eastus tags: "{{ tags }}"

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 13

PLAYBOOKS

- name: Create Virtual Machine hosts: localhost FACTS connection: local /fakts/ gather_facts: no noun tasks: Useful variables about remote - name: Create resource group hosts that can be used within a azure_rm_resourcegroup: playbook. name: "{{ resourcegroup_name }}" location: eastus tags: "{{ tags }}"

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 14

PLAYBOOKS

- name: Create Virtual Machine hosts: localhost connection: local gather_facts: no tasks: - name: Create resource group azure_rm_resourcegroup: name: "{{ resourcegroup_name }}" location: eastus tags: "{{ tags }}"

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 15

PLAYBOOKS

- name: Create Virtual Machine Task hosts: localhost connection: local /task/

gather_facts: no noun tasks: A unit of work. At a basic level, a task is a call to an Ansible - name: Create resource group module. azure_rm_resourcegroup: name: "{{ resourcegroup_name }}" location: eastus tags: "{{ tags }}" -name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 16

PLAYBOOKS

- name: Create Virtual Machine hosts: localhost connection: local gather_facts: no tasks: - name: Create resource group azure_rm_resourcegroup: name: "{{ resourcegroup_name }}" location: eastus tags: "{{ tags }}"

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 17

PLAYBOOKS

- name: Create Virtual Machine hosts: localhost connection: local gather_facts: no tasks: - name: Create resource group azure_rm_resourcegroup: name: "{{ resourcegroup_name }}" location: "{{ location }}" tags: "{{ tags }}"

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 18

PLAYBOOKS

- name: Create Virtual Machine hosts: localhost connection: local gather_facts: no tasks: - name: Create resource group azure_rm_resourcegroup: name: "{{ resourcegroup_name }}" location: "{{ location }}" tags: "{{ tags }}" -name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 19

PLAYBOOKS

- name: Create Virtual Machine hosts: localhost connection: local gather_facts: no tasks: - name: Create resource group azure_rm_resourcegroup: name: "{{ resourcegroup_name }}" location: "{{ location }}" tags: "{{ tags }}" -name: Create virtual machine azure_rm_virtualmachine: name: testing-001

#redhat #rhsummit 6 . 20

PLAYBOOKS

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001 resource_group: "{{ resourcegroup_name }}" vm_size: Standard_D1 admin_username: admin ssh_public_keys: "{{ ssh_keys }}" image: "{{ image }}"

-name: Add new VM to inventory add_host:

#redhat #rhsummit 6 . 21

PLAYBOOKS

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001 resource_group: "{{ resourcegroup_name }}" vm_size: Standard_D1 admin_username: admin ssh_public_keys: "{{ ssh_keys }}" image: "{{ image }}"

-name: Add new VM to inventory add_host:

#redhat #rhsummit 6 . 22

PLAYBOOKS

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001 resource_group: "{{ resourcegroup_name }}" vm_size: Standard_D1 admin_username: admin ssh_public_keys: "{{ ssh_keys }}" image: "{{ image }}"

-name: Add new VM to inventory add_host:

#redhat #rhsummit 6 . 23

PLAYBOOKS

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001 resource_group: "{{ resourcegroup_name }}" vm_size: "{{ vm_size }}" admin_username: admin ssh_public_keys: "{{ ssh_keys }}" image: "{{ image }}"

-name: Add new VM to inventory add_host:

#redhat #rhsummit 6 . 24

PLAYBOOKS

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001 resource_group: "{{ resourcegroup_name }}" vm_size: "{{ vm_size }}" admin_username: admin ssh_public_keys: "{{ ssh_keys }}" image: "{{ image }}"

-name: Add new VM to inventory add_host:

#redhat #rhsummit 6 . 25

PLAYBOOKS

-name: Create virtual machine azure_rm_virtualmachine: name: testing-001 resource_group: "{{ resourcegroup_name }}" vm_size: "{{ vm_size }}" admin_username: admin ssh_public_keys: "{{ ssh_keys }}" image: "{{ image }}"

-name: Add new VM to inventory add_host:

#redhat #rhsummit 6 . 26

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure Galaxy VM hosts: galaxy become: yes become: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 27

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure Galaxy VM hosts: galaxy become: yes become: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 28

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure Galaxy VM hosts: galaxy become: yes become: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 29

PLAYBOOKS

-name: Add new VM to inventory add_host: name: "{{ arm_vm_name }}" ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure Galaxy VM hosts: galaxy become: yes become: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 30

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure Galaxy VM hosts: galaxy become: yes become: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 31

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure Galaxy VM hosts: galaxy become: yes become: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 32

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure Galaxy VM hosts: galaxy become: yes become: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 33

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure for Galaxy deployment hosts: galaxy become: yes beome: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 34

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure for Galaxy deployment hosts: galaxy become: yes become: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 35

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure for Galaxy deployment hosts: galaxy become: yes become: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 36

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure for Galaxy deployment hosts: galaxy become: yes become root: roles: - role: galaxy_configure

#redhat #rhsummit 6 . 37

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure for Galaxy deployment hosts: galaxy become: yes become: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 38

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure for Galaxy deployment ROLE hosts: galaxy /rōl/ become: yes noun become: root All the tasks, variables, handlers, roles: templates and files needed to complete a unit of work. A role is self - role: galaxy_configure contained and completely reusable.

#redhat #rhsummit 6 . 39

PLAYBOOKS

-name: Add new VM to inventory add_host: name: testing-001 ansible_host: "{{...publicIPAddress.properties.ipAddress }}" fqdn: "{{...publicIPAddress.properties.dnsSettings.fqdn }}" groups: galaxy

- name: Configure Galaxy VM hosts: galaxy become: yes become: root roles: - role: galaxy_configure

#redhat #rhsummit 6 . 40

PLAYBOOKS

SO... WHAT DOES A PLAYBOOK ACTUALLY LOOK LIKE?

#redhat #rhsummit 6 . 41

PLAYBOOKS

GALAXY

HTTP://GALAXY.ANSIBLE.COM

#redhat #rhsummit 7

DEMONSTRATION!

#redhat #rhsummit 8

GETTING STARTED

Have you used Ansible already? Try Tower for free: ansible.com/tower-trial Would you like to learn Ansible? It’s easy to get started: ansible.com/get-started Want to learn more? ansible.com/whitepapers

Ansible for Azure:

docs.ansible.com/ansible/guide_azure.html docs.ansible.com/ansible/list_of_cloud_modules.html#azure

9

LEARN. NETWORK. EXPERIENCE OPEN SOURCE.

[email protected] #redhat #rhsummit [email protected]