elastic / ansible-elasticsearch

Ansible playbook for Elasticsearch
Other
1.58k stars 854 forks source link

es_version_lock not idempotent #746

Closed fourstepper closed 3 years ago

fourstepper commented 3 years ago

Elasticsearch version 7.10.0

Role version: (If using master please specify github sha) latest

JVM version (java -version): /

OS version (uname -a if on a Unix-like system): CentOS 8

Description of the problem including expected versus actual behaviour:

Version lock on RedHat-like systems is not idempotent.

https://github.com/elastic/ansible-elasticsearch/blob/master/tasks/elasticsearch-RedHat-version-lock.yml

The check for the version lock is in this format: yum versionlock list | grep -c {{es_package_name}}-{{es_version}}

Translated to the elasticsearch version above, that would be the equivalent of yum versionlock list | grep -c elasticsearch-7.10.0 which returns: 0

The version lock actually looks like this:

yum versionlock list
elasticsearch-0:7.10.0-1.*

Playbook: Vars used are: es_version_lock: true es_version: 7.10.0

Provide logs from Ansible: The results don't change with each run - lock elasticsearch version stays changed

TASK [elastic.elasticsearch : RedHat - install yum-version-lock] ***********************************************************************************************
task path: /home/user/workspace/company/ansible/play-nextcloud/roles/elastic.elasticsearch/tasks/elasticsearch-RedHat-version-lock.yml:2
ok: [example.com] => {"changed": false, "msg": "Nothing to do", "rc": 0, "results": []}

TASK [elastic.elasticsearch : RedHat - check if requested elasticsearch version lock exists] *******************************************************************
task path: /home/user/workspace/company/ansible/play-nextcloud/roles/elastic.elasticsearch/tasks/elasticsearch-RedHat-version-lock.yml:9
ok: [example.com] => {"changed": false, "cmd": "yum versionlock list | grep -c elasticsearch-7.10.0", "delta": "0:00:00.970168", "end": "2020-11-23 09:40:53.673986", "failed_when_result": false, "msg": "non-zero return code", "rc": 1, "start": "2020-11-23 09:40:52.703818", "stderr": "", "stderr_lines": [], "stdout": "0", "stdout_lines": ["0"]}

TASK [elastic.elasticsearch : RedHat - lock elasticsearch version] *********************************************************************************************
task path: /home/user/workspace/company/ansible/play-nextcloud/roles/elastic.elasticsearch/tasks/elasticsearch-RedHat-version-lock.yml:19
changed: [example.com] => {"changed": true, "cmd": "yum versionlock delete 0:elasticsearch* ; yum versionlock add elasticsearch-7.10.0", "delta": "0:00:02.155190", "end": "2020-11-23 09:40:56.285352", "rc": 0, "start": "2020-11-23 09:40:54.130162", "stderr": "", "stderr_lines": [], "stdout": "Last metadata expiration check: 0:00:04 ago on Mon 23 Nov 2020 09:40:50 AM CET.\nDeleting versionlock for: elasticsearch-0:7.10.0-1.*\nLast metadata expiration check: 0:00:05 ago on Mon 23 Nov 2020 09:40:50 AM CET.\nAdding versionlock on: elasticsearch-0:7.10.0-1.*", "stdout_lines": ["Last metadata expiration check: 0:00:04 ago on Mon 23 Nov 2020 09:40:50 AM CET.", "Deleting versionlock for: elasticsearch-0:7.10.0-1.*", "Last metadata expiration check: 0:00:05 ago on Mon 23 Nov 2020 09:40:50 AM CET.", "Adding versionlock on: elasticsearch-0:7.10.0-1.*"]}

TASK [elastic.elasticsearch : RedHat - check if any elasticsearch version lock exists] *************************************************************************
task path: /home/user/workspace/company/ansible/play-nextcloud/roles/elastic.elasticsearch/tasks/elasticsearch-RedHat-version-lock.yml:29
ok: [example.com] => {"changed": false, "cmd": "yum versionlock list | grep -c elasticsearch", "delta": "0:00:00.998779", "end": "2020-11-23 09:40:57.751186", "failed_when_result": false, "rc": 0, "start": "2020-11-23 09:40:56.752407", "stderr": "", "stderr_lines": [], "stdout": "1", "stdout_lines": ["1"]}

TASK [elastic.elasticsearch : RedHat - unlock elasticsearch version] *******************************************************************************************
task path: /home/user/workspace/company/ansible/play-nextcloud/roles/elastic.elasticsearch/tasks/elasticsearch-RedHat-version-lock.yml:39
skipping: [example.com] => {"changed": false, "skip_reason": "Conditional result was False"}
jmlrt commented 3 years ago

Hi @fourstepper, Thanks for opening this issue. Unfortunately we currently don't have time to investigate every tickets so please be patient.

fourstepper commented 3 years ago

Hi @jmlrt, no worries - I might look into this myself, should not be too hard to fix.

Best!