Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS •...

55
ANSIBLE Automating your infrastructure with Ansible Fabio Alessandro Locati Senior Cloud Consultant 27 January 2017

Transcript of Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS •...

Page 1: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLEAutomating your infrastructure with Ansible

Fabio Alessandro LocatiSenior Cloud Consultant27 January 2017

Page 2: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

OUTLINE

Intro

Automation

Automation Concepts

Ansible

2

Page 3: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

INTRO

Page 4: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ABOUT ME

• IT Consultant since 2004• Ansible user since 2013

4

Page 5: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ABOUT ME

• IT Consultant since 2004

• Ansible user since 2013

4

Page 6: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ABOUT ME

• IT Consultant since 2004• Ansible user since 2013

4

Page 7: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

TODAY’S PROBLEMS

• Auditability• Job-hopping• Speed• Scalability• Horizontal scaling (IaaS “cloud”)• Expected QoS

5

Page 8: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

TODAY’S PROBLEMS

• Auditability

• Job-hopping• Speed• Scalability• Horizontal scaling (IaaS “cloud”)• Expected QoS

5

Page 9: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

TODAY’S PROBLEMS

• Auditability• Job-hopping

• Speed• Scalability• Horizontal scaling (IaaS “cloud”)• Expected QoS

5

Page 10: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

TODAY’S PROBLEMS

• Auditability• Job-hopping• Speed

• Scalability• Horizontal scaling (IaaS “cloud”)• Expected QoS

5

Page 11: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

TODAY’S PROBLEMS

• Auditability• Job-hopping• Speed• Scalability

• Horizontal scaling (IaaS “cloud”)• Expected QoS

5

Page 12: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

TODAY’S PROBLEMS

• Auditability• Job-hopping• Speed• Scalability• Horizontal scaling (IaaS “cloud”)

• Expected QoS

5

Page 13: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

TODAY’S PROBLEMS

• Auditability• Job-hopping• Speed• Scalability• Horizontal scaling (IaaS “cloud”)• Expected QoS

5

Page 14: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

AUTOMATION

Page 15: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ADVANTAGES

• Infrastructure as Code

• Code is the infrastructure documentation*• Simplify auditability

• Infrastructures with no humans with root powers• Easy and quick to scale out

7

Page 16: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ADVANTAGES

• Infrastructure as Code

• Code is the infrastructure documentation*• Simplify auditability

• Infrastructures with no humans with root powers• Easy and quick to scale out

7

Page 17: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ADVANTAGES

• Infrastructure as Code• Code is the infrastructure documentation*

• Simplify auditability

• Infrastructures with no humans with root powers• Easy and quick to scale out

7

Page 18: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ADVANTAGES

• Infrastructure as Code• Code is the infrastructure documentation*• Simplify auditability

• Infrastructures with no humans with root powers• Easy and quick to scale out

7

Page 19: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ADVANTAGES

• Infrastructure as Code• Code is the infrastructure documentation*• Simplify auditability

• Infrastructures with no humans with root powers

• Easy and quick to scale out

7

Page 20: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ADVANTAGES

• Infrastructure as Code• Code is the infrastructure documentation*• Simplify auditability

• Infrastructures with no humans with root powers• Easy and quick to scale out

7

Page 21: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

AUTOMATION CONCEPTS

Page 22: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

AGENT

An Agent is a daemon that runs on every controlled machine and that will checkwith the server (master) every N minutes to ensure that the host is aligned withthe latest configuration version. If this is not the case, the Agent will download thelastest configuration version and apply it.

• Advantages

• High performance during commands execution• Connection between clients and server is client managed

• Disadvantages

• Forces the master to be in the least secure network segment• Resources are used even if no changes are being applied• More daemons to take care of• Chicken and Egg problem

9

Page 23: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

AGENT

An Agent is a daemon that runs on every controlled machine and that will checkwith the server (master) every N minutes to ensure that the host is aligned withthe latest configuration version. If this is not the case, the Agent will download thelastest configuration version and apply it.

• Advantages

• High performance during commands execution• Connection between clients and server is client managed

• Disadvantages

• Forces the master to be in the least secure network segment• Resources are used even if no changes are being applied• More daemons to take care of• Chicken and Egg problem

9

Page 24: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

AGENT

An Agent is a daemon that runs on every controlled machine and that will checkwith the server (master) every N minutes to ensure that the host is aligned withthe latest configuration version. If this is not the case, the Agent will download thelastest configuration version and apply it.

• Advantages• High performance during commands execution

• Connection between clients and server is client managed

• Disadvantages

• Forces the master to be in the least secure network segment• Resources are used even if no changes are being applied• More daemons to take care of• Chicken and Egg problem

9

Page 25: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

AGENT

An Agent is a daemon that runs on every controlled machine and that will checkwith the server (master) every N minutes to ensure that the host is aligned withthe latest configuration version. If this is not the case, the Agent will download thelastest configuration version and apply it.

• Advantages• High performance during commands execution• Connection between clients and server is client managed

• Disadvantages

• Forces the master to be in the least secure network segment• Resources are used even if no changes are being applied• More daemons to take care of• Chicken and Egg problem

9

Page 26: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

AGENT

An Agent is a daemon that runs on every controlled machine and that will checkwith the server (master) every N minutes to ensure that the host is aligned withthe latest configuration version. If this is not the case, the Agent will download thelastest configuration version and apply it.

• Advantages• High performance during commands execution• Connection between clients and server is client managed

• Disadvantages

• Forces the master to be in the least secure network segment• Resources are used even if no changes are being applied• More daemons to take care of• Chicken and Egg problem

9

Page 27: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

AGENT

An Agent is a daemon that runs on every controlled machine and that will checkwith the server (master) every N minutes to ensure that the host is aligned withthe latest configuration version. If this is not the case, the Agent will download thelastest configuration version and apply it.

• Advantages• High performance during commands execution• Connection between clients and server is client managed

• Disadvantages• Forces the master to be in the least secure network segment

• Resources are used even if no changes are being applied• More daemons to take care of• Chicken and Egg problem

9

Page 28: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

AGENT

An Agent is a daemon that runs on every controlled machine and that will checkwith the server (master) every N minutes to ensure that the host is aligned withthe latest configuration version. If this is not the case, the Agent will download thelastest configuration version and apply it.

• Advantages• High performance during commands execution• Connection between clients and server is client managed

• Disadvantages• Forces the master to be in the least secure network segment• Resources are used even if no changes are being applied

• More daemons to take care of• Chicken and Egg problem

9

Page 29: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

AGENT

An Agent is a daemon that runs on every controlled machine and that will checkwith the server (master) every N minutes to ensure that the host is aligned withthe latest configuration version. If this is not the case, the Agent will download thelastest configuration version and apply it.

• Advantages• High performance during commands execution• Connection between clients and server is client managed

• Disadvantages• Forces the master to be in the least secure network segment• Resources are used even if no changes are being applied• More daemons to take care of

• Chicken and Egg problem

9

Page 30: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

AGENT

An Agent is a daemon that runs on every controlled machine and that will checkwith the server (master) every N minutes to ensure that the host is aligned withthe latest configuration version. If this is not the case, the Agent will download thelastest configuration version and apply it.

• Advantages• High performance during commands execution• Connection between clients and server is client managed

• Disadvantages• Forces the master to be in the least secure network segment• Resources are used even if no changes are being applied• More daemons to take care of• Chicken and Egg problem

9

Page 31: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

IDEMPOTENCE

DefinitionIdempotence is the property of certain operations in mathematics and computerscience, that can be applied multiple times without changing the result beyondthe initial application.

10

Page 32: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

INFRASTRUCTURE AS CODE DATA

• Really simple to write• Even simpler to read• Only the bit important to you need to be written

11

Page 33: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

INFRASTRUCTURE AS CODE DATA

• Really simple to write

• Even simpler to read• Only the bit important to you need to be written

11

Page 34: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

INFRASTRUCTURE AS CODE DATA

• Really simple to write• Even simpler to read

• Only the bit important to you need to be written

11

Page 35: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

INFRASTRUCTURE AS CODE DATA

• Really simple to write• Even simpler to read• Only the bit important to you need to be written

11

Page 36: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

EXAMPLE OF SYNTAX

- hosts: allbecome: Truetasks:- name: Ensure MySQL is installed

yum:name: mysqlstate: present

- name: Ensure user tom is presentuser:

name: tomstate: present

12

Page 37: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

Page 38: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

• Written in Python• Mainly push mode• Advantages

• Infrastructure as Data (in YAML format)• Very gentle learning curve• Very simple setup• Balanced tool

• Disadvantages

• Not very good introspection tools (yet!)• Community is young

14

Page 39: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

• Written in Python

• Mainly push mode• Advantages

• Infrastructure as Data (in YAML format)• Very gentle learning curve• Very simple setup• Balanced tool

• Disadvantages

• Not very good introspection tools (yet!)• Community is young

14

Page 40: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

• Written in Python• Mainly push mode

• Advantages

• Infrastructure as Data (in YAML format)• Very gentle learning curve• Very simple setup• Balanced tool

• Disadvantages

• Not very good introspection tools (yet!)• Community is young

14

Page 41: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

• Written in Python• Mainly push mode• Advantages

• Infrastructure as Data (in YAML format)• Very gentle learning curve• Very simple setup• Balanced tool

• Disadvantages

• Not very good introspection tools (yet!)• Community is young

14

Page 42: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

• Written in Python• Mainly push mode• Advantages

• Infrastructure as Data (in YAML format)

• Very gentle learning curve• Very simple setup• Balanced tool

• Disadvantages

• Not very good introspection tools (yet!)• Community is young

14

Page 43: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

• Written in Python• Mainly push mode• Advantages

• Infrastructure as Data (in YAML format)• Very gentle learning curve

• Very simple setup• Balanced tool

• Disadvantages

• Not very good introspection tools (yet!)• Community is young

14

Page 44: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

• Written in Python• Mainly push mode• Advantages

• Infrastructure as Data (in YAML format)• Very gentle learning curve• Very simple setup

• Balanced tool

• Disadvantages

• Not very good introspection tools (yet!)• Community is young

14

Page 45: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

• Written in Python• Mainly push mode• Advantages

• Infrastructure as Data (in YAML format)• Very gentle learning curve• Very simple setup• Balanced tool

• Disadvantages

• Not very good introspection tools (yet!)• Community is young

14

Page 46: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

• Written in Python• Mainly push mode• Advantages

• Infrastructure as Data (in YAML format)• Very gentle learning curve• Very simple setup• Balanced tool

• Disadvantages

• Not very good introspection tools (yet!)• Community is young

14

Page 47: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

• Written in Python• Mainly push mode• Advantages

• Infrastructure as Data (in YAML format)• Very gentle learning curve• Very simple setup• Balanced tool

• Disadvantages• Not very good introspection tools (yet!)

• Community is young

14

Page 48: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ANSIBLE

• Written in Python• Mainly push mode• Advantages

• Infrastructure as Data (in YAML format)• Very gentle learning curve• Very simple setup• Balanced tool

• Disadvantages• Not very good introspection tools (yet!)• Community is young

14

Page 49: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

USUAL DEPLOYMENT PROCESS

• Automate few actions with Ansible Playbooks• Create Ansible Roles for the setup of a simple machine type• Rollout of the first machines completely managed with Ansible• Migration of all machines to Ansible

15

Page 50: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

USUAL DEPLOYMENT PROCESS

• Automate few actions with Ansible Playbooks

• Create Ansible Roles for the setup of a simple machine type• Rollout of the first machines completely managed with Ansible• Migration of all machines to Ansible

15

Page 51: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

USUAL DEPLOYMENT PROCESS

• Automate few actions with Ansible Playbooks• Create Ansible Roles for the setup of a simple machine type

• Rollout of the first machines completely managed with Ansible• Migration of all machines to Ansible

15

Page 52: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

USUAL DEPLOYMENT PROCESS

• Automate few actions with Ansible Playbooks• Create Ansible Roles for the setup of a simple machine type• Rollout of the first machines completely managed with Ansible

• Migration of all machines to Ansible

15

Page 53: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

USUAL DEPLOYMENT PROCESS

• Automate few actions with Ansible Playbooks• Create Ansible Roles for the setup of a simple machine type• Rollout of the first machines completely managed with Ansible• Migration of all machines to Ansible

15

Page 54: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

ADDITIONAL RESOURCES

• Slides: https://slides.fale.io/20170127-en-ansible.pdf• Demo code: https://github.com/fale/ansible_lamp• Official documentation: http://docs.ansible.com• Videos: https://www.ansible.com/videos• Whitepapers: https://www.ansible.com/whitepapers• Ebooks: https://www.ansible.com/ebooks

16

Page 55: Ansible - Automating your infrastructure with Ansible · 27.01.2017  · TODAY’SPROBLEMS • Auditability • Job-hopping • Speed • Scalability • Horizontalscaling(IaaS“cloud”)

THANK YOU

plus.google.com/+RedHat

linkedin.com/company/red-hat

youtube.com/user/RedHatVideos

facebook.com/redhatinc

twitter.com/RedHatNews