From: David Galloway Date: Fri, 16 Nov 2018 20:48:25 +0000 (-0500) Subject: common: Support RHEL8 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0032fc03938e8add5e4005bbc4de960e9268ae15;p=ceph-cm-ansible.git common: Support RHEL8 Signed-off-by: David Galloway --- diff --git a/roles/common/tasks/kerberos.yml b/roles/common/tasks/kerberos.yml index 86b1195..6f1c04c 100644 --- a/roles/common/tasks/kerberos.yml +++ b/roles/common/tasks/kerberos.yml @@ -2,7 +2,7 @@ # Install and Configure a Kerberos client - name: Install Kerberos Packages (RedHat) - yum: + package: name: krb5-workstation state: present when: ansible_os_family == 'RedHat' diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 0425daf..494bedf 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -16,7 +16,7 @@ # configure things specific to yum systems - import_tasks: yum_systems.yml - when: ansible_pkg_mgr == "yum" + when: ansible_os_family == "RedHat" # configure things specific to apt systems - import_tasks: apt_systems.yml @@ -41,9 +41,11 @@ - monitoring-scripts - nagios -# configure nagios +# configure nagios (Except OpenSUSE and RHEL8) - import_tasks: nagios.yml - when: ansible_pkg_mgr != "zypper" + when: + - ansible_pkg_mgr != "zypper" + - not (ansible_distribution == "RedHat" and ansible_distribution_major_version == "8") tags: - nagios @@ -57,6 +59,7 @@ # configure selinux for nagios - import_tasks: nrpe-selinux.yml when: ansible_os_family == "RedHat" and + ansible_distribution_major_version != "8" and (selinux_status is defined and selinux_status.stdout != "Disabled") tags: - nagios diff --git a/roles/common/tasks/nagios.yml b/roles/common/tasks/nagios.yml index 6564c22..24f8e41 100644 --- a/roles/common/tasks/nagios.yml +++ b/roles/common/tasks/nagios.yml @@ -5,7 +5,7 @@ - name: Include yum_systems vars include_vars: yum_systems.yml - when: ansible_pkg_mgr == "yum" + when: ansible_os_family == "RedHat" # Returns 0 if found and 1 if not found # Task fails if not found. Hence ignore_errors: true @@ -14,11 +14,11 @@ register: have_epel no_log: true ignore_errors: true - when: ansible_pkg_mgr == "yum" + when: ansible_os_family == "RedHat" # This task is only run when epel isn't present - name: Install nrpe without epel - yum: + package: name: "{{ item }}" state: present with_items: @@ -26,20 +26,24 @@ - http://{{ mirror_host }}/lab-extras/rhel7/x86_64/nrpe-2.15-7.el7.x86_64.rpm - http://{{ mirror_host }}/lab-extras/rhel7/x86_64/nagios-plugins-2.0.3-3.el7.x86_64.rpm - http://{{ mirror_host }}/lab-extras/rhel7/x86_64/nagios-plugins-load-2.0.3-3.el7.x86_64.rpm - when: ansible_pkg_mgr == "yum" and - have_epel.rc == 1 + when: + - ansible_os_family == "RedHat" + - ansible_distribution_major_version <= 7 + - have_epel.rc == 1 - name: Install nrpe package and dependencies (RHEL/CentOS) - yum: + package: name: "{{ item }}" state: latest enablerepo: epel with_items: "{{ nrpe_packages }}" - when: ansible_pkg_mgr == "yum" and - have_epel.rc == 0 + when: + - ansible_os_family == "RedHat" + - ansible_distribution_major_version <= 7 + - have_epel.rc == 0 - name: Install nrpe package and dependencies (Ubuntu) - apt: + package: name: "{{ item }}" state: latest with_items: "{{ nrpe_packages }}" @@ -74,14 +78,14 @@ dest: /etc/sysconfig/{{ nrpe_service_name }} regexp: "^NRPE_SSL_OPT" line: "NRPE_SSL_OPT=\"-n\"" - when: ansible_pkg_mgr == "yum" + when: ansible_os_family == "RedHat" - name: Check firewalld status command: systemctl status firewalld register: firewalld ignore_errors: true no_log: true - when: ansible_pkg_mgr == "yum" + when: ansible_os_family == "RedHat" - name: Open nrpe port if firewalld enabled firewalld: @@ -89,7 +93,7 @@ state: enabled permanent: yes immediate: yes - when: ansible_pkg_mgr == "yum" and (firewalld is defined and firewalld.stdout.find('running') != -1) + when: ansible_os_family == "RedHat" and (firewalld is defined and firewalld.stdout.find('running') != -1) - name: Upload nagios nrpe config. template: diff --git a/roles/common/tasks/rhel-entitlements.yml b/roles/common/tasks/rhel-entitlements.yml index 2434688..6a4033b 100644 --- a/roles/common/tasks/rhel-entitlements.yml +++ b/roles/common/tasks/rhel-entitlements.yml @@ -47,6 +47,9 @@ until: entitled|success retries: 5 delay: 10 + failed_when: + - entitled.rc != 0 + - '"Beta" not in ansible_lsb.description' - name: Set rhsm_registered if we just registered set_fact: @@ -61,7 +64,10 @@ shell: "subscription-manager release --list | grep -E '[0-9]'" register: rhsm_release_list changed_when: false - failed_when: rhsm_release_list.rc != 0 and "Beta" not in ansible_lsb.description + failed_when: + - rhsm_release_list.rc != 0 + - ansible_lsb.description is defined + - '"Beta" not in ansible_lsb.description' # We don't need to be registered to CDN since there's no packages available # for this Beta/Alpha/RC installation diff --git a/roles/common/tasks/yum_systems.yml b/roles/common/tasks/yum_systems.yml index 64056b3..7128d79 100644 --- a/roles/common/tasks/yum_systems.yml +++ b/roles/common/tasks/yum_systems.yml @@ -9,7 +9,7 @@ - name: Get the current timezone (RHEL/CentOS 7) shell: 'timedatectl | grep -E "Time ?zone" | sed -e "s/.*: \(.*\) (.*/\1/"' - when: ansible_distribution_major_version == "7" + when: ansible_distribution_major_version >= "7" register: current_tz changed_when: false tags: @@ -26,10 +26,10 @@ tags: - timezone -- name: Set the timezone (RHEL/CentOS 7) +- name: Set the timezone (RHEL/CentOS >= 7) command: timedatectl set-timezone {{ timezone }} # Default is used below to avoid breaking check mode - when: ansible_distribution_major_version == "7" and current_tz.stdout|default("") != timezone + when: ansible_distribution_major_version >= "7" and current_tz.stdout|default("") != timezone tags: - timezone diff --git a/roles/common/vars/redhat_8.yml b/roles/common/vars/redhat_8.yml new file mode 100644 index 0000000..69989f8 --- /dev/null +++ b/roles/common/vars/redhat_8.yml @@ -0,0 +1,19 @@ +--- +# RHEL8 repos are not yet available via RHSM +rhsm_repos: [] + +# Don't use satellite until RHEL8 is GAed +use_satellite: false + +# These are temporary until RHEL8 is GAed +beta_repos: + rhel-beta-baseos: + name: "RHEL {{ ansible_distribution_version }} BaseOS (RPMs)" + baseurl: "https://downloads.redhat.com/redhat/rhel/rhel-8-beta/baseos/x86_64/" + enabled: 1 + gpgcheck: 0 + rhel-beta-appstream: + name: "RHEL {{ ansible_distribution_version }} AppStream (RPMs)" + baseurl: "https://downloads.redhat.com/redhat/rhel/rhel-8-beta/appstream/x86_64/" + enabled: 1 + gpgcheck: 0