diff --git a/roles/ceph-validate/tasks/check_iscsi.yml b/roles/ceph-validate/tasks/check_iscsi.yml index 0f7ff890b..0b06afe43 100644 --- a/roles/ceph-validate/tasks/check_iscsi.yml +++ b/roles/ceph-validate/tasks/check_iscsi.yml @@ -24,3 +24,22 @@ - 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 diff --git a/roles/ceph-validate/tasks/check_system.yml b/roles/ceph-validate/tasks/check_system.yml index 9863188a0..44b1c6dc2 100644 --- a/roles/ceph-validate/tasks/check_system.yml +++ b/roles/ceph-validate/tasks/check_system.yml @@ -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 }}" @@ -53,39 +65,7 @@ - ansible_distribution == 'openSUSE Leap' - 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 - diff --git a/roles/ceph-validate/tasks/main.yml b/roles/ceph-validate/tasks/main.yml index 757cd1b2c..8424eb562 100644 --- a/roles/ceph-validate/tasks/main.yml +++ b/roles/ceph-validate/tasks/main.yml @@ -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: @@ -134,9 +137,6 @@ - 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: