Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Fix versionlock centos 8 #797

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

brad-x
Copy link

@brad-x brad-x commented May 21, 2021

This resolves a corner case where a RHEL/CentOS 8 system does not have the yum compatibility package installed - everywhere else, the role is using the yum ansible module which detects and uses dnf in recent ansible versions, so the only concern is when:

  • System is RHEL/CentOS 8
  • System does not have yum installed and only dnf is available to the shell module
  • Role variable es_version_lock is set to true, invoking the elasticsearch-RedHat-version-lock.yml playbook.

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

1 similar comment
@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@cla-checker-service
Copy link

cla-checker-service bot commented May 21, 2021

❌ Author of the following commits did not sign a Contributor Agreement:
fc8831a, 60eb4cc, , , , , , ,

Please, read and sign the above mentioned agreement if you want to contribute to this project

@brad-x
Copy link
Author

brad-x commented May 26, 2021

I see "CLA Expected - Waiting for status to be reported" - unsure if any further action is needed on my end after signing the CLA - please let me know if this is the case

@@ -2,13 +2,13 @@
- name: RedHat - install yum-version-lock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yum-version-lock should also be replaced here with {{ versionlock_plugin_package }}.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, fixed

@@ -2,13 +2,13 @@
- name: RedHat - install yum-version-lock
become: yes
yum:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this then better be package to be more generic?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also sensible

vars/RedHat.yml Outdated
@@ -2,3 +2,5 @@
java: "{{ es_java | default('java-1.8.0-openjdk.x86_64') }}"
default_file: "/etc/sysconfig/elasticsearch"
es_home: "/usr/share/elasticsearch"
package_manager: "{% if ansible_os_family == 'RedHat' and ansible_distribution_major_version >= '8' %}dnf{% else %}yum{% endif %}"
Copy link
Contributor

@darxriggs darxriggs Oct 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use ansible_distribution_major_version | int >= 8 or ansible_distribution_version is version('8', '>=') because for higher version numbers this comparison is not returning the expected result, e.g. '10' >= '8' evaluates to false.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

vars/RedHat.yml Outdated
@@ -2,3 +2,5 @@
java: "{{ es_java | default('java-1.8.0-openjdk.x86_64') }}"
default_file: "/etc/sysconfig/elasticsearch"
es_home: "/usr/share/elasticsearch"
package_manager: "{% if ansible_os_family == 'RedHat' and ansible_distribution_major_version >= '8' %}dnf{% else %}yum{% endif %}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ansible_os_family should not be required here because this file is only included in tasks/main.yml using ansible_os_family to derive the filename.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I primarily didn't want to diverge too far from existing statements in e.g. Debian.yml which has the same unnecessary check. But I'll remove it here as it's been discussed (I'm leaving it in Debian.yml for now though as I haven't tested there)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I've just removed all that and gone with ansible_facts.pkg_mgr to simplify things.

@darxriggs
Copy link
Contributor

Note: I am not a maintainer.

@botelastic
Copy link

botelastic bot commented Jan 11, 2022

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
To track this PR (even if closed), please open a corresponding issue if one does not already exist.

@darxriggs
Copy link
Contributor

Please keep it open.

@botelastic botelastic bot removed the triage/stale label Jan 11, 2022
@brad-x
Copy link
Author

brad-x commented Jan 25, 2022

Also I def signd the contributor agreement, about 3 times. Not sure why it thinks I haven't - possible issue with the commit workflow?

@botelastic
Copy link

botelastic bot commented Jun 24, 2022

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
To track this PR (even if closed), please open a corresponding issue if one does not already exist.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants