SlideShare a Scribd company logo
1 of 25
Download to read offline
Ansible
Leveraging 2.0
What can it do for me?
Interesting stuff in 2.0
• Revamped core, makes many fixes and new features possible
• More information and better error handling (consequence of core revamp)
• Improved inheritance model
• Strategies
• Blocks
• Dynamic includes
• meta: refresh_inventory
• delegate_facts
• Plugins … sooo many plugins ….
_______________________________________________
/ http://docs.ansible.com/ansible/porting_guide_2.0.html 
 or read CHANGELOG for more details /
-----------------------------------------------
 ^__^
 (oo)_______
(__) )/
||----w |
|| ||
More information
#> ansible-playbook -vv play.yml
Using /etc/ansible/ansible.cfg as config file
PLAYBOOK: play.yml *************************************************************
1 plays in play.yml
TASK [wait_for] ****************************************************************
task path: /home/bcoca/work/testing/play.yml:5
ok: [localhost] => (item=1) => {"changed": false, "elapsed": 1, "failed": false, "failed_when_result": false,
"item": 1, "path": null, "port": null, "search_regex": null, "state": "started"}
failed: [localhost] => (item=2) => {"changed": false, "elapsed": 2, "failed": true, "failed_when_result": true,
"item": 2, "path": null, "port": null, "search_regex": null, "state": "started"}
skipping: [localhost] => (item=3) => {"changed": false, "item": 3, "skip_reason": "Conditional check failed",
"skipped": true}
NO MORE HOSTS LEFT *************************************************************
PLAY RECAP *********************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1
- command: /do/some/stuff
when: a == b
when: c == d
PREVIOUSLY:
a == b is ignored
only c == d is considered
NO ERRORS OR WARNINGS
Better error handling
NOW:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/home/bcoca/work/test/play.yml': line 6, column 6, but
may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- command: do some stuff
when: a == b
^ here
Better error handling
- command: /do/stuff
wen: a == b
PREVIOUSLY:
a == b is ignored
command is always executed
NO ERRORS OR WARNINGS
NOW:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/home/bcoca/work/test/play.yml': line 6, column 6, but
may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- command: do some stuff
wen: a == b
^ here
Better error handling
- hosts: servers
tasks:
command: /do/stuff
PREVIOUSLY:
command is ignored
NO ERRORS OR WARNINGS
NOW:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/home/bcoca/testing/ansible/play.yml': line 3, column 6,
but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
command: /do/stuff
^ here
No Inheritance
- hosts: appservers
vars:
stuff: “todays_info_{{lookup(‘pipe’, ‘date +%s’)}}”
become: yes
tasks:
- get_url: url= www.example.com/{{stuff}}.rpm dest=/temp/
ignore_errors: True
become: no
- yum: package=/temp/{{stuff}}.rpm state=present
ignore_errors: True
become: no
- service: name=stuff_service state=restarted
ignore_errors: True
become: no
Inheritance
- hosts: appservers
ignore_errors: True
become: yes
vars:
stuff: “todays_info_{{lookup(‘pipe’, ‘date +%s’)}}”
tasks:
- get_url: url= www.example.com/{{stuff}}.rpm dest=/temp/
become: no
- rpm: package=/temp/{{stuff}}.rpm state=present
become: no
- service: name=stuff_service state=restarted
become: no
Blocks: inheritance
- block:
- get_url: uri=http://example/{{stuff}}.rpm dest=/temp/
- yum: package=/temp/{{stuff}}.rpm state=present
- service: name=stuff_service state=restarted
ignore_errors: True
vars:
stuff: “todays_info_{{lookup(‘pipe’, ‘date +%s’)}}”
remote_user: brad
become: No
Strategy: linear (as usual)
10 servers 5 forks:
- task 1: 5 first servers
- task 1: 5 next servers
- task 2: 5 first servers
- task 2: 5 next servers
- task 3: 5 first servers
- task 3: 5 next servers
_________________________________
/ Each batch ends as fast as the 
 slowest server in the group. /
---------------------------------


__
UooU.'@@@@@@`.
__/(@@@@@@@@@@)
(@@@@@@@@)
`YY~~~~YY'
|| ||
Strategy: linear (serial 5)
10 servers 5 serial 5 forks:
_____________________________
/ Each batch is now per play, 
 instead of per task. /
-----------------------------


oO)-. .-(Oo
/__ _ /_ __
 ( | ()~() | )/ /
__| | (-___-) | /|__/
' '--' ==`-'== '--' '
- task 1: 5 first servers
- task 2: 5 first servers
- task 3: 5 first servers
- task 1: 5 next servers
- task 2: 5 next servers
- task 3: 5 next servers
Stragegy: free
10 servers 5 forks:
- task1: server1, server2, server3
- task2: server1, server2 && task1: server4, server5
- task3: server1 && task2: server3
- task2: server4 && task1: server6
- task1: server7 && task2: server5, server2 && task3: server3
- task2: server6, server7 && task3: server4, server5 && task1: server8
- task3: server6, server7, server2 && task1: server9, server10 ...
_____________________________________
/ Each server finishes play as 
| fast as it can, when it is done | /_)o<
 a new server can start. /  | 
------------------------------------- | O . O|
_____/
Strategy: free
- name: Heartbleed update
hosts: all
strategy: free
tasks:
- apt: name=openssh state=latest update_cache=yes
_________________________________________
/ Now you update hosts as fast as they 
 can, no need to wait for a ‘slow host’. /
-----------------------------------------

 
 /
( )
.( o ).
Blocks: Error handling (Before)
- command: /do/stuff
register: myvar
ignore_errors: True
- command: /do/more/stuff
register: myvar2
ignore_errors: True
…
- command: /recover
when: myvar|failed or myvar2|failed or ...
____________________________________
/ each command must ignore errors 
| and register a variable, then use |
 complex conditionals to capture /
------------------------------------


___
{~._.~}
( Y )
()~*~()
(_)-(_)
Blocks: Error handling (After)
- block
- command: /do/stuff
- command: /do/more/stuff
…
rescue:
- command: /recover
___________________________________
< Now it is clear, simple and clean >
-----------------------------------
 ___-------___
 _-~~ ~~-_
 _-~ /~-_
/^__/^ /~  / 
/| O|| O| / _______________/ 
| |___||__| / /  
|  / /  
| (_______) /______/ _________ 
| / /  / 
 ^  /  /
 || ______________/ _-_ //__//
 ||------_-~~-_ -------------  --/~ ~ || __/
~-----||====/~ |==================| |/~~~~~
(_(__/ ./ / _ .
(_(___/ _____)_)
Dynamic includes: variable dependant (Before)
- include: debian.yml
when: ansible_os_distribution == ‘Debian’
- include: redhat.yml
when: ansible_os_distribution == ‘RedHat’
- include: alpine.yml
when: ansible_os_distribution == ‘Alpine’
- include: freebsd.yml
when: ansible_os_distribution == ‘FreeBSD’
- include: default.yml
when: ansible_os_distribution not in [‘Debian’,‘Redhat’, … ]
Dynamic Includes: variable dependant (After)
- include: “{{item}}”
with_first_found:
- “{{ansible_os_distribution|lower}}.yml”
- default.yml
__________________________
< now rent out empty space >
--------------------------
 ^__^
 (oo)_______
(__) )/
||----w |
|| ||
Dynamic includes: loop (Before)
- include: test.yml
vars:
stuff: [1,2,3]
test.yml:
---
- command: /do/stuff -o {{item}}
with_items: “{{stuff}}”
- command: /do/more/stuff -o {{item}}
with_items: “{{stuff}}”
- command: /do/even/more/stuff -o {{item}}
with_items: “{{stuff}}”
- command: /do/nested/stuff -o {{item[0]}} -p {{item[1]}}
with_nested:
- “{{stuff}}”
- [a,b,c]
_______________________________________
/ each task loops over all items before 
 the next /
---------------------------------------
 / ___ /
 // / / 
(( O O ))
 /  //
/ | | /
| | | |
| | | |
| o |
| | | |
|m| |m|
Dynamic Includes: loop (After)
- include: test.yml
with_items: “{{stuff}}”
vars:
stuff: [1,2,3]
test.yml:
---
- command: /do/stuff -o {{item}}
- command: /do/more/stuff -o {{item}}
- command: /do/even/more/stuff -o {{item}}
- name: handle nested loops
set_fact: outer_item={{item}}
- command: /do/nested/stuff -o {{outer_item}} -p {{item}}
with_items: [a,b,c]
___________________
/ all tasks run per 
 item iteration /
-------------------


.--.
|o_o |
|:_/ |
//  
(| | )
/'_ _/`
___)=(___/
cloud inventory (before)
- digital_ocean:
command: droplet
name: app_{{item.name}}
state: present
with_items: “{{new_host_data}}”
register: new_hosts
- add_hosts:
host: “{{item.droplet.name}}”
ansible_ssh_host: “{{item.droplet.ip_address}}”
groups: “{{‘,’|join([item.droplet.image_id, item.droplet....])}}”
do_id: “{{item.droplet.id}}”
....
with_items: “{{new_hosts.results}}”
- hosts: appservers
...
cloud inventory (After)
- digital_ocean:
command: droplet
name: app_{{item.name}}
state: present
with_items: “{{new_host_data}}”
- meta: refresh_inventory
- hosts: appservers
...
____________________________
< less add_host and group_by >
----------------------------
 (__)
 /oo|
(_"_)*+++++++++*
//I#I
I[I|I|||||I I `
I`I'///'' I I
I I I I
~ ~ ~ ~
other facts (Before)
- hosts: webservers
gather_facts: True
- hosts: dbhosts
tasks:
- itpables:
allow: “{{hostvars[item][‘ansible_default_ipv4’][‘address’]}}”
- with_items: “{{groups[‘webservers’]}}”
other facts (After)
- hosts: dbhosts
tasks:
- setup:
delegate_to: “{{item}}”
delegate_facts: True
with_items: “”{groups[‘webservers’]}}”
run_once: True
- itpables:
allow: “{{hostvars[item][‘ansible_default_ipv4’][‘address’]}}”
with_items: “{{groups[‘webservers’]}}”
Moar!
• easier shipped callback activation: whitelist (skippy, profile_tasks)
• many new modules/tasks (iptables, package, solaris_zone, puppet ... 200+)
• more lookups and filters (hashi_vault, credstash,combine)
• new plugin class tests: jinja2 tests, making map/select filters more powerful
• winrm improvements
• docker connection plugin
• vault improvements: stdin/stdout, multiple files, …
• inventory scripts: now installed with system packages, new, improved, etc
• lots more, read CHANGELOG and porting guides
• Can autodocument classes http://docs.ansible.com/ansible/playbooks_directives.html
Next: The road to 2.1
• Back to frequent releases (3-4 months)
• Roadmaps
• Windows out of beta
• Increased Networking support
• Improving community process: proposals
• Bug fixes … always more bug fixes …
• There is more … but I’m out of time … any questions?
________________________
/ Proposals and Roadmaps 
 are in the repo /
------------------------

(__)
(/)
/-------/
/ | 666 ||
* ||----||
~~ ~~

More Related Content

What's hot

Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Alex S
 
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and TricksAnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricksjimi-c
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartHenry Stamerjohann
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansibleGeorge Shuklin
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationKumar Y
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slidesAaron Carey
 
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017Jumping Bean
 
DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)Soshi Nemoto
 
Ansible 101, Gennadiy Mykhailiuta
Ansible 101, Gennadiy MykhailiutaAnsible 101, Gennadiy Mykhailiuta
Ansible 101, Gennadiy MykhailiutaTetiana Saputo
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopLorin Hochstein
 
Ansible : what's ansible & use case by REX
Ansible :  what's ansible & use case by REXAnsible :  what's ansible & use case by REX
Ansible : what's ansible & use case by REXSaewoong Lee
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Soshi Nemoto
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteBram Vogelaar
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmusBram Vogelaar
 
How we use and deploy Varnish at Opera
How we use and deploy Varnish at OperaHow we use and deploy Varnish at Opera
How we use and deploy Varnish at OperaCosimo Streppone
 
DevOps(2) : Vagrant - (MOSG)
DevOps(2) : Vagrant  -  (MOSG)DevOps(2) : Vagrant  -  (MOSG)
DevOps(2) : Vagrant - (MOSG)Soshi Nemoto
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStackBram Vogelaar
 

What's hot (20)

Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and TricksAnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / Quickstart
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
Configuration Management in Ansible
Configuration Management in Ansible Configuration Management in Ansible
Configuration Management in Ansible
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slides
 
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
 
DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)
 
Ansible 101, Gennadiy Mykhailiuta
Ansible 101, Gennadiy MykhailiutaAnsible 101, Gennadiy Mykhailiuta
Ansible 101, Gennadiy Mykhailiuta
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Ansible : what's ansible & use case by REX
Ansible :  what's ansible & use case by REXAnsible :  what's ansible & use case by REX
Ansible : what's ansible & use case by REX
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suite
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
 
DevOps with Fabric
DevOps with FabricDevOps with Fabric
DevOps with Fabric
 
How we use and deploy Varnish at Opera
How we use and deploy Varnish at OperaHow we use and deploy Varnish at Opera
How we use and deploy Varnish at Opera
 
DevOps(2) : Vagrant - (MOSG)
DevOps(2) : Vagrant  -  (MOSG)DevOps(2) : Vagrant  -  (MOSG)
DevOps(2) : Vagrant - (MOSG)
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStack
 

Similar to Ansible leveraging 2.0

Ansible with oci
Ansible with ociAnsible with oci
Ansible with ociDonghuKIM2
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!Jeff Geerling
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloudTahsin Hasan
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansibleahamilton55
 
Jenkins Job Builder: our experience
Jenkins Job Builder: our experienceJenkins Job Builder: our experience
Jenkins Job Builder: our experienceTimofey Turenko
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of AnsibleDevOps Ltd.
 
Ansible Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides InfinityPP
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
Ansible inside
Ansible insideAnsible inside
Ansible insideIdeato
 
Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Jude A. Goonawardena
 
Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부Hyun-Mook Choi
 
Ansible v2 and Beyond (Ansible Hawai'i Meetup)
Ansible v2 and Beyond (Ansible Hawai'i Meetup)Ansible v2 and Beyond (Ansible Hawai'i Meetup)
Ansible v2 and Beyond (Ansible Hawai'i Meetup)Timothy Appnel
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done rightDan Vaida
 
Ansible for Beginners
Ansible for BeginnersAnsible for Beginners
Ansible for BeginnersArie Bregman
 

Similar to Ansible leveraging 2.0 (20)

Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!
 
playbooks.pptx
playbooks.pptxplaybooks.pptx
playbooks.pptx
 
Ansible 2.0
Ansible 2.0Ansible 2.0
Ansible 2.0
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
 
Jenkins Job Builder: our experience
Jenkins Job Builder: our experienceJenkins Job Builder: our experience
Jenkins Job Builder: our experience
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of Ansible
 
Ansible Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Ansible inside
Ansible insideAnsible inside
Ansible inside
 
Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)
 
Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부
 
Ansible v2 and Beyond (Ansible Hawai'i Meetup)
Ansible v2 and Beyond (Ansible Hawai'i Meetup)Ansible v2 and Beyond (Ansible Hawai'i Meetup)
Ansible v2 and Beyond (Ansible Hawai'i Meetup)
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
 
Ansible modules 101
Ansible modules 101Ansible modules 101
Ansible modules 101
 
Hadoop on aws amazon
Hadoop on aws amazonHadoop on aws amazon
Hadoop on aws amazon
 
Hadoop on aws amazon
Hadoop on aws amazonHadoop on aws amazon
Hadoop on aws amazon
 
Ansible for Beginners
Ansible for BeginnersAnsible for Beginners
Ansible for Beginners
 
Unit Testing Lots of Perl
Unit Testing Lots of PerlUnit Testing Lots of Perl
Unit Testing Lots of Perl
 

Recently uploaded

Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 

Recently uploaded (20)

Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 

Ansible leveraging 2.0

  • 2. Interesting stuff in 2.0 • Revamped core, makes many fixes and new features possible • More information and better error handling (consequence of core revamp) • Improved inheritance model • Strategies • Blocks • Dynamic includes • meta: refresh_inventory • delegate_facts • Plugins … sooo many plugins …. _______________________________________________ / http://docs.ansible.com/ansible/porting_guide_2.0.html or read CHANGELOG for more details / ----------------------------------------------- ^__^ (oo)_______ (__) )/ ||----w | || ||
  • 3. More information #> ansible-playbook -vv play.yml Using /etc/ansible/ansible.cfg as config file PLAYBOOK: play.yml ************************************************************* 1 plays in play.yml TASK [wait_for] **************************************************************** task path: /home/bcoca/work/testing/play.yml:5 ok: [localhost] => (item=1) => {"changed": false, "elapsed": 1, "failed": false, "failed_when_result": false, "item": 1, "path": null, "port": null, "search_regex": null, "state": "started"} failed: [localhost] => (item=2) => {"changed": false, "elapsed": 2, "failed": true, "failed_when_result": true, "item": 2, "path": null, "port": null, "search_regex": null, "state": "started"} skipping: [localhost] => (item=3) => {"changed": false, "item": 3, "skip_reason": "Conditional check failed", "skipped": true} NO MORE HOSTS LEFT ************************************************************* PLAY RECAP ********************************************************************* localhost : ok=0 changed=0 unreachable=0 failed=1
  • 4. - command: /do/some/stuff when: a == b when: c == d PREVIOUSLY: a == b is ignored only c == d is considered NO ERRORS OR WARNINGS Better error handling NOW: ERROR! Syntax Error while loading YAML. The error appears to have been in '/home/bcoca/work/test/play.yml': line 6, column 6, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: - command: do some stuff when: a == b ^ here
  • 5. Better error handling - command: /do/stuff wen: a == b PREVIOUSLY: a == b is ignored command is always executed NO ERRORS OR WARNINGS NOW: ERROR! Syntax Error while loading YAML. The error appears to have been in '/home/bcoca/work/test/play.yml': line 6, column 6, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: - command: do some stuff wen: a == b ^ here
  • 6. Better error handling - hosts: servers tasks: command: /do/stuff PREVIOUSLY: command is ignored NO ERRORS OR WARNINGS NOW: ERROR! Syntax Error while loading YAML. The error appears to have been in '/home/bcoca/testing/ansible/play.yml': line 3, column 6, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: command: /do/stuff ^ here
  • 7. No Inheritance - hosts: appservers vars: stuff: “todays_info_{{lookup(‘pipe’, ‘date +%s’)}}” become: yes tasks: - get_url: url= www.example.com/{{stuff}}.rpm dest=/temp/ ignore_errors: True become: no - yum: package=/temp/{{stuff}}.rpm state=present ignore_errors: True become: no - service: name=stuff_service state=restarted ignore_errors: True become: no
  • 8. Inheritance - hosts: appservers ignore_errors: True become: yes vars: stuff: “todays_info_{{lookup(‘pipe’, ‘date +%s’)}}” tasks: - get_url: url= www.example.com/{{stuff}}.rpm dest=/temp/ become: no - rpm: package=/temp/{{stuff}}.rpm state=present become: no - service: name=stuff_service state=restarted become: no
  • 9. Blocks: inheritance - block: - get_url: uri=http://example/{{stuff}}.rpm dest=/temp/ - yum: package=/temp/{{stuff}}.rpm state=present - service: name=stuff_service state=restarted ignore_errors: True vars: stuff: “todays_info_{{lookup(‘pipe’, ‘date +%s’)}}” remote_user: brad become: No
  • 10. Strategy: linear (as usual) 10 servers 5 forks: - task 1: 5 first servers - task 1: 5 next servers - task 2: 5 first servers - task 2: 5 next servers - task 3: 5 first servers - task 3: 5 next servers _________________________________ / Each batch ends as fast as the slowest server in the group. / --------------------------------- __ UooU.'@@@@@@`. __/(@@@@@@@@@@) (@@@@@@@@) `YY~~~~YY' || ||
  • 11. Strategy: linear (serial 5) 10 servers 5 serial 5 forks: _____________________________ / Each batch is now per play, instead of per task. / ----------------------------- oO)-. .-(Oo /__ _ /_ __ ( | ()~() | )/ / __| | (-___-) | /|__/ ' '--' ==`-'== '--' ' - task 1: 5 first servers - task 2: 5 first servers - task 3: 5 first servers - task 1: 5 next servers - task 2: 5 next servers - task 3: 5 next servers
  • 12. Stragegy: free 10 servers 5 forks: - task1: server1, server2, server3 - task2: server1, server2 && task1: server4, server5 - task3: server1 && task2: server3 - task2: server4 && task1: server6 - task1: server7 && task2: server5, server2 && task3: server3 - task2: server6, server7 && task3: server4, server5 && task1: server8 - task3: server6, server7, server2 && task1: server9, server10 ... _____________________________________ / Each server finishes play as | fast as it can, when it is done | /_)o< a new server can start. / | ------------------------------------- | O . O| _____/
  • 13. Strategy: free - name: Heartbleed update hosts: all strategy: free tasks: - apt: name=openssh state=latest update_cache=yes _________________________________________ / Now you update hosts as fast as they can, no need to wait for a ‘slow host’. / ----------------------------------------- / ( ) .( o ).
  • 14. Blocks: Error handling (Before) - command: /do/stuff register: myvar ignore_errors: True - command: /do/more/stuff register: myvar2 ignore_errors: True … - command: /recover when: myvar|failed or myvar2|failed or ... ____________________________________ / each command must ignore errors | and register a variable, then use | complex conditionals to capture / ------------------------------------ ___ {~._.~} ( Y ) ()~*~() (_)-(_)
  • 15. Blocks: Error handling (After) - block - command: /do/stuff - command: /do/more/stuff … rescue: - command: /recover ___________________________________ < Now it is clear, simple and clean > ----------------------------------- ___-------___ _-~~ ~~-_ _-~ /~-_ /^__/^ /~ / /| O|| O| / _______________/ | |___||__| / / | / / | (_______) /______/ _________ | / / / ^ / / || ______________/ _-_ //__// ||------_-~~-_ ------------- --/~ ~ || __/ ~-----||====/~ |==================| |/~~~~~ (_(__/ ./ / _ . (_(___/ _____)_)
  • 16. Dynamic includes: variable dependant (Before) - include: debian.yml when: ansible_os_distribution == ‘Debian’ - include: redhat.yml when: ansible_os_distribution == ‘RedHat’ - include: alpine.yml when: ansible_os_distribution == ‘Alpine’ - include: freebsd.yml when: ansible_os_distribution == ‘FreeBSD’ - include: default.yml when: ansible_os_distribution not in [‘Debian’,‘Redhat’, … ]
  • 17. Dynamic Includes: variable dependant (After) - include: “{{item}}” with_first_found: - “{{ansible_os_distribution|lower}}.yml” - default.yml __________________________ < now rent out empty space > -------------------------- ^__^ (oo)_______ (__) )/ ||----w | || ||
  • 18. Dynamic includes: loop (Before) - include: test.yml vars: stuff: [1,2,3] test.yml: --- - command: /do/stuff -o {{item}} with_items: “{{stuff}}” - command: /do/more/stuff -o {{item}} with_items: “{{stuff}}” - command: /do/even/more/stuff -o {{item}} with_items: “{{stuff}}” - command: /do/nested/stuff -o {{item[0]}} -p {{item[1]}} with_nested: - “{{stuff}}” - [a,b,c] _______________________________________ / each task loops over all items before the next / --------------------------------------- / ___ / // / / (( O O )) / // / | | / | | | | | | | | | o | | | | | |m| |m|
  • 19. Dynamic Includes: loop (After) - include: test.yml with_items: “{{stuff}}” vars: stuff: [1,2,3] test.yml: --- - command: /do/stuff -o {{item}} - command: /do/more/stuff -o {{item}} - command: /do/even/more/stuff -o {{item}} - name: handle nested loops set_fact: outer_item={{item}} - command: /do/nested/stuff -o {{outer_item}} -p {{item}} with_items: [a,b,c] ___________________ / all tasks run per item iteration / ------------------- .--. |o_o | |:_/ | // (| | ) /'_ _/` ___)=(___/
  • 20. cloud inventory (before) - digital_ocean: command: droplet name: app_{{item.name}} state: present with_items: “{{new_host_data}}” register: new_hosts - add_hosts: host: “{{item.droplet.name}}” ansible_ssh_host: “{{item.droplet.ip_address}}” groups: “{{‘,’|join([item.droplet.image_id, item.droplet....])}}” do_id: “{{item.droplet.id}}” .... with_items: “{{new_hosts.results}}” - hosts: appservers ...
  • 21. cloud inventory (After) - digital_ocean: command: droplet name: app_{{item.name}} state: present with_items: “{{new_host_data}}” - meta: refresh_inventory - hosts: appservers ... ____________________________ < less add_host and group_by > ---------------------------- (__) /oo| (_"_)*+++++++++* //I#I I[I|I|||||I I ` I`I'///'' I I I I I I ~ ~ ~ ~
  • 22. other facts (Before) - hosts: webservers gather_facts: True - hosts: dbhosts tasks: - itpables: allow: “{{hostvars[item][‘ansible_default_ipv4’][‘address’]}}” - with_items: “{{groups[‘webservers’]}}”
  • 23. other facts (After) - hosts: dbhosts tasks: - setup: delegate_to: “{{item}}” delegate_facts: True with_items: “”{groups[‘webservers’]}}” run_once: True - itpables: allow: “{{hostvars[item][‘ansible_default_ipv4’][‘address’]}}” with_items: “{{groups[‘webservers’]}}”
  • 24. Moar! • easier shipped callback activation: whitelist (skippy, profile_tasks) • many new modules/tasks (iptables, package, solaris_zone, puppet ... 200+) • more lookups and filters (hashi_vault, credstash,combine) • new plugin class tests: jinja2 tests, making map/select filters more powerful • winrm improvements • docker connection plugin • vault improvements: stdin/stdout, multiple files, … • inventory scripts: now installed with system packages, new, improved, etc • lots more, read CHANGELOG and porting guides • Can autodocument classes http://docs.ansible.com/ansible/playbooks_directives.html
  • 25. Next: The road to 2.1 • Back to frequent releases (3-4 months) • Roadmaps • Windows out of beta • Increased Networking support • Improving community process: proposals • Bug fixes … always more bug fixes … • There is more … but I’m out of time … any questions? ________________________ / Proposals and Roadmaps are in the repo / ------------------------ (__) (/) /-------/ / | 666 || * ||----|| ~~ ~~