wall to wall ansible · a couple of tips to get you going going wall to wall 26 split off...

28
CONFIDENTIAL Designator Wall to wall Ansible Maxim Burgerhout Principal Solution Architect Red Hat 1

Upload: others

Post on 19-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

Wall to wall Ansible

Maxim BurgerhoutPrincipal Solution ArchitectRed Hat

1

Page 2: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Public

2

ABOUT ME

Twitter: @MaximBurgerhout

YouTube: 100 Things to do with Red Hat Management Products

bit.ly/100thingsredhat

Maxim Burgerhout

Principal Solutions Architect

[email protected]

Red Hat

Page 3: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

What I want to do today

AGENDA

3

BackgroundWhat is Ansible, where is it going

Ansible use casesWhat lies beyond configuration management

Going wall to wallHow do I maintain this huge playbook with my team(s)?

DemoLet’s see it!

Page 4: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

4

BACKGROUND

What’s Ansible?

Page 5: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL DesignatorANSIBLE BACKGROUND

5

Ansible

Simple Powerful Agentless

App deployment

Configuration management

Workflow orchestration

Network automation

Orchestrate the app lifecycle

Human readable automation

No special coding skills needed

Tasks executed in order

Usable by every team

Get productive quickly

Agentless architecture

Uses OpenSSH & WinRM

No agents to exploit or update

Get started immediately

More efficient & more secure

Page 6: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL DesignatorANSIBLE BACKGROUND

6

Ansible Automation works across teams

DEV QA/SECURITY I.T. OPERATIONSBUSINESS NETWORK

Page 7: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL DesignatorANSIBLE BACKGROUND

7

What can I do using Ansible?Automate the deployment and management of your entire IT footprint.

Orchestration

Do this...

Firewalls

Configuration Management

Application Deployment Provisioning Continuous Delivery Security and

Compliance

On these...

Load Balancers Applications Containers Clouds

Servers Infrastructure Storage And more...Network Devices

Page 8: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

8

BACKGROUND

How does it work?

Page 9: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

ANSIBLE AUTOMATION ENGINE

CMDB

USERS

INVENTORYHOSTS

NETWORK DEVICES

PLUGINS

CLI

MODULES

ANSIBLE PLAYBOOK

PUBLIC / PRIVATECLOUD

PUBLIC / PRIVATECLOUD

Page 10: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

ANSIBLE AUTOMATION ENGINE

CMDB

USERS

INVENTORYHOSTS

NETWORK DEVICES

PLUGINS

CLI

MODULES

ANSIBLE PLAYBOOK

PUBLIC / PRIVATECLOUD

PUBLIC / PRIVATECLOUD

PLAYBOOKS ARE WRITTEN IN YAML Tasks are executed sequentially Invoke Ansible modules

Page 11: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

11

PLAYBOOK EXAMPLE---

- name: install and start apache

hosts: web

become: yes

vars:

http_port: 80

tasks:

- name: httpd package is present

yum:

name: httpd

state: latest

- name: latest index.html file is present

copy:

src: files/index.html

dest: /var/www/html/

- name: httpd is started

service:

name: httpd

state: started

---

- name: install and start apache

hosts: web

become: yes

vars:

http_port: 80

tasks:

- name: httpd package is present

yum:

name: httpd

state: latest

- name: latest index.html file is present

copy:

src: files/index.html

dest: /var/www/html/

- name: httpd is started

service:

name: httpd

state: started

---

- name: install and start apache

hosts: web

become: yes

vars:

http_port: 80

tasks:

- name: httpd package is present

yum:

name: httpd

state: latest

- name: latest index.html file is present

copy:

src: files/index.html

dest: /var/www/html/

- name: httpd is started

service:

name: httpd

state: started

---

- name: install and start apache

hosts: web

become: yes

vars:

http_port: 80

tasks:

- name: httpd package is present

yum:

name: httpd

state: latest

- name: latest index.html file is present

copy:

src: files/index.html

dest: /var/www/html/

- name: httpd is started

service:

name: httpd

state: started

---

- name: install and start apache

hosts: web

become: yes

vars:

http_port: 80

tasks:

- name: httpd package is present

yum:

name: httpd

state: latest

- name: latest index.html file is present

copy:

src: files/index.html

dest: /var/www/html/

- name: httpd is started

service:

name: httpd

state: started

---

- name: install and start apache

hosts: web

become: yes

vars:

http_port: 80

tasks:

- name: httpd package is present

yum:

name: httpd

state: latest

- name: latest index.html file is present

copy:

src: files/index.html

dest: /var/www/html/

- name: httpd is started

service:

name: httpd

state: started

Page 12: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

ANSIBLE AUTOMATION ENGINE

CMDB

USERS

INVENTORYHOSTS

NETWORK DEVICES

PLUGINS

CLI

ANSIBLE PLAYBOOK

PUBLIC / PRIVATECLOUD

PUBLIC / PRIVATECLOUD

MODULES ARE “TOOLS IN THE TOOLKIT” Python, Powershell, or any language Extend Ansible simplicity to the entire stack

MODULES

CORE NETWORK COMMUNITY

Page 13: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

ANSIBLE AUTOMATION ENGINE

CMDB

USERS

INVENTORYHOSTS

NETWORK DEVICES

CLI

ANSIBLE PLAYBOOK

PUBLIC / PRIVATECLOUD

PUBLIC / PRIVATECLOUD

PLUGINS ARE “GEARS IN THE ENGINE” Code that plugs into the core engine Adaptability for various uses & platforms

MODULES PLUGINS

Page 14: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

ANSIBLE AUTOMATION ENGINE

CMDB

USERS

HOSTS

NETWORK DEVICES

CLI

ANSIBLE PLAYBOOK

PUBLIC / PRIVATECLOUD

PUBLIC / PRIVATECLOUD

MODULES PLUGINS

INVENTORY

INVENTORY

[web] webserver1.example.com webserver2.example.com

[db] dbserver1.example.com

[switches] leaf01.internal.com leaf02.internal.com

[firewalls] checkpoint01.internal.com

[lb] f5-01.internal.com

Page 15: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

ANSIBLE AUTOMATION ENGINE

USERS

HOSTS

NETWORK DEVICES

CLI

ANSIBLE PLAYBOOK

MODULES PLUGINS

INVENTORY

PUBLIC / PRIVATECLOUD PUBLIC / PRIVATE

CLOUD

CLOUD Red Hat Openstack, Red Hat Satellite, VMware, AWS EC2, Rackspace, Google Compute Engine, Azure

CMDB

Page 16: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

ANSIBLE AUTOMATION ENGINE

USERS

HOSTS

NETWORK DEVICES

CLI

ANSIBLE PLAYBOOK

MODULES PLUGINS

INVENTORY

CMDB ServiceNow, Cobbler, BMC, Custom cmdb

PUBLIC / PRIVATECLOUD

PUBLIC / PRIVATECLOUD

CMDB

Page 17: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

ANSIBLE AUTOMATION ENGINE

USERS

CLI

ANSIBLE PLAYBOOK

MODULES PLUGINS

INVENTORY

PUBLIC / PRIVATECLOUD

PUBLIC / PRIVATECLOUD

CMDB

HOSTS

NETWORK DEVICES

AUTOMATE EVERYTHING Red Hat Enterprise Linux, Ubuntu, Debian, Cisco routers, Arista switches, Juniper routers, Windows hosts, Checkpoint firewalls and more

Page 18: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

Ansible is a great tool for configuration management

But it is so much more!18

Page 19: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

Not all of those modules are for Linux configuration management, obviously

ANSIBLE BACKGROUND

19 Source: me, browsing through docs.ansible.com and the modules directory of my git clone of Ansible

Linux

Windows

F5

Checkpoint

Cisco

Citrix

Juniper

Arista

VMware

RHV

CyberArk

AWS

Azure

Google

InfoBlox

NetApp

And many, many more!

Page 20: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

Not all of those modules are for Linux configuration management, obviously

ANSIBLE BACKGROUND

20 Source: me, browsing through docs.ansible.com and the modules directory of my git clone of Ansible

Linux

Windows

F5

Checkpoint

Cisco

Citrix

Juniper

Arista

VMware

RHV

CyberArk

AWS

Azure

Google

InfoBlox

NetApp

And many, many more!

WHICH ONES ARE YOU USING?

Page 21: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

21

* Based on my totally non-scientific research of checking out git tags, running various find commands and piping the output to wc

ANSIBLE BACKGROUND

Page 22: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL DesignatorANSIBLE BACKGROUND

22

Cloud Virt & Container Windows Network Devops Monitoring

Ansible automates technologies you useTime to automate is measured in minutes

AWSAzureDigital OceanGoogleOpenStackRackspace+more

DockerVMwareRHVOpenStackOpenShift+more

ACLsFilesPackagesIISRegeditsSharesServicesConfigsUsersDomains+more

AristaA10CumulusBigswitchCiscoCumulusDellF5JuniperPalo AltoOpenSwitch+more

JiraGitHubVagrantJenkinsBambooAtlassianSubversionSlackHipchat+more

DynatraceAirbrakeBigPandaDatadogLogicMonitorNagiosNew RelicPagerDutySensuStackDriverZabbix+more

StorageNetappRed Hat StorageInfinidat+more

Operating SystemsRHEL and LinuxUnixWindows+more

Page 23: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

So, we automated all the things…

… now do we maintain this huge playbook together?

23

Page 24: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

Well, first of all, you don’t

GOING WALL TO WALL

24

Keep it simpleComplexity kills productivity

Ansible should not be like Perl!Optimize for readability, no write-only code!

Think declarativelyActually, no “code” at all. We are describing state.

Keep it smallIf you keep the bricks small, you can build great things!

Page 25: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

Re-use, share, and if you have to, steal ;)

GOING WALL TO WALL

25

If you have written a great playbook once, use it again!There is no merit in re-inventing the wheel

If you have written a great role, share it on Galaxy!Be a good open source citizen ;)

If you need functionality, check GalaxyOdds, are what you need already exists

Split off functionality into separate playbooks and chain themTower is great for this, but Ansible core can do it, too

Page 26: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

A couple of tips to get you going

GOING WALL TO WALL

26

Split off provisioning from configurationThat makes it easy to move to another platform

If you use Ansible Tower, learn to love the set_stats modulePass around that information

In your playbooks, mention all variables in the vars sectionMakes it easier for your successor (and yourself!)

Use dynamic groups and / or dynamic inventories(On some platforms, groups == tags)

Page 27: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

27

Shall I do a little demo at this point?

Page 28: Wall to wall Ansible · A couple of tips to get you going GOING WALL TO WALL 26 Split off provisioning from configuration That makes it easy to move to another platform If you use

CONFIDENTIAL Designator

linkedin.com/company/red-hat

youtube.com/user/RedHatVideos

facebook.com/redhatinc

twitter.com/RedHat

Red Hat is the world’s leading provider of enterprise

open source software solutions. Award-winning

support, training, and consulting services make

Red Hat a trusted adviser to the Fortune 500.

Thank you

28