SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
Ansible v2.0 and Beyond
Timothy Appnel
tima@ansible.com
Ansible Hawai’i Meetup
January 14, 2016
Technical Debt
Rapid organic growth for 3+ years
Bolted on features
Increasingly difficult to fix bugs
Increasingly difficult to add new features
Difficult to unit test
2
Why v2?
New Features in v2
3
Blocks
Grouping of related tasks
Attributes like become, when, tags and others can be set on a
block and are then inherited by all the contained tasks
Provides a method for catching and handling errors during task
execution such as roll backs
4
New Features in v2
5
New Features in v2: Grouping Related Tasks with Blocks
- block:
- name: install Apache (Red Hat)
yum:
name: httpd
state: present
- name: create sites directories
file:
path: "{{ item }}"
state: directory
with_items: apache_dirs
- name: copy httpd.conf
template:
src: httpd.conf.j2
dest: "{{ apache_config }}"
notify: restart apache
when: ansible_os_family == "RedHat"
tags: package
6
New Features in v2: Blocks Can Be Nested
- block:
- block:
- name: install (Debian)
apt:
name: apache2
state: present
update_cache: yes
cache_valid_time: 3600
when: ansible_os_family == "Debian"
- block:
- name: install (Red Hat)
yum:
name: httpd
state: present
when: ansible_os_family == "RedHat"
tags: package
7
New Features in v2: Blocks Variable Scope
- hosts: localhost
vars:
example1: lelo
tasks:
- block:
- debug: var=example1
- debug: var=example2
vars:
example2: lola
- debug: var=example2
PLAY ***********************************
TASK [debug] ***************************
ok: [localhost] => {
"example1": "lelo"
}
TASK [debug] ***************************
ok: [localhost] => {
"example2": "lola"
}
TASK [debug] ***************************
ok: [localhost] => {
"example2": "VARIABLE IS NOT
DEFINED!"
}
8
New Features in v2: Error Handling with Blocks
---
- hosts: web
tasks:
- block:
- debug: msg="Hello World"
- command: /bin/false
rescue:
- debug: msg="I caught an error"
- command: /bin/false
when: ansible_os_family == "Debian"
- debug: msg="I handled an error"
always:
- debug: msg="This always executes"
Improved Error Messages
Playbook errors not related to syntax will show the file along with
the line and column where the error occurred.
9
New Features in v2
10
New Features in v2: Improved Error Messages
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/path/to/test.yml': line 6, column 15, but may be
elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- debug:
msg: {{ ansible_default_ipv4.address }}
^ here
We could be wrong, but this one looks like it might be an issue with missing quotes.
Always quote template expression brackets when they start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
Execution Strategy Plugins
Allows changes in the way tasks are executed in a play
Shipping Plugins:
• linear - traditional Ansible. Wait for all hosts to complete a
task before continuing
• free - allows each host to process tasks as fast a possible
without waiting for other hosts
What execution strategy will you conceive? Contribute a plugin.
11
New Features in v2
12
New Features in v2: Execution Strategy Example
---
- hosts: web
strategy: free
tasks:
- debug:
msg: "{{ inventory_hostname }} is starting."
- name: "Sleep?"
command: sleep 10
when: ansible_os_family == "Debian"
- debug:
msg: "{{ inventory_hostname }} is complete."
Execution-Time Evaluation of Includes
Previously task include statements were pre-processed and
evaluated before any tasks execution begun
Loops, facts and variables set during execution time could not be
used with includes -- now they can
13
New Features in v2
14
New Features in v2: Include with Loops
# This would fail before v2
- include: users.yml
vars:
user: “{{ item }}”
with_items:
- fred
- timmy
- alice
15
New Features in v2: Include with Facts
# Before v2
- include: RedHat.yml
when: ansible_os_family == "RedHat"
- include: Debian.yml
when: ansible_os_family == "Debian"
# With v2
- include: "{{ ansible_os_family }}".yml
Improved Variable Management
Centralized processing and management of all variables from all
sources
Predictable order and avoids premature flattening of data
structures
One shot variable resolution, instead of piecemeal as before.
16
New Features in v2
Variable Precedence v1.*
1. extra vars
2. vars, vars_files, etc. aka “everything else in a playbook”
3. inventory vars — host_vars then group_vars
4. facts
5. role defaults
17
New Features in v2: Improved Variable Management
Variable Precedence v2.0
1. extra vars
2. task vars (only for the task)
3. block vars (only for tasks in
block)
4. role and include vars
5. play vars_files
6. play vars_prompt
7. play vars
8. set_facts
18
New Features in v2: Improved Variable Management
9. registered vars
10. host facts
11. playbook host_vars
12. playbook group_vars
13. inventory host_vars
14. inventory group_vars
15. inventory vars
16. role defaults
Modules and Plugins
Over 200 new modules and countless improvements existing
ones -- EC2, VMWare, OpenStack and Windows (still beta)
amongst many others
Dozens of new inventory scripts, callbacks, lookups and other
plugins
See the CHANGELOG for a complete list
19
New Features in v2
Better Use of Object Oriented Principles
More classes doing one thing
More use of inheritance and base classes especially in the plugin
systems
Well defined interactions between classes
Improved ability to perform unit testing
20
New Features in v2
Small Noteworthy Others
Added meta: refresh_inventory to force re-reading the inventory
in a play. This re-executes inventory scripts, but does not force
them to ignore any cache they might use.
New delegate_facts directive, a boolean that allows you to apply
facts to the delegated host (true/yes) instead of the
inventory_hostname (no/false) which is the default and
previous behaviour.
21
New Features in v2
What Will Break in v2?
22Confidential
23
Playbooks, Roles & Modules
Intended to be 100% backwards compatible for playbooks and
modules -- achieved about 98.5%
Supporting prior unpredictable variable precedence
Support of ugly idiomatic task declarations that deserves to break
like...
include: stuff.yml var1=thisworks tags=notwork_use_task_level_directive
What Will Break in v2?
24
Playbooks, Roles & Modules
Empty variables and variables set to null in YAML will no longer be
converted to empty strings
Template code now retains types for bools and numbers instead
of turning them into strings. Quote the value and it will get
passed around as a string if you need the old behaviour.
Minor change in YAML trailing line handling
What Will Break in v2?
Internal APIs
Callback, connection, cache and lookup plugin APIs have changed
and might require modification to existing plugins
Integrating directly with Ansible's API (not plugins) will encounter
breaking changes
Callbacks need to be white-listed in ansible.cfg -- being in the
callback plugins path is not enough as in previous versions
25
What Will Break in v2?
v2.1 & Beyond
26Confidential
Highlights
Continued Windows infrastructure improvements
Network automation support
Continued module expansion and enhancements such as Azure and Docker
Core modules repo merged back into the main repo
Extra modules to become a separate package to install
27
Anible v2.1 & Beyond
Questions?
28
29
Thanks
ansible.com/get-started

Mais conteúdo relacionado

Mais procurados

Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and AnsibleLocal Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and AnsibleJeff Geerling
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Richard Donkin
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationSuresh Kumar
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabricandymccurdy
 
Mitchell Hashimoto, HashiCorp
Mitchell Hashimoto, HashiCorpMitchell Hashimoto, HashiCorp
Mitchell Hashimoto, HashiCorpOntico
 
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsChasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsTomas Doran
 
Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Jeff Geerling
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using dockerLarry Cai
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerGeorge Miranda
 
Ansible + WordPress
Ansible + WordPressAnsible + WordPress
Ansible + WordPressAlan Lok
 
Tips for a Faster Website
Tips for a Faster WebsiteTips for a Faster Website
Tips for a Faster WebsiteRayed Alrashed
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for DummiesŁukasz Proszek
 
Rackspace Hack Night - Vagrant & Packer
Rackspace Hack Night - Vagrant & PackerRackspace Hack Night - Vagrant & Packer
Rackspace Hack Night - Vagrant & PackerMarc Cluet
 
Distributed automation sel_conf_2015
Distributed automation sel_conf_2015Distributed automation sel_conf_2015
Distributed automation sel_conf_2015aragavan
 

Mais procurados (20)

Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and AnsibleLocal Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
Mitchell Hashimoto, HashiCorp
Mitchell Hashimoto, HashiCorpMitchell Hashimoto, HashiCorp
Mitchell Hashimoto, HashiCorp
 
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsChasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
 
Ansible
AnsibleAnsible
Ansible
 
Ansible - A 'crowd' introduction
Ansible - A 'crowd' introductionAnsible - A 'crowd' introduction
Ansible - A 'crowd' introduction
 
Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
 
Ansible and AWS
Ansible and AWSAnsible and AWS
Ansible and AWS
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and Packer
 
Ansible + WordPress
Ansible + WordPressAnsible + WordPress
Ansible + WordPress
 
Network automation (NetDevOps) with Ansible
Network automation (NetDevOps) with AnsibleNetwork automation (NetDevOps) with Ansible
Network automation (NetDevOps) with Ansible
 
Tips for a Faster Website
Tips for a Faster WebsiteTips for a Faster Website
Tips for a Faster Website
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Ansible Case Studies
Ansible Case StudiesAnsible Case Studies
Ansible Case Studies
 
Rackspace Hack Night - Vagrant & Packer
Rackspace Hack Night - Vagrant & PackerRackspace Hack Night - Vagrant & Packer
Rackspace Hack Night - Vagrant & Packer
 
Distributed automation sel_conf_2015
Distributed automation sel_conf_2015Distributed automation sel_conf_2015
Distributed automation sel_conf_2015
 
Apache Cassandra and Go
Apache Cassandra and GoApache Cassandra and Go
Apache Cassandra and Go
 

Destaque

Ansible role reuse - promising but hard
Ansible role reuse - promising but hardAnsible role reuse - promising but hard
Ansible role reuse - promising but hardMartin Maisey
 
Ansible Best Practices - July 30
Ansible Best Practices - July 30Ansible Best Practices - July 30
Ansible Best Practices - July 30tylerturk
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationJohn Lynch
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practicesBas Meijer
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction Robert Reiz
 

Destaque (6)

Ansible role reuse - promising but hard
Ansible role reuse - promising but hardAnsible role reuse - promising but hard
Ansible role reuse - promising but hard
 
Ansible Best Practices - July 30
Ansible Best Practices - July 30Ansible Best Practices - July 30
Ansible Best Practices - July 30
 
Introducing Ansible
Introducing AnsibleIntroducing Ansible
Introducing Ansible
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 

Semelhante a Ansible v2 and Beyond (Ansible Hawai'i Meetup)

V2 and beyond
V2 and beyondV2 and beyond
V2 and beyondjimi-c
 
Managing big test environment and running tests with Jenkins, Jenkins Job bui...
Managing big test environment and running tests with Jenkins, Jenkins Job bui...Managing big test environment and running tests with Jenkins, Jenkins Job bui...
Managing big test environment and running tests with Jenkins, Jenkins Job bui...Timofey Turenko
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0bcoca
 
Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9David Calavera
 
Overhauling a database engine in 2 months
Overhauling a database engine in 2 monthsOverhauling a database engine in 2 months
Overhauling a database engine in 2 monthsMax Neunhöffer
 
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?Srijan Technologies
 
Ansible Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides InfinityPP
 
Strategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringStrategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringAlessandro Franceschi
 
Jenkins Job Builder: our experience
Jenkins Job Builder: our experienceJenkins Job Builder: our experience
Jenkins Job Builder: our experienceTimofey Turenko
 
KubeCon 2017: Kubernetes from Dev to Prod
KubeCon 2017: Kubernetes from Dev to ProdKubeCon 2017: Kubernetes from Dev to Prod
KubeCon 2017: Kubernetes from Dev to ProdSubhas Dandapani
 
DevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureDevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureAntons Kranga
 
A Dictionary Of Vb .Net
A Dictionary Of Vb .NetA Dictionary Of Vb .Net
A Dictionary Of Vb .NetLiquidHub
 
Islands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksIslands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksLindsay Holmwood
 
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and TricksAnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricksjimi-c
 
Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7Phase2
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonMyNOG
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done rightDan Vaida
 

Semelhante a Ansible v2 and Beyond (Ansible Hawai'i Meetup) (20)

Ansible 2.2
Ansible 2.2Ansible 2.2
Ansible 2.2
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
 
playbooks.pptx
playbooks.pptxplaybooks.pptx
playbooks.pptx
 
Managing big test environment and running tests with Jenkins, Jenkins Job bui...
Managing big test environment and running tests with Jenkins, Jenkins Job bui...Managing big test environment and running tests with Jenkins, Jenkins Job bui...
Managing big test environment and running tests with Jenkins, Jenkins Job bui...
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0
 
Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9
 
Readme
ReadmeReadme
Readme
 
Overhauling a database engine in 2 months
Overhauling a database engine in 2 monthsOverhauling a database engine in 2 months
Overhauling a database engine in 2 months
 
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
 
Ansible Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides
 
Strategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringStrategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoring
 
Jenkins Job Builder: our experience
Jenkins Job Builder: our experienceJenkins Job Builder: our experience
Jenkins Job Builder: our experience
 
KubeCon 2017: Kubernetes from Dev to Prod
KubeCon 2017: Kubernetes from Dev to ProdKubeCon 2017: Kubernetes from Dev to Prod
KubeCon 2017: Kubernetes from Dev to Prod
 
DevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureDevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven Infrastructure
 
A Dictionary Of Vb .Net
A Dictionary Of Vb .NetA Dictionary Of Vb .Net
A Dictionary Of Vb .Net
 
Islands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksIslands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof Networks
 
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and TricksAnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
 
Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent Boon
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
 

Último

Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 

Último (20)

Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 

Ansible v2 and Beyond (Ansible Hawai'i Meetup)

  • 1. Ansible v2.0 and Beyond Timothy Appnel tima@ansible.com Ansible Hawai’i Meetup January 14, 2016
  • 2. Technical Debt Rapid organic growth for 3+ years Bolted on features Increasingly difficult to fix bugs Increasingly difficult to add new features Difficult to unit test 2 Why v2?
  • 4. Blocks Grouping of related tasks Attributes like become, when, tags and others can be set on a block and are then inherited by all the contained tasks Provides a method for catching and handling errors during task execution such as roll backs 4 New Features in v2
  • 5. 5 New Features in v2: Grouping Related Tasks with Blocks - block: - name: install Apache (Red Hat) yum: name: httpd state: present - name: create sites directories file: path: "{{ item }}" state: directory with_items: apache_dirs - name: copy httpd.conf template: src: httpd.conf.j2 dest: "{{ apache_config }}" notify: restart apache when: ansible_os_family == "RedHat" tags: package
  • 6. 6 New Features in v2: Blocks Can Be Nested - block: - block: - name: install (Debian) apt: name: apache2 state: present update_cache: yes cache_valid_time: 3600 when: ansible_os_family == "Debian" - block: - name: install (Red Hat) yum: name: httpd state: present when: ansible_os_family == "RedHat" tags: package
  • 7. 7 New Features in v2: Blocks Variable Scope - hosts: localhost vars: example1: lelo tasks: - block: - debug: var=example1 - debug: var=example2 vars: example2: lola - debug: var=example2 PLAY *********************************** TASK [debug] *************************** ok: [localhost] => { "example1": "lelo" } TASK [debug] *************************** ok: [localhost] => { "example2": "lola" } TASK [debug] *************************** ok: [localhost] => { "example2": "VARIABLE IS NOT DEFINED!" }
  • 8. 8 New Features in v2: Error Handling with Blocks --- - hosts: web tasks: - block: - debug: msg="Hello World" - command: /bin/false rescue: - debug: msg="I caught an error" - command: /bin/false when: ansible_os_family == "Debian" - debug: msg="I handled an error" always: - debug: msg="This always executes"
  • 9. Improved Error Messages Playbook errors not related to syntax will show the file along with the line and column where the error occurred. 9 New Features in v2
  • 10. 10 New Features in v2: Improved Error Messages ERROR! Syntax Error while loading YAML. The error appears to have been in '/path/to/test.yml': line 6, column 15, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: - debug: msg: {{ ansible_default_ipv4.address }} ^ here We could be wrong, but this one looks like it might be an issue with missing quotes. Always quote template expression brackets when they start a value. For instance: with_items: - {{ foo }} Should be written as: with_items: - "{{ foo }}"
  • 11. Execution Strategy Plugins Allows changes in the way tasks are executed in a play Shipping Plugins: • linear - traditional Ansible. Wait for all hosts to complete a task before continuing • free - allows each host to process tasks as fast a possible without waiting for other hosts What execution strategy will you conceive? Contribute a plugin. 11 New Features in v2
  • 12. 12 New Features in v2: Execution Strategy Example --- - hosts: web strategy: free tasks: - debug: msg: "{{ inventory_hostname }} is starting." - name: "Sleep?" command: sleep 10 when: ansible_os_family == "Debian" - debug: msg: "{{ inventory_hostname }} is complete."
  • 13. Execution-Time Evaluation of Includes Previously task include statements were pre-processed and evaluated before any tasks execution begun Loops, facts and variables set during execution time could not be used with includes -- now they can 13 New Features in v2
  • 14. 14 New Features in v2: Include with Loops # This would fail before v2 - include: users.yml vars: user: “{{ item }}” with_items: - fred - timmy - alice
  • 15. 15 New Features in v2: Include with Facts # Before v2 - include: RedHat.yml when: ansible_os_family == "RedHat" - include: Debian.yml when: ansible_os_family == "Debian" # With v2 - include: "{{ ansible_os_family }}".yml
  • 16. Improved Variable Management Centralized processing and management of all variables from all sources Predictable order and avoids premature flattening of data structures One shot variable resolution, instead of piecemeal as before. 16 New Features in v2
  • 17. Variable Precedence v1.* 1. extra vars 2. vars, vars_files, etc. aka “everything else in a playbook” 3. inventory vars — host_vars then group_vars 4. facts 5. role defaults 17 New Features in v2: Improved Variable Management
  • 18. Variable Precedence v2.0 1. extra vars 2. task vars (only for the task) 3. block vars (only for tasks in block) 4. role and include vars 5. play vars_files 6. play vars_prompt 7. play vars 8. set_facts 18 New Features in v2: Improved Variable Management 9. registered vars 10. host facts 11. playbook host_vars 12. playbook group_vars 13. inventory host_vars 14. inventory group_vars 15. inventory vars 16. role defaults
  • 19. Modules and Plugins Over 200 new modules and countless improvements existing ones -- EC2, VMWare, OpenStack and Windows (still beta) amongst many others Dozens of new inventory scripts, callbacks, lookups and other plugins See the CHANGELOG for a complete list 19 New Features in v2
  • 20. Better Use of Object Oriented Principles More classes doing one thing More use of inheritance and base classes especially in the plugin systems Well defined interactions between classes Improved ability to perform unit testing 20 New Features in v2
  • 21. Small Noteworthy Others Added meta: refresh_inventory to force re-reading the inventory in a play. This re-executes inventory scripts, but does not force them to ignore any cache they might use. New delegate_facts directive, a boolean that allows you to apply facts to the delegated host (true/yes) instead of the inventory_hostname (no/false) which is the default and previous behaviour. 21 New Features in v2
  • 22. What Will Break in v2? 22Confidential
  • 23. 23 Playbooks, Roles & Modules Intended to be 100% backwards compatible for playbooks and modules -- achieved about 98.5% Supporting prior unpredictable variable precedence Support of ugly idiomatic task declarations that deserves to break like... include: stuff.yml var1=thisworks tags=notwork_use_task_level_directive What Will Break in v2?
  • 24. 24 Playbooks, Roles & Modules Empty variables and variables set to null in YAML will no longer be converted to empty strings Template code now retains types for bools and numbers instead of turning them into strings. Quote the value and it will get passed around as a string if you need the old behaviour. Minor change in YAML trailing line handling What Will Break in v2?
  • 25. Internal APIs Callback, connection, cache and lookup plugin APIs have changed and might require modification to existing plugins Integrating directly with Ansible's API (not plugins) will encounter breaking changes Callbacks need to be white-listed in ansible.cfg -- being in the callback plugins path is not enough as in previous versions 25 What Will Break in v2?
  • 27. Highlights Continued Windows infrastructure improvements Network automation support Continued module expansion and enhancements such as Azure and Docker Core modules repo merged back into the main repo Extra modules to become a separate package to install 27 Anible v2.1 & Beyond