[infra] Ansible versions in Zuul
James E. Blair
corvus at inaugust.com
Wed Mar 20 16:32:17 UTC 2019
Hi,
Yesterday we upgraded Zuul to a version that supports multiple Ansible
versions. Previously, Zuul ran jobs under Ansible 2.5. That version
will reach end of support in a few weeks, so the upgrade was necessary
and timely.
Zuul now supports selecting which version of Ansible (2.5, 2.6, 2.7) is
used on a per-job basis. The default is the latest release of Ansible,
currently 2.7, which means that when we made the upgrade, all jobs in
the system immediately began running under 2.7.
For most jobs, this has not caused any problems, and therefore, we will
maintain the system default at 2.7.
We have seen some errors, which generally fall into two categories:
1) Ansible syntax changes. Ansible 2.7 is more strict about invalid
syntax than 2.5. If you encounter such an error, it may be easiest and
best to simply update the roles or playbooks for the new syntax. If
that is not practical, you can temporarily configure the job to run
under an older version of Ansible by setting the "ansible-version" job
attribute[1].
2) Ansible module library incompatibility. Ansible modules run on the
remote host they are targeting. Therefore if, for example, a job uses
the "os_image" module to manipulate an OpenStack image store in a task
that appears in a play which targets the "controller" node, then the
os_image module will run in a Python interpreter on the "controller"
node and it will import openstacksdk. Some jobs may implicitly rely on
the fact that devstack installs openstacksdk in the global Python
environment on the remote node in order for this to work. However,
newer versions of Ansible require newer versions of openstacksdk than
are specified by devstack on stable branches. This is a more
complicated situation than that above.
In this case, it may be simplest to set the job to use the newest
working Ansible (whether that is 2.5 or 2.6) to resolve the immediate
conflict. If the stable branch at issue will end support before the
required version of Ansible, then you can stop there. However, if it
must continue to work beyond then, it may be necessary to alter the job
to avoid the use of the Ansible OpenStack modules and instead execute
openstackclient commands using the shell or command modules.
If you do specify an older version of Ansible for a job, be aware that once
that version is no longer supported by Ansible, it will be removed from Zuul
and the job will then need to be updated.
If you have any further questions or see any other problems, please feel
free to chat with us in #openstack-infra.
-Jim
[1] https://zuul-ci.org/docs/zuul/user/config.html#attr-job.ansible-version
More information about the openstack-discuss
mailing list