I've got some tasks I use to make sure we're on the correct RPM version.
Each inventory governs an environment with a common site.yml playbook.
(ansible 1.9.x, centos 6.x)
$environment/group_vars/all holds vars like
thingy_rpm: thingy-1.2.3.500
and the play has tasks like
- name: ensure we are on {{ thingy_rpm }}
yum: name={{ thingy_rpm }} state=present
notify: bounce thingy
This works fine when I'm on a version earlier than 1.2.3.500, but if I need
to roll back an RPM and try setting
thingy_rpm: thingy-1.2.2.500
nothing happens.
Am I holding this thing the right way round? Or are the versions in a yum
task a minimum?
The current module docs for yum state this for the name parameter …
| Package name, or package specifier with version, like name-1.0
. When using state=latest, this can be ‘*’ which means run: yum -y update. You can also pass a url or a local path to a rpm file (using state=present). To operate on several packages this can accept a comma separated list of packages or (as of 2.0) a list of packages.
|
Try using the latest version of ansible and see if that resolves the issue. If this is a “downgrade” operation rather than a fresh install, there are open bugs+PRs for that.
https://github.com/ansible/ansible-modules-core/issues/1419
https://github.com/ansible/ansible-modules-core/pull/2744
Ah thanks - I was using ansible1.9 from an EPEL6 mirror that might not be up to date;
looks like 1.9.2 or better should sort this out.