1 SELF-SERVICE IT WITH ANSIBLE TOWER & MICROSOFT AZURE Chris Houseknecht Dave Johnson June 2016
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
3. 2 MICROSOFT AZURE NEW ANSIBLE MODULES FOR AZURE DYNAMIC INVENTORY SYNC FULL SUPPORT FOR RESOURCE MANAGER # Red Hat #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
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 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
Azure, EC2, OpenStack, VMware, Rackspace, GCE, Red Hat Satellite, CloudForms Hanlon, Cobbler Custom CMDB 4. 7
5. 1
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!
6. 2 PLAY BOOK /'plā,book/ noun A book containing a sports team's strategies and plays, especially in football.
6. 3 PLAY BOOK /'plā,book/ noun A book containing a sports team's strategies and plays, especially in football.
6. 4 PLAY BOOK /'plā,book/ noun A playbook is Ansible s configuration, deployment, and orchestration language.
6. 5 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.
6. 6 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.
6. 7 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.
6. 8 - 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
6. 9 - 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 }}" PLAY /plā/ noun Maps a group of hosts to a set of tasks. -name: Create virtual machine azure_rm_virtualmachine: name: testing-001
6. 10 - 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
6. 11 - 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
6. 12 - 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
6. 13 - 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 FACTS /fakts/ noun Useful variables about remote hosts that can be used within a playbook.
6. 14 - 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
6. 15 - 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 Task /task/ noun A unit of work. At a basic level, a task is a call to an Ansible module.
6. 16 - 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
6. 17 - 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
6. 18 - 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
6. 19 - 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
6. 20 -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:
6. 21 -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:
6. 22 -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:
6. 23 -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:
6. 24 -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:
6. 25 -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:
6. 26 -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
6. 27 -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
6. 28 -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
6. 29 -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
6. 30 -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
6. 31 -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
6. 32 -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
6. 33 -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
6. 34 -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
6. 35 -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
6. 36 -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
6. 37 -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
6. 38 -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 become: root roles: - role: galaxy_configure noun All the tasks, variables, handlers, templates and files needed to complete a unit of work. A role is self contained and completely reusable.
6. 39 -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
6. 40 SO... WHAT DOES A PLAYBOOK ACTUALLY LOOK LIKE?
6. 41 GALAXY HTTP://GALAXY.ANSIBLE.COM
7 DEMONSTRATION!
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. house@redhat.com thisdavejohnson@redhat.com