Incompatable with Ansible 2.9+
tst-nstires opened this issue · 7 comments
The filter 'version_compare' has been deprecated for some time. I see a ticket was opened on this, but the issue was closed without being addressed.
Error message:
TASK [mindpointgroup.stig_rhel6 : Check OS version and family] *****************
task path: /home/nick/.ansible/roles/mindpointgroup.stig_rhel6/tasks/main.yml:1
fatal: [ec1-1-1-1.compute-1.amazonaws.com]: FAILED! => {
"msg": "The conditional check 'ansible_os_family == 'RedHat' and ansible_distribution_major_version | version_compare('6', '==')' failed. The error was: template error while templating string: no filter named 'version_compare'. String: {% if ansible_os_family == 'RedHat' and ansible_distribution_major_version | version_compare('6', '==') %} True {% else %} False {% endif %}"
}
That playbook has two tasks in main that call that filter:
- name: Check OS version and family
assert:
that: ansible_os_family == 'RedHat' and ansible_distribution_major_version | version_compare('6', '==')
msg: "This role can only be run against RHEL/CENTOS 6. {{ ansible_distribution }} {{ ansible_distribution_major_version }} is not supported."
tags:
- always
- name: Check ansible version
assert:
that: ansible_version.full | version_compare(rhel6stig_min_ansible_version, '>=')
msg: You must use Ansible {{ rhel6stig_min_ansible_version }} or greater
tags:
- always
This is fixed. You seem to have an old checkout.
It's still in the latest release? I just manually downloaded it.
tasks/main.yml
Lines 3 and 10
The failure you are seeing is the "tests as filters" deprecation from ansible-2.5. The version_compare test is still good and has not been deprecated.
Your error has:
that: ansible_os_family == 'RedHat' and ansible_distribution_major_version | version_compare('6', '==')
versus what's in the repo:
that: ansible_os_family == 'RedHat' and ansible_distribution_major_version is version_compare('6', '==')
It's possible that a release to ansible galaxy has not been done in some time, but I'm not involved with that process.
It's also in the primary branch of this repo, so not sure where I'm missing a fix for it.
Was fixed here: https://github.com/MindPointGroup/RHEL6-STIG/pull/155 so it's not in the latest release. I'll push to get an updated release cut.
I will get another release to galaxy soon. Sorry about that @tst-nstires