From a781ce881c977d4300ff04be0bce405a32fe4665 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 2 Jul 2019 15:30:12 +0200 Subject: [PATCH] iscsi: refact deprecated variables This commit moves some old variables into ceph-defaults so we can move the `use_new_ceph_iscsi` fact in ceph-facts role in order. Signed-off-by: Guillaume Abrioux --- group_vars/all.yml.sample | 60 +++++++++++++++++++ group_vars/iscsigws.yml.sample | 59 ------------------ group_vars/rhcs.yml.sample | 60 +++++++++++++++++++ roles/ceph-defaults/defaults/main.yml | 60 +++++++++++++++++++ roles/ceph-facts/tasks/facts.yml | 4 ++ roles/ceph-iscsi-gw/defaults/main.yml | 59 ------------------ .../tasks/non-container/prerequisites.yml | 5 ++ roles/ceph-validate/tasks/check_iscsi.yml | 10 +--- 8 files changed, 192 insertions(+), 125 deletions(-) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index fd663afac..3edcdb17e 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -751,6 +751,66 @@ dummy: #alertmanager_conf_dir: /etc/alertmanager +################################## +# DEPRECIATED iSCSI TARGET SETUP # +################################## + +# WARNING # + +# The following values are depreciated. To setup targets, gateways, LUNs, and +# clients you should use gwcli or dashboard. If the following values are set, +# the old ceph-iscsi-config/ceph-iscsi-cli packages will be used. + +# Specify the iqn for ALL gateways. This iqn is shared across the gateways, so an iscsi +# client sees the gateway group as a single storage subsystem. +#gateway_iqn: "" + +# gateway_ip_list provides a list of the IP Addrresses - one per gateway - that will be used +# as an iscsi target portal ip. The list must be comma separated - and the order determines +# the sequence of TPG's within the iscsi target across each gateway. Once set, additional +# gateways can be added, but the order must *not* be changed. +#gateway_ip_list: 0.0.0.0 + +# rbd_devices defines the images that should be created and exported from the iscsi gateways. +# If the rbd does not exist, it will be created for you. In addition you may increase the +# size of rbd's by changing the size parameter and rerunning the playbook. A size value lower +# than the current size of the rbd is ignored. +# +# the 'host' parameter defines which of the gateway nodes should handle the physical +# allocation/expansion or removal of the rbd +# to remove an image, simply use a state of 'absent'. This will first check the rbd is not allocated +# to any client, and the remove it from LIO and then delete the rbd image +# +# NB. this variable definition can be commented out to bypass LUN management +# +# Example: +# +#rbd_devices: +# - { pool: 'rbd', image: 'ansible1', size: '30G', host: 'ceph-1', state: 'present' } +# - { pool: 'rbd', image: 'ansible2', size: '15G', host: 'ceph-1', state: 'present' } +# - { pool: 'rbd', image: 'ansible3', size: '30G', host: 'ceph-1', state: 'present' } +# - { pool: 'rbd', image: 'ansible4', size: '50G', host: 'ceph-1', state: 'present' } +#rbd_devices: {} + +# client_connections defines the client ACL's to restrict client access to specific LUNs +# The settings are as follows; +# - image_list is a comma separated list of rbd images of the form . +# - chap supplies the user and password the client will use for authentication of the +# form / +# - status shows the intended state of this client definition - 'present' or 'absent' +# +# NB. this definition can be commented out to skip client (nodeACL) management +# +# Example: +# +#client_connections: +# - { client: 'iqn.1994-05.com.redhat:rh7-iscsi-client', image_list: 'rbd.ansible1,rbd.ansible2', chap: 'rh7-iscsi-client/redhat', status: 'present' } +# - { client: 'iqn.1991-05.com.microsoft:w2k12r2', image_list: 'rbd.ansible4', chap: 'w2k12r2/microsoft_w2k12', status: 'absent' } + +#client_connections: {} + + + ############### # DEPRECATION # ############### diff --git a/group_vars/iscsigws.yml.sample b/group_vars/iscsigws.yml.sample index 1614f2cfc..6314ff52d 100644 --- a/group_vars/iscsigws.yml.sample +++ b/group_vars/iscsigws.yml.sample @@ -50,62 +50,3 @@ dummy: #ceph_rbd_target_api_docker_memory_limit: "{{ ansible_memtotal_mb }}m" #ceph_rbd_target_api_docker_cpu_limit: 1 - -################################## -# DEPRECIATED iSCSI TARGET SETUP # -################################## - -# WARNING # - -# The following values are depreciated. To setup targets, gateways, LUNs, and -# clients you should use gwcli or dashboard. If the following values are set, -# the old ceph-iscsi-config/ceph-iscsi-cli packages will be used. - -# Specify the iqn for ALL gateways. This iqn is shared across the gateways, so an iscsi -# client sees the gateway group as a single storage subsystem. -#gateway_iqn: "" - -# gateway_ip_list provides a list of the IP Addrresses - one per gateway - that will be used -# as an iscsi target portal ip. The list must be comma separated - and the order determines -# the sequence of TPG's within the iscsi target across each gateway. Once set, additional -# gateways can be added, but the order must *not* be changed. -#gateway_ip_list: 0.0.0.0 - -# rbd_devices defines the images that should be created and exported from the iscsi gateways. -# If the rbd does not exist, it will be created for you. In addition you may increase the -# size of rbd's by changing the size parameter and rerunning the playbook. A size value lower -# than the current size of the rbd is ignored. -# -# the 'host' parameter defines which of the gateway nodes should handle the physical -# allocation/expansion or removal of the rbd -# to remove an image, simply use a state of 'absent'. This will first check the rbd is not allocated -# to any client, and the remove it from LIO and then delete the rbd image -# -# NB. this variable definition can be commented out to bypass LUN management -# -# Example: -# -#rbd_devices: -# - { pool: 'rbd', image: 'ansible1', size: '30G', host: 'ceph-1', state: 'present' } -# - { pool: 'rbd', image: 'ansible2', size: '15G', host: 'ceph-1', state: 'present' } -# - { pool: 'rbd', image: 'ansible3', size: '30G', host: 'ceph-1', state: 'present' } -# - { pool: 'rbd', image: 'ansible4', size: '50G', host: 'ceph-1', state: 'present' } -#rbd_devices: {} - -# client_connections defines the client ACL's to restrict client access to specific LUNs -# The settings are as follows; -# - image_list is a comma separated list of rbd images of the form . -# - chap supplies the user and password the client will use for authentication of the -# form / -# - status shows the intended state of this client definition - 'present' or 'absent' -# -# NB. this definition can be commented out to skip client (nodeACL) management -# -# Example: -# -#client_connections: -# - { client: 'iqn.1994-05.com.redhat:rh7-iscsi-client', image_list: 'rbd.ansible1,rbd.ansible2', chap: 'rh7-iscsi-client/redhat', status: 'present' } -# - { client: 'iqn.1991-05.com.microsoft:w2k12r2', image_list: 'rbd.ansible4', chap: 'w2k12r2/microsoft_w2k12', status: 'absent' } - -#client_connections: {} - diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index a149ca744..14a97663b 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -751,6 +751,66 @@ ceph_docker_registry: "registry.access.redhat.com" #alertmanager_conf_dir: /etc/alertmanager +################################## +# DEPRECIATED iSCSI TARGET SETUP # +################################## + +# WARNING # + +# The following values are depreciated. To setup targets, gateways, LUNs, and +# clients you should use gwcli or dashboard. If the following values are set, +# the old ceph-iscsi-config/ceph-iscsi-cli packages will be used. + +# Specify the iqn for ALL gateways. This iqn is shared across the gateways, so an iscsi +# client sees the gateway group as a single storage subsystem. +#gateway_iqn: "" + +# gateway_ip_list provides a list of the IP Addrresses - one per gateway - that will be used +# as an iscsi target portal ip. The list must be comma separated - and the order determines +# the sequence of TPG's within the iscsi target across each gateway. Once set, additional +# gateways can be added, but the order must *not* be changed. +#gateway_ip_list: 0.0.0.0 + +# rbd_devices defines the images that should be created and exported from the iscsi gateways. +# If the rbd does not exist, it will be created for you. In addition you may increase the +# size of rbd's by changing the size parameter and rerunning the playbook. A size value lower +# than the current size of the rbd is ignored. +# +# the 'host' parameter defines which of the gateway nodes should handle the physical +# allocation/expansion or removal of the rbd +# to remove an image, simply use a state of 'absent'. This will first check the rbd is not allocated +# to any client, and the remove it from LIO and then delete the rbd image +# +# NB. this variable definition can be commented out to bypass LUN management +# +# Example: +# +#rbd_devices: +# - { pool: 'rbd', image: 'ansible1', size: '30G', host: 'ceph-1', state: 'present' } +# - { pool: 'rbd', image: 'ansible2', size: '15G', host: 'ceph-1', state: 'present' } +# - { pool: 'rbd', image: 'ansible3', size: '30G', host: 'ceph-1', state: 'present' } +# - { pool: 'rbd', image: 'ansible4', size: '50G', host: 'ceph-1', state: 'present' } +#rbd_devices: {} + +# client_connections defines the client ACL's to restrict client access to specific LUNs +# The settings are as follows; +# - image_list is a comma separated list of rbd images of the form . +# - chap supplies the user and password the client will use for authentication of the +# form / +# - status shows the intended state of this client definition - 'present' or 'absent' +# +# NB. this definition can be commented out to skip client (nodeACL) management +# +# Example: +# +#client_connections: +# - { client: 'iqn.1994-05.com.redhat:rh7-iscsi-client', image_list: 'rbd.ansible1,rbd.ansible2', chap: 'rh7-iscsi-client/redhat', status: 'present' } +# - { client: 'iqn.1991-05.com.microsoft:w2k12r2', image_list: 'rbd.ansible4', chap: 'w2k12r2/microsoft_w2k12', status: 'absent' } + +#client_connections: {} + + + ############### # DEPRECATION # ############### diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index 4a68cc324..cf936639d 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -743,6 +743,66 @@ alertmanager_data_dir: /var/lib/alertmanager alertmanager_conf_dir: /etc/alertmanager +################################## +# DEPRECIATED iSCSI TARGET SETUP # +################################## + +# WARNING # + +# The following values are depreciated. To setup targets, gateways, LUNs, and +# clients you should use gwcli or dashboard. If the following values are set, +# the old ceph-iscsi-config/ceph-iscsi-cli packages will be used. + +# Specify the iqn for ALL gateways. This iqn is shared across the gateways, so an iscsi +# client sees the gateway group as a single storage subsystem. +gateway_iqn: "" + +# gateway_ip_list provides a list of the IP Addrresses - one per gateway - that will be used +# as an iscsi target portal ip. The list must be comma separated - and the order determines +# the sequence of TPG's within the iscsi target across each gateway. Once set, additional +# gateways can be added, but the order must *not* be changed. +gateway_ip_list: 0.0.0.0 + +# rbd_devices defines the images that should be created and exported from the iscsi gateways. +# If the rbd does not exist, it will be created for you. In addition you may increase the +# size of rbd's by changing the size parameter and rerunning the playbook. A size value lower +# than the current size of the rbd is ignored. +# +# the 'host' parameter defines which of the gateway nodes should handle the physical +# allocation/expansion or removal of the rbd +# to remove an image, simply use a state of 'absent'. This will first check the rbd is not allocated +# to any client, and the remove it from LIO and then delete the rbd image +# +# NB. this variable definition can be commented out to bypass LUN management +# +# Example: +# +#rbd_devices: +# - { pool: 'rbd', image: 'ansible1', size: '30G', host: 'ceph-1', state: 'present' } +# - { pool: 'rbd', image: 'ansible2', size: '15G', host: 'ceph-1', state: 'present' } +# - { pool: 'rbd', image: 'ansible3', size: '30G', host: 'ceph-1', state: 'present' } +# - { pool: 'rbd', image: 'ansible4', size: '50G', host: 'ceph-1', state: 'present' } +rbd_devices: {} + +# client_connections defines the client ACL's to restrict client access to specific LUNs +# The settings are as follows; +# - image_list is a comma separated list of rbd images of the form . +# - chap supplies the user and password the client will use for authentication of the +# form / +# - status shows the intended state of this client definition - 'present' or 'absent' +# +# NB. this definition can be commented out to skip client (nodeACL) management +# +# Example: +# +#client_connections: +# - { client: 'iqn.1994-05.com.redhat:rh7-iscsi-client', image_list: 'rbd.ansible1,rbd.ansible2', chap: 'rh7-iscsi-client/redhat', status: 'present' } +# - { client: 'iqn.1991-05.com.microsoft:w2k12r2', image_list: 'rbd.ansible4', chap: 'w2k12r2/microsoft_w2k12', status: 'absent' } + +client_connections: {} + + + ############### # DEPRECATION # ############### diff --git a/roles/ceph-facts/tasks/facts.yml b/roles/ceph-facts/tasks/facts.yml index 1988b3412..f787abdc7 100644 --- a/roles/ceph-facts/tasks/facts.yml +++ b/roles/ceph-facts/tasks/facts.yml @@ -318,3 +318,7 @@ - (groups.get(grafana_server_group_name, []) | length > 0 or groups.get(mgr_group_name, []) | length > 0) - ip_version == 'ipv6' - dashboard_enabled | bool + +- 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) }}" \ No newline at end of file diff --git a/roles/ceph-iscsi-gw/defaults/main.yml b/roles/ceph-iscsi-gw/defaults/main.yml index e2944ed9e..4c7ff98c8 100644 --- a/roles/ceph-iscsi-gw/defaults/main.yml +++ b/roles/ceph-iscsi-gw/defaults/main.yml @@ -41,62 +41,3 @@ ceph_rbd_target_gw_docker_cpu_limit: 1 # RBD_TARGET_API resource limitation ceph_rbd_target_api_docker_memory_limit: "{{ ansible_memtotal_mb }}m" ceph_rbd_target_api_docker_cpu_limit: 1 - - -################################## -# DEPRECIATED iSCSI TARGET SETUP # -################################## - -# WARNING # - -# The following values are depreciated. To setup targets, gateways, LUNs, and -# clients you should use gwcli or dashboard. If the following values are set, -# the old ceph-iscsi-config/ceph-iscsi-cli packages will be used. - -# Specify the iqn for ALL gateways. This iqn is shared across the gateways, so an iscsi -# client sees the gateway group as a single storage subsystem. -gateway_iqn: "" - -# gateway_ip_list provides a list of the IP Addrresses - one per gateway - that will be used -# as an iscsi target portal ip. The list must be comma separated - and the order determines -# the sequence of TPG's within the iscsi target across each gateway. Once set, additional -# gateways can be added, but the order must *not* be changed. -gateway_ip_list: 0.0.0.0 - -# rbd_devices defines the images that should be created and exported from the iscsi gateways. -# If the rbd does not exist, it will be created for you. In addition you may increase the -# size of rbd's by changing the size parameter and rerunning the playbook. A size value lower -# than the current size of the rbd is ignored. -# -# the 'host' parameter defines which of the gateway nodes should handle the physical -# allocation/expansion or removal of the rbd -# to remove an image, simply use a state of 'absent'. This will first check the rbd is not allocated -# to any client, and the remove it from LIO and then delete the rbd image -# -# NB. this variable definition can be commented out to bypass LUN management -# -# Example: -# -#rbd_devices: -# - { pool: 'rbd', image: 'ansible1', size: '30G', host: 'ceph-1', state: 'present' } -# - { pool: 'rbd', image: 'ansible2', size: '15G', host: 'ceph-1', state: 'present' } -# - { pool: 'rbd', image: 'ansible3', size: '30G', host: 'ceph-1', state: 'present' } -# - { pool: 'rbd', image: 'ansible4', size: '50G', host: 'ceph-1', state: 'present' } -rbd_devices: {} - -# client_connections defines the client ACL's to restrict client access to specific LUNs -# The settings are as follows; -# - image_list is a comma separated list of rbd images of the form . -# - chap supplies the user and password the client will use for authentication of the -# form / -# - status shows the intended state of this client definition - 'present' or 'absent' -# -# NB. this definition can be commented out to skip client (nodeACL) management -# -# Example: -# -#client_connections: -# - { client: 'iqn.1994-05.com.redhat:rh7-iscsi-client', image_list: 'rbd.ansible1,rbd.ansible2', chap: 'rh7-iscsi-client/redhat', status: 'present' } -# - { client: 'iqn.1991-05.com.microsoft:w2k12r2', image_list: 'rbd.ansible4', chap: 'w2k12r2/microsoft_w2k12', status: 'absent' } - -client_connections: {} diff --git a/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml b/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml index b9c00e48a..7c604330f 100644 --- a/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml +++ b/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml @@ -11,23 +11,28 @@ common_repos: - tcmu-runner - python-rtslib + - name: set_fact base iscsi pkgs if new style ceph-iscsi set_fact: iscsi_base: - ceph-iscsi when: use_new_ceph_iscsi | bool + - name: set_fact base iscsi pkgs if using older ceph-iscsi-config set_fact: iscsi_base: - ceph-iscsi-cli - ceph-iscsi-config when: not use_new_ceph_iscsi | bool + - name: set_fact ceph_iscsi_repos set_fact: ceph_iscsi_repos: "{{ common_repos + iscsi_base }}" + - name: set_fact ceph_iscsi_pkgs set_fact: ceph_iscsi_pkgs: "{{ common_pkgs + iscsi_base }}" + - name: when ceph_iscsi_config_dev is true when: - ceph_origin == 'repository' diff --git a/roles/ceph-validate/tasks/check_iscsi.yml b/roles/ceph-validate/tasks/check_iscsi.yml index 6233a3d34..0f7ff890b 100644 --- a/roles/ceph-validate/tasks/check_iscsi.yml +++ b/roles/ceph-validate/tasks/check_iscsi.yml @@ -1,13 +1,9 @@ --- -- name: set_fact use_new_ceph_iscsi package or old ceph-iscsi-config/cli - set_fact: - use_new_ceph_iscsi: "{{ (gateway_ip_list | default('0.0.0.0') == '0.0.0.0' and gateway_iqn | default('') | length == 0 and client_connections | default({}) | length == 0 and rbd_devices | default({}) | length == 0) | bool | ternary(true, false) }}" - - name: make sure gateway_ip_list is configured fail: msg: "you must set a list of IPs (comma separated) for gateway_ip_list" when: - - "gateway_ip_list | default('0.0.0.0') == '0.0.0.0'" + - gateway_ip_list == '0.0.0.0' - not containerized_deployment | bool - not use_new_ceph_iscsi | bool @@ -15,14 +11,14 @@ fail: msg: "you must set a iqn for the iSCSI target" when: - - "gateway_iqn | default('') | length == 0" + - gateway_iqn | length == 0 - not containerized_deployment | bool - not use_new_ceph_iscsi | bool - name: fail if unsupported chap configuration fail: msg: "Mixing clients with CHAP enabled and disabled is not supported." - with_items: "{{ client_connections | default({}) }}" + with_items: "{{ client_connections }}" when: - item.status is defined - item.status == "present" -- 2.39.5