Ansible 2.2 "The Battle of Evermore"
Scott van Kalken
svk@redhat.com
November 2016
2
What's New?
Ansible 2.2 is a big update to previous versions.
Focus on networking, performance and modules.
The usual bug fixes and security updates.
3
What's New - Summary
Listen feature for modules
Performance improvements
Binary modules
Serial batches as a list
New priv escalation ksu
Windows async
Windows environment
end_play to skip to end of play
include_role – roles as tasks
4
Performance
1.9(ish) performance is back!
Blistering performance
5
What's New?
Serial batches as a list – serial: [1, 5, 10]
Meta tasks can now use conditionals
New meta task end_play (added in 2.2) causes the play to end without
failing the host.
Meta tasks are cool – use them!
6
What's New?
Windows:
● several facts were modified or renamed for consistency with their Unix
counterparts, and many new facts were added. If your playbooks rely on any of the
following keys, please ensure they are using the correct key names and/or values:
● ansible_date_time.date (changed to use yyyy-mm-dd format instead of default
system-locale format)
● ansible_date_time.iso8601 (changed to UTC instead of local time)
● ansible_distribution (now uses OS caption string, e.g.: "Microsoft Windows Server
2012 R2 Standard", version is still available on ansible_distribution_version)
● ansible_totalmem (renamed to ansible_memtotal_mb, units changed to MB instead
of bytes)
● async: support for long-running or background tasks.
● environment: support for setting module environment vars in play/task.
7
New Modules
apache2_mod_proxy
asa (cisco firewall)
atomic
aws (lots of new modules here)
cloudstack
dellos6, dellos9, dellos10
digital_ocaen_block_storage
docker_network
eos
exoscale
f5 (lots of new modules here)
github
google
honeybadger_deployment
Illumos
Ios
iosxr
include_role
jenkins
kibana_plugin
letsencrypt
logicmonitor
logicmonitor_facts
lxd
netapp
netconf_config
netvisor
nxos
mssql_db
ovh_ip_loadbalancing
opendj_backend
openstack
ovirt
rhevm
rocketchat
setcontext
sensu_subscription
smartos
sros
statusio_maintenance
systemd
telegram
univention
vmware
vyos
wakeonlan
Windows
ipmi
8
New Modules
apache2_mod_proxy
asa (cisco firewall)
atomic
aws (lots of new modules here)
cloudstack
dellos6, dellos9, dellos10
digital_ocaen_block_storage
docker_network
eos
exoscale
f5 (lots of new modules here)
github
google
honeybadger_deployment
Illumos
ios
iosxr
include_role
jenkins
kibana_plugin
letsencrypt
logicmonitor
logicmonitor_facts
lxd
netapp
netconf_config
netvisor
nxos
mssql_db
ovh_ip_loadbalancing
opendj_backend
openstack
ovirt
rhevm
rocketchat
setcontext
sensu_subscription
smartos
sros
statusio_maintenance
systemd
telegram
univention
vmware
vyos
wakeonlan
Windows
ipmi
9
include_role
Ability to include a role in a task!!!!!
- hosts: "{{ target_hosts | default('null-hosts') }}"
tasks:
- name: Turn off firewalld
systemd:
name: firewalld
state: stopped
- name: include role for cash
include_role:
name: zcash
The role import can be loopable or conditional.
Role is treated just
like another task.
10
rocketchat
- name: Send notification message via Rocket Chat all options
local_action:
module: rocketchat
domain: chat.example.com
token: thetoken/generatedby/rocketchat
msg: "{{ inventory_hostname }} completed"
channel: "#ansible"
username: "Ansible on {{ inventory_hostname }}"
icon_url: "http://www.example.com/some-image-file.png"
link_names: 0
Send message to rocketchat
but use ansible variables in
the message
11
Tech preview
Ansible and python3.
● Not complete yet.
● Enough to get started with.
● Should be able to run
● python3 /usr/bin/ansible
● python3 /usr/bin/ansible-playbook
● Both commands should work for core features.
● A few essential modules have been audited and are known to work.
● Unit and integration testing being used to port code.
Help by contributing to the tests!
12
What's Deprecated in 2.2?
; as a separator
with_ bare variable handling. Now loops must always be templated {{ }} or
they become plain strings.
Skipping tasks on 'missing attributes' in loop variable. Now an undefined
loop attribute returns and error.
Skipping on undefined variables in a loop. Loops will have to define a
variable or use |default to avoid errors.
13
What's Flagged as Deprecated in Future?
Modules:
● eos_template
● ios_template
● iosxr_template
● junos_template
● nxos_template
● ops_template
Flagged to be deprecated in Ansible 2.4
Use *_config instead.
You will find a new “src” parameter in each of the _config modules.
*_command modules no longer allow configuration mode statements.
14
Ansible-container?
Ansible container is a separate but related project.
Allows you to manage your containers and container lifecycle using ansible (we can
cover in depth next time).
It's still separate to ansible core today.
THANK YOU
plus.google.com/+RedHat
youtube.com/user/RedHatVideos
facebook.com/redhatinc
twitter.com/RedHatNewslinkedin.com/company/red-hat

Ansible 2.2

  • 1.
    Ansible 2.2 "TheBattle of Evermore" Scott van Kalken svk@redhat.com November 2016
  • 2.
    2 What's New? Ansible 2.2is a big update to previous versions. Focus on networking, performance and modules. The usual bug fixes and security updates.
  • 3.
    3 What's New -Summary Listen feature for modules Performance improvements Binary modules Serial batches as a list New priv escalation ksu Windows async Windows environment end_play to skip to end of play include_role – roles as tasks
  • 4.
    4 Performance 1.9(ish) performance isback! Blistering performance
  • 5.
    5 What's New? Serial batchesas a list – serial: [1, 5, 10] Meta tasks can now use conditionals New meta task end_play (added in 2.2) causes the play to end without failing the host. Meta tasks are cool – use them!
  • 6.
    6 What's New? Windows: ● severalfacts were modified or renamed for consistency with their Unix counterparts, and many new facts were added. If your playbooks rely on any of the following keys, please ensure they are using the correct key names and/or values: ● ansible_date_time.date (changed to use yyyy-mm-dd format instead of default system-locale format) ● ansible_date_time.iso8601 (changed to UTC instead of local time) ● ansible_distribution (now uses OS caption string, e.g.: "Microsoft Windows Server 2012 R2 Standard", version is still available on ansible_distribution_version) ● ansible_totalmem (renamed to ansible_memtotal_mb, units changed to MB instead of bytes) ● async: support for long-running or background tasks. ● environment: support for setting module environment vars in play/task.
  • 7.
    7 New Modules apache2_mod_proxy asa (ciscofirewall) atomic aws (lots of new modules here) cloudstack dellos6, dellos9, dellos10 digital_ocaen_block_storage docker_network eos exoscale f5 (lots of new modules here) github google honeybadger_deployment Illumos Ios iosxr include_role jenkins kibana_plugin letsencrypt logicmonitor logicmonitor_facts lxd netapp netconf_config netvisor nxos mssql_db ovh_ip_loadbalancing opendj_backend openstack ovirt rhevm rocketchat setcontext sensu_subscription smartos sros statusio_maintenance systemd telegram univention vmware vyos wakeonlan Windows ipmi
  • 8.
    8 New Modules apache2_mod_proxy asa (ciscofirewall) atomic aws (lots of new modules here) cloudstack dellos6, dellos9, dellos10 digital_ocaen_block_storage docker_network eos exoscale f5 (lots of new modules here) github google honeybadger_deployment Illumos ios iosxr include_role jenkins kibana_plugin letsencrypt logicmonitor logicmonitor_facts lxd netapp netconf_config netvisor nxos mssql_db ovh_ip_loadbalancing opendj_backend openstack ovirt rhevm rocketchat setcontext sensu_subscription smartos sros statusio_maintenance systemd telegram univention vmware vyos wakeonlan Windows ipmi
  • 9.
    9 include_role Ability to includea role in a task!!!!! - hosts: "{{ target_hosts | default('null-hosts') }}" tasks: - name: Turn off firewalld systemd: name: firewalld state: stopped - name: include role for cash include_role: name: zcash The role import can be loopable or conditional. Role is treated just like another task.
  • 10.
    10 rocketchat - name: Sendnotification message via Rocket Chat all options local_action: module: rocketchat domain: chat.example.com token: thetoken/generatedby/rocketchat msg: "{{ inventory_hostname }} completed" channel: "#ansible" username: "Ansible on {{ inventory_hostname }}" icon_url: "http://www.example.com/some-image-file.png" link_names: 0 Send message to rocketchat but use ansible variables in the message
  • 11.
    11 Tech preview Ansible andpython3. ● Not complete yet. ● Enough to get started with. ● Should be able to run ● python3 /usr/bin/ansible ● python3 /usr/bin/ansible-playbook ● Both commands should work for core features. ● A few essential modules have been audited and are known to work. ● Unit and integration testing being used to port code. Help by contributing to the tests!
  • 12.
    12 What's Deprecated in2.2? ; as a separator with_ bare variable handling. Now loops must always be templated {{ }} or they become plain strings. Skipping tasks on 'missing attributes' in loop variable. Now an undefined loop attribute returns and error. Skipping on undefined variables in a loop. Loops will have to define a variable or use |default to avoid errors.
  • 13.
    13 What's Flagged asDeprecated in Future? Modules: ● eos_template ● ios_template ● iosxr_template ● junos_template ● nxos_template ● ops_template Flagged to be deprecated in Ansible 2.4 Use *_config instead. You will find a new “src” parameter in each of the _config modules. *_command modules no longer allow configuration mode statements.
  • 14.
    14 Ansible-container? Ansible container isa separate but related project. Allows you to manage your containers and container lifecycle using ansible (we can cover in depth next time). It's still separate to ansible core today.
  • 15.