diff --git a/tasks/install_for_redhat.yml b/tasks/install_for_redhat.yml index 2183512..8925e8d 100644 --- a/tasks/install_for_redhat.yml +++ b/tasks/install_for_redhat.yml @@ -44,14 +44,23 @@ changed_when: false when: is_getenforce_exist.rc == 0 +- name: set pythonlibs | CentOS 7 different name + set_fact: + pythonlibs: [ 'libsemanage-python', 'libselinux-python' ] + when: ansible_distribution_major_version < "8" + +- name: set pythonlibs | CentOS 8 different name + set_fact: + pythonlibs: [ 'python3-libsemanage', 'python3-libselinux' ] + when: ansible_distribution_major_version >= "8" + - name: Redhat installation | ensure dependencies are installed package: name: "{{ item }}" state: present when: is_getenforce_exist.rc == 0 and sestatus is defined and "Enabled" in sestatus.stdout with_items: - - libsemanage-python - - libselinux-python + - "{{ pythonlibs }}" tags: - rundeck - install diff --git a/tests/default_test.yml b/tests/default_test.yml index c7b171e..88e7d8d 100644 --- a/tests/default_test.yml +++ b/tests/default_test.yml @@ -7,6 +7,16 @@ raw: 'apt-get update && apt-get --no-install-recommends -yq install python python-apt' when: ansible_os_family == "Ubuntu" or ansible_os_family == "Debian" +- name: set libsemanage | CentOS 7 different name + set_fact: + libsemanage: 'libsemanage-python' + when: ansible_distribution_major_version < "8" + +- name: set libsemanage | CentOS 8 different name + set_fact: + libsemanage: 'python3-libsemanage' + when: ansible_distribution_major_version >= "8" + - name: test default values deployment hosts: rundeck-servers become: true @@ -33,7 +43,7 @@ state: present when: ansible_os_family == 'RedHat' with_items: - - libselinux-python + - "{{ libsemanage }}" roles: # checked out roles rather than installed via ansible galaxy. - ansible-java-role