]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-validate: start with ansible version test
authorDimitri Savineau <dsavinea@redhat.com>
Fri, 6 Dec 2019 21:11:51 +0000 (16:11 -0500)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 9 Dec 2019 08:35:03 +0000 (09:35 +0100)
It doesn't make sense to start validating configuration if the ansible
version isn't the good one.
This commit moves the check_system task as the first task in the
ceph-validate role.
The ansible version test tasks are moved at the top of this file.
Also moving the iscsi kernel tests from check_system to check_iscsi
file.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
roles/ceph-validate/tasks/check_iscsi.yml
roles/ceph-validate/tasks/check_system.yml
roles/ceph-validate/tasks/main.yml

index 0f7ff890bd0dbbb5fe40e213327ae43f72399b8d..0b06afe430271e73575dcae3763f385c15ec5a70 100644 (file)
     - item.status == "present"
     - item.chap
     - " '' in client_connections | selectattr('status', 'match', 'present') | map(attribute='chap') | list"
+
+- name: check if iscsi gateways is target on supported distros and versions
+  block:
+    - name: fail on unsupported distribution for iscsi gateways
+      fail:
+        msg: "iSCSI gateways can only be deployed on Red Hat Enterprise Linux, CentOS or Fedora"
+      when: ansible_distribution not in ['RedHat', 'CentOS', 'Fedora']
+
+    - name: fail on unsupported distribution version for iscsi gateways
+      command: 'grep -q {{ item }}=m {% if is_atomic|bool %}/usr/lib/ostree-boot{% else %}/boot{% endif %}/config-{{ ansible_kernel }}'
+      register: iscsi_kernel
+      changed_when: false
+      failed_when: iscsi_kernel.rc != 0
+      loop:
+        - CONFIG_TARGET_CORE
+        - CONFIG_TCM_USER2
+        - CONFIG_ISCSI_TARGET
+      when: ansible_distribution in ['RedHat', 'CentOS']
+  when: iscsi_gw_group_name in group_names
index 15baf4686ea8609edb80ce518f44a7af62af3a67..10bc007f7136d78dfff5119d459b4abb13df04d2 100644 (file)
@@ -1,4 +1,16 @@
 ---
+- name: fail on unsupported ansible version (1.X)
+  fail:
+    msg: "Ansible version must be >= 2.8.x, please update!"
+  when: ansible_version.major|int < 2
+
+- name: fail on unsupported ansible version
+  fail:
+    msg: "Ansible version must be 2.8!"
+  when:
+    - ansible_version.major|int == 2
+    - ansible_version.minor|int != 8
+
 - name: fail on unsupported system
   fail:
     msg: "System not supported {{ ansible_system }}"
     - ansible_distribution == 'openSUSE Leap' or ansible_distribution == 'SUSE'
     - ansible_distribution_major_version != '15'
 
-- name: fail on unsupported ansible version (1.X)
-  fail:
-    msg: "Ansible version must be >= 2.8.x, please update!"
-  when: ansible_version.major|int < 2
-
-- name: fail on unsupported ansible version
-  fail:
-    msg: "Ansible version must be 2.8!"
-  when:
-    - ansible_version.major|int == 2
-    - ansible_version.minor|int != 8
-
 - name: fail if systemd is not present
   fail:
     msg: "Systemd must be present"
   when: ansible_service_mgr != 'systemd'
-
-- name: check if iscsi gateways is target on supported distros and versions
-  block:
-    - name: fail on unsupported distribution for iscsi gateways
-      fail:
-        msg: "iSCSI gateways can only be deployed on Red Hat Enterprise Linux, CentOS or Fedora"
-      when: ansible_distribution not in ['RedHat', 'CentOS', 'Fedora']
-
-    - name: fail on unsupported distribution version for iscsi gateways
-      command: 'grep -q {{ item }}=m {% if is_atomic|bool %}/usr/lib/ostree-boot{% else %}/boot{% endif %}/config-{{ ansible_kernel }}'
-      register: iscsi_kernel
-      changed_when: false
-      failed_when: iscsi_kernel.rc != 0
-      loop:
-        - CONFIG_TARGET_CORE
-        - CONFIG_TCM_USER2
-        - CONFIG_ISCSI_TARGET
-      when: ansible_distribution in ['RedHat', 'CentOS']
-  when: iscsi_gw_group_name in group_names
-
index 4ce2eff81f1b5ab017b87dac2aa0a274ea33e554..2d81e198c41641dd1f489f411ee3bcf80cbf06fe 100644 (file)
@@ -1,4 +1,7 @@
 ---
+- name: include check_system.yml
+  include_tasks: check_system.yml
+
 - name: validate repository variables in non-containerized scenario
   when: not containerized_deployment | bool
   block:
     - osd_objectstore == 'filestore'
     - osd_group_name in group_names
 
-- name: include check_system.yml
-  include_tasks: check_system.yml
-
 - name: include check_devices.yml
   include_tasks: check_devices.yml
   when: