artefactual-labs / ansible-archivematica-src

An ansible role for deploying Archivematica from from its source code repositories
GNU Affero General Public License v3.0
5 stars 21 forks source link

Problem: am-configure fails with ansible 2.9 on python3 #287

Closed mamedin closed 3 years ago

mamedin commented 4 years ago

Error message:

TASK [artefactual.archivematica-qa-src : Set gpg binary name (Bionic)] *********
fatal: [am111rpm]: FAILED! => {"msg": "The conditional check 'ansible_distribution_version | version_compare('18.04', '>=')' failed. The error was: template error while templating string: no filter named 'version_compare'. String: {% if ansible_distribution_version | version_compare('18.04', '>=') %} True {% else %} False {% endif %}\n\nThe error appears to be in '/tmp/awx_300_i5v09ddq/requirements_roles/artefactual.archivematica-qa-src/tasks/configure-gpg.yml': line 18, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: \"Set gpg binary name (Bionic)\"\n      ^ here\n"}

The version_compare filter is obsolete, it must be replaced by version filter.

amayita commented 4 years ago

Theres another error that is fixed by installing jmespath pip install jmespath I'm using ansible 2.8 and python 2.7.7:

ansible 2.8.0
  config file = /home/arodrigo/artefactual/deployment-qa-servers/envs/qa-1.11/ansible.cfg
  configured module search path = [u'/home/arodrigo/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/arodrigo/artefactual/myansible-2.8/local/lib/python2.7/site-packages/ansible
  executable location = /home/arodrigo/artefactual/myansible-2.8/bin/ansible
  python version = 2.7.17 (default, Jan 19 2020, 19:54:54) [GCC 9.2.1 20200110]

Please add jmespath to requirements.yml

amayita commented 4 years ago

Your error is fixed by editing https://github.com/artefactual-labs/ansible-archivematica-src/blob/stable/1.11.x/tasks/configure-gpg.yml#L21 and changing line 21 to

- when: "ansible_distribution_version | version_compare('18.04', '>=')"
+ when: "ansible_distribution_version is version('18.04', '>=')"