Top Banner
WHAT'S NEW IN V2 JAMES CAMMARATA (GITHUB: JIMI-C)
27

What's New in v2 - AnsibleFest London 2015

Jul 14, 2015

Download

Technology

jimi-c
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: What's New in v2 - AnsibleFest London 2015

WHAT'S NEW IN V2JAMES CAMMARATA

(GITHUB: JIMI-C)

Page 2: What's New in v2 - AnsibleFest London 2015

ABOUT MEDirector of Ansible Core Engineering

Started contributing to Cobbler in September of 2008, and tookover the project leadership in 2010

Joined Ansible in July, 2013

Page 3: What's New in v2 - AnsibleFest London 2015

WHAT IS V2?

Page 4: What's New in v2 - AnsibleFest London 2015

An effort to refactor portions of Ansible's core executor engine.

Page 5: What's New in v2 - AnsibleFest London 2015

WHY V2?

Page 6: What's New in v2 - AnsibleFest London 2015

TECHNICAL DEBTAnsible has grown organically at a very rapid rate for 3 years.Some early design descisions have had additional featuresbolted on without concern for the overall system architecture.It was getting to the point where it was difficult to fix bugsand/or add new features without things breaking inunexpected ways.Difficulty of testing, especially in terms of python unit tests, didnot help.

Page 7: What's New in v2 - AnsibleFest London 2015

NEW FEATURES IN V2:

Page 8: What's New in v2 - AnsibleFest London 2015

IMPROVED ERROR MESSAGESPlaybook errors not related to syntax will (in most cases) stillshow the file along with the line and column where the error

occurred.

Page 9: What's New in v2 - AnsibleFest London 2015

IMPROVED ERROR EXAMPLE:ERROR! no action detected in task

The error appears to have been in '/path/to/bad/playbook/site.yml':line 4, column 16, but may be elsewhere in the file depending on theexact syntax problem.

The offending line appears to be:

tasks: - bad_module: ̂ here

Page 10: What's New in v2 - AnsibleFest London 2015

BLOCKSProvides a method for catching errors during task execution,as well as an option to always execute some set of tasksregardless of whether an exception occurred or not.Currently uses syntax similar to Ruby (begin/rescue/always)but will probably be changed to be more Pythonic(try/except/finally).

Page 11: What's New in v2 - AnsibleFest London 2015

BLOCK EXAMPLE:tasks: - block: - command: /bin/false - debug: msg="you shouldn't see me" rescue: - debug: msg="this is the rescue" - command: /bin/false - debug: msg="you shouldn't see this either" always: - debug: msg="this is the always block, it will always be seen" when: foo != "some value" tags: - foo - bar

Page 12: What's New in v2 - AnsibleFest London 2015

EXECUTION STRATEGY PLUGINSAllows changes in the way tasks are executed:

linear - traditional Ansible, which waits for all hosts tocomplete a task before continuingfree - allows each host to process tasks as fast as possible,without waiting for other hostsAnd anything else people can conceive - just write a new pluginfor it!

Page 13: What's New in v2 - AnsibleFest London 2015

STRATEGY EXAMPLE:- hosts: all gather_facts: false strategy: free vars: ... vars_files: ... tasks: ...

Page 14: What's New in v2 - AnsibleFest London 2015

EXECUTION-TIME EVALUATION OF INCLUDETASKS

Should allow the return use of include + with* actions.

Page 15: What's New in v2 - AnsibleFest London 2015

INCLUDE + WITH EXAMPLE:- hosts: all gather_facts: false tasks: - include: foo.yml some_var={{item}} with_items: - a - b - c

Page 16: What's New in v2 - AnsibleFest London 2015

IMPROVED VARIABLE MANAGEMENTA new class (VariableManager) controls the order and source of

variables to avoid flattening things too early.

Playbook objects now use a `post_validate` method, whichtemplates all fields in one shot, as opposed to the piece-meal way

we currently template field values.

Page 17: What's New in v2 - AnsibleFest London 2015

BETTER USE OF OOPMore classes, with an emphasis on each class doing one thing

only.

More use of inheritance, especially in the plugin systems.

Well defined interactions between classes.

End-goal is better ability to write unit tests.

Page 18: What's New in v2 - AnsibleFest London 2015

WHAT WILL BREAK?

Page 19: What's New in v2 - AnsibleFest London 2015

PLAYBOOKSNothing. We are aiming for 100% backwards-compatibility.

Page 20: What's New in v2 - AnsibleFest London 2015

INTERNAL APISPlugin APIs are changing. Connection, action, and some others

will be different.

We plan on writing a transition guide for authors of plugins, tomake it easier to move them to be compatible with V2.

Page 21: What's New in v2 - AnsibleFest London 2015

WHEN WILL IT BEREADY?

Page 22: What's New in v2 - AnsibleFest London 2015

V2 CAN BE TESTED TODAY!$ git clone https://github.com/ansible/ansible.git$ cd ansible$ . v2/hacking/env-setup

profit!

Page 23: What's New in v2 - AnsibleFest London 2015

We are targeting March 2015 for the switchover on the develbranch.

Ansible 1.9 will be released before the switchover, and will be thelast major release using the 'v1' code.

The original code will still be available in the source tree, with itsown `hacking` script available should people wish to continue

using it from checkout.

Page 24: What's New in v2 - AnsibleFest London 2015

SPEAKING OF 1.9...

Page 25: What's New in v2 - AnsibleFest London 2015

As noted above, we are aiming for a release in early-mid March.

This release will primarily be about bug fixes and new modules inthe "extras" repo, but will also introduce support forPowerBroker authentication in addition to su/sudo..

This version will also introduce the use of official releasecandidates for testing.

Page 26: What's New in v2 - AnsibleFest London 2015

QUESTIONS?

Page 27: What's New in v2 - AnsibleFest London 2015

THANKS!