]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
common: Support RHEL8
authorDavid Galloway <dgallowa@redhat.com>
Fri, 16 Nov 2018 20:48:25 +0000 (15:48 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Tue, 20 Nov 2018 16:11:06 +0000 (11:11 -0500)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/common/tasks/kerberos.yml
roles/common/tasks/main.yml
roles/common/tasks/nagios.yml
roles/common/tasks/rhel-entitlements.yml
roles/common/tasks/yum_systems.yml
roles/common/vars/redhat_8.yml [new file with mode: 0644]

index 86b1195566833d6a32ae9765d423f0e76cc90326..6f1c04ca344e3fa0e18818854aeabb566ec12071 100644 (file)
@@ -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'
index 0425daf2865e930a525057a960de35ea91396453..494bedf82cd492c560b8d66edcaf2c41f0009a28 100644 (file)
@@ -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
     - 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
index 6564c225a2db0fd14a18adcf95befa2ea92f7cbb..24f8e415cc2e572e5dbbeb3b23bb2c285461633d 100644 (file)
@@ -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
   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:
     - 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 }}"
     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:
index 243468841b9315dcb9663045f53d9f0974c50014..6a4033bd09e7ae6f5236ba45a5d7a575d719252d 100644 (file)
@@ -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:
   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
index 64056b3dc64538b85c624740fcd5a16ff213b46b..7128d79113257ecef584faa8bfae356c2d8605ec 100644 (file)
@@ -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:
   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 (file)
index 0000000..69989f8
--- /dev/null
@@ -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