Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

ERRATA

This document describes known errors in the Ansible for Networking


Engineers webinar.

Should you find additional errors in the materials, please report them to
ip@ipspace.net. Thank you!

CREDITS
The iteritems() and Jinja2 scoping problem were reports by Etienne
Depasquale. Thank you!

FEATURES NOT WORKING IN PYTHON3


The following features mentioned in the course materials no longer work in
Python3:

 Dictionary elements no longer have iteritems() method. Examples using


iteritems() don’t work in Python3. Use items() instead of iteritems();
the items() method works in Python2 and Python3.

In python2 items() returns a copy of the dictionary rendered as a list


of key/value pairs, while iteritems() is an iterator that returns a new
key/value pair every time it’s called. You might notice performance
differences when using huge dictionaries.

Note: the Jinja2 examples in the GitHub repository have been updated to use
items() instead of iteritems().

FEATURES NOT WORKING IN JINJA2 RELEASE 2.9


Jinja2 release 2.9 changed the scoping rules for variables within for loop.
Prior to Jinja2 release 2.9 a variable set within for loop with set statement
retained its value across loop iterations and could thus be used as a counter.

In Jinja2 release 2.9 the value of a variable set within a loop is reinitialized on
every iteration of the loop.

Workarounds:

 Use loop index (loop.index) if you need a sequentially-increasing counter


within a for loop (see B-ACL-seq-loopvar.j2 example in GitHub repository
for more details);

© Copyright ipSpace.net 2015 Page 1

This material is copyrighted and licensed for the sole use by Mikel Maeso (mikel.maeso@gmail.com [85.87.178.33]). More information at http://www.ipSpace.net/Webinars
 Use this technique or a custom Jinja2 filter if you have to preserve more
state across loop iterations.

CHANGES IN NETWORKING MODULES


Starting with Ansible 2.3 a new network_cli connection plugin will replace
the provider parameter used by most networking modules. I’ll publish more
information once the code becomes stable.

© Copyright ipSpace.net 2015 Page 2

This material is copyrighted and licensed for the sole use by Mikel Maeso (mikel.maeso@gmail.com [85.87.178.33]). More information at http://www.ipSpace.net/Webinars

You might also like