Graylog2 / graylog-ansible-role

Ansible role which installs and configures Graylog
Apache License 2.0
212 stars 127 forks source link

Issue "Detect if es_version is before X-Pack was open and included" #152

Closed emmc15 closed 4 years ago

emmc15 commented 4 years ago

Hi,

ansible-playbook version==2.9.4

Fairly new to Ansible and ElasticSearch

Was trying to get Graylog to work (https://github.com/Graylog2/graylog-ansible-role)

However when running initially I had the following error

{"msg": "The conditional check 'es_version | version_compare('6.3.0', '<')' failed. The error was: template error while templating string: no filter named 'version_compare'. String: {% if es_version | version_compare('6.3.0', '<') %} True {% else %} False {% endif %}\n\nThe error appears to be in '/home/ecarey/workspace/ANS/src/roles/elastic.elasticsearch/tasks/compatibility-variables.yml': line 21, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Detect if es_version is before X-Pack was open and included\n  ^ here\n"}

This seemed to be related to the change over to Ansible from 2.5 as I saw this (https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html

I have resolved the issue by changing the following line in tasks > compatibility-variables.yml > line 23/24

when: "es_version | version_compare('6.3.0', '<')"

to

  when: "es_version is version('6.3.0', '<')"

Posting here to see if anyone else has had a similar issue.

Apologies if this is the wrong place or incorrect format regards to posting the issue.

Posting here in hoping it helps resolves someone elses issue

malcyon commented 4 years ago

I think that is fixed in v3.1.0. It just isn't tagged in Ansible Galaxy. Try specifying it in a requirements.yml like this:

- src: https://github.com/Graylog2/graylog-ansible-role.git
  version: 3.1.0
  name: graylog-ansible-role
malcyon commented 4 years ago

Actually, I think the file you're talking about is part of the Elasticsearch role.

https://github.com/elastic/ansible-elasticsearch

emmc15 commented 4 years ago

@juju2112 Apologies! you are correct, seems to pulling from there

Thank you for looking into so quickly though!