2018-09-29 05:23:10 +08:00
|
|
|
---
|
2019-12-11 05:35:34 +08:00
|
|
|
- name: fail on unsupported distribution for iscsi gateways
|
|
|
|
fail:
|
|
|
|
msg: "iSCSI gateways can only be deployed on Red Hat Enterprise Linux, CentOS or Fedora"
|
2022-03-31 20:10:14 +08:00
|
|
|
when: ansible_facts['distribution'] not in ['RedHat', 'CentOS', 'Fedora', 'AlmaLinux', 'Rocky']
|
2019-12-11 05:35:34 +08:00
|
|
|
|
2019-05-30 23:54:04 +08:00
|
|
|
- name: make sure gateway_ip_list is configured
|
|
|
|
fail:
|
|
|
|
msg: "you must set a list of IPs (comma separated) for gateway_ip_list"
|
2019-05-30 23:55:45 +08:00
|
|
|
when:
|
2019-07-02 21:30:12 +08:00
|
|
|
- gateway_ip_list == '0.0.0.0'
|
2019-05-30 23:55:45 +08:00
|
|
|
- not containerized_deployment | bool
|
2019-05-31 00:28:34 +08:00
|
|
|
- not use_new_ceph_iscsi | bool
|
2019-05-30 23:54:04 +08:00
|
|
|
|
2019-05-31 00:17:09 +08:00
|
|
|
- name: make sure gateway_iqn is configured
|
|
|
|
fail:
|
|
|
|
msg: "you must set a iqn for the iSCSI target"
|
|
|
|
when:
|
2019-07-02 21:30:12 +08:00
|
|
|
- gateway_iqn | length == 0
|
2019-05-31 00:17:09 +08:00
|
|
|
- not containerized_deployment | bool
|
|
|
|
- not use_new_ceph_iscsi | bool
|
|
|
|
|
2018-09-29 05:23:10 +08:00
|
|
|
- name: fail if unsupported chap configuration
|
|
|
|
fail:
|
|
|
|
msg: "Mixing clients with CHAP enabled and disabled is not supported."
|
2019-07-02 21:30:12 +08:00
|
|
|
with_items: "{{ client_connections }}"
|
2018-09-29 05:23:10 +08:00
|
|
|
when:
|
|
|
|
- item.status is defined
|
|
|
|
- item.status == "present"
|
2018-11-01 23:03:16 +08:00
|
|
|
- item.chap
|
2018-09-29 05:23:10 +08:00
|
|
|
- " '' in client_connections | selectattr('status', 'match', 'present') | map(attribute='chap') | list"
|
2019-12-07 05:11:51 +08:00
|
|
|
|
2019-12-11 05:35:34 +08:00
|
|
|
- name: fail on unsupported distribution version for iscsi gateways
|
2021-03-03 22:43:50 +08:00
|
|
|
command: "grep -q {{ item }}=m {% if is_atomic|bool %}/usr/lib/ostree-boot{% else %}/boot{% endif %}/config-{{ ansible_facts['kernel'] }}"
|
2019-12-11 05:35:34 +08:00
|
|
|
register: iscsi_kernel
|
|
|
|
changed_when: false
|
|
|
|
failed_when: iscsi_kernel.rc != 0
|
|
|
|
loop:
|
|
|
|
- CONFIG_TARGET_CORE
|
|
|
|
- CONFIG_TCM_USER2
|
|
|
|
- CONFIG_ISCSI_TARGET
|
2021-03-03 22:43:50 +08:00
|
|
|
when: ansible_facts['distribution'] in ['RedHat', 'CentOS']
|