From: David Galloway Date: Tue, 4 Dec 2018 17:56:29 +0000 (-0500) Subject: Fix distro version comparison conditionals X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F427%2Fhead;p=ceph-cm-ansible.git Fix distro version comparison conditionals Signed-off-by: David Galloway --- diff --git a/roles/common/tasks/nagios.yml b/roles/common/tasks/nagios.yml index 24f8e415..e7a13e71 100644 --- a/roles/common/tasks/nagios.yml +++ b/roles/common/tasks/nagios.yml @@ -28,7 +28,7 @@ - http://{{ mirror_host }}/lab-extras/rhel7/x86_64/nagios-plugins-load-2.0.3-3.el7.x86_64.rpm when: - ansible_os_family == "RedHat" - - ansible_distribution_major_version <= 7 + - ansible_distribution_major_version|int <= 7 - have_epel.rc == 1 - name: Install nrpe package and dependencies (RHEL/CentOS) @@ -39,7 +39,7 @@ with_items: "{{ nrpe_packages }}" when: - ansible_os_family == "RedHat" - - ansible_distribution_major_version <= 7 + - ansible_distribution_major_version|int <= 7 - have_epel.rc == 0 - name: Install nrpe package and dependencies (Ubuntu) diff --git a/roles/common/tasks/yum_systems.yml b/roles/common/tasks/yum_systems.yml index 7128d791..521998ca 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|int >= 7 register: current_tz changed_when: false tags: @@ -29,7 +29,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|int >= 7 and current_tz.stdout|default("") != timezone tags: - timezone diff --git a/roles/testnode/tasks/yum/packages.yml b/roles/testnode/tasks/yum/packages.yml index 8b8eb934..c9136f38 100644 --- a/roles/testnode/tasks/yum/packages.yml +++ b/roles/testnode/tasks/yum/packages.yml @@ -6,7 +6,7 @@ state: present when: - ansible_os_family == "RedHat" - - ansible_distribution_major_version <= 7 + - ansible_distribution_major_version|int <= 7 - name: Removing saved yum transactions command: yum-complete-transaction --cleanup-only @@ -14,7 +14,7 @@ changed_when: "'Cleaning up' in transaction_cleanup.stdout" when: - ansible_os_family == "RedHat" - - ansible_distribution_major_version <= 7 + - ansible_distribution_major_version|int <= 7 - name: Check if ceph-debuginfo is installed command: rpm -q ceph-debuginfo diff --git a/tools/prep-fog-capture.yml b/tools/prep-fog-capture.yml index 8e63dfad..e381dd0c 100644 --- a/tools/prep-fog-capture.yml +++ b/tools/prep-fog-capture.yml @@ -94,11 +94,11 @@ - set_fact: ntp_service: ntpd - when: ansible_os_family == "RedHat" and ansible_distribution_major_version <= 7 + when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int <= 7 - set_fact: ntp_service: chronyd - when: (ansible_os_family == "RedHat" and ansible_distribution_major_version >= 8) or + when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 8) or ansible_os_family == "Suse" - name: "Stop {{ ntp_service }} service"