]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-facts: set use_new_ceph_iscsi on iscsi nodes
authorDimitri Savineau <dsavinea@redhat.com>
Tue, 10 Dec 2019 21:35:34 +0000 (16:35 -0500)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 10 Dec 2019 22:57:03 +0000 (23:57 +0100)
We don't need to set the use_new_ceph_iscsi fact on other nodes than
those present in the iscsigws group.
Also remove the duplicate iscsi_gw_group_name condition already present
on the include_task.
Finally validate the ansible distribution as the first task.

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

index 6e6037cfadaaac7222bb5f6e2dc5a83838212900..1b9a4b72bfd5293234b09b474d5edeec6e2286cc 100644 (file)
 - name: set_fact use_new_ceph_iscsi package or old ceph-iscsi-config/cli
   set_fact:
     use_new_ceph_iscsi: "{{ (gateway_ip_list  == '0.0.0.0' and gateway_iqn | length == 0 and client_connections | length == 0 and rbd_devices | length == 0) | bool | ternary(true, false) }}"
+  when: iscsi_gw_group_name in group_names
index 0b06afe430271e73575dcae3763f385c15ec5a70..0f9a803fff5c3b7462bb58b02f6208951549858c 100644 (file)
@@ -1,4 +1,9 @@
 ---
+- 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: make sure gateway_ip_list is configured
   fail:
     msg: "you must set a list of IPs (comma separated) for gateway_ip_list"
     - 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
+- 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']