ceph-iscsi: Update gateway config/template

- Remove gateway_keyring from the configuration file because it's
not used in ceph-iscsi 3.x release.
- Use config_template instead of template module for iscsi-gateway
configuration file. Because the file is an ini file and we might want
to override more parameters than those present in ceph-ansible.
- Because we can now set the pool name in the configuration, we should
use a variable for that. This is refact with the iscsi_pool_* variables
also used to configure the pool size.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 1f2a4f1910)
pull/4219/head
Dimitri Savineau 2019-07-08 14:36:07 -04:00 committed by mergify[bot]
parent 1b6d8f9b45
commit c040c34d97
4 changed files with 18 additions and 13 deletions

View File

@ -15,7 +15,9 @@ dummy:
# Whether or not to generate secure certificate to iSCSI gateway nodes # Whether or not to generate secure certificate to iSCSI gateway nodes
#generate_crt: False #generate_crt: False
#rbd_pool_size: "{{ osd_pool_default_size }}" #iscsi_conf_overrides: {}
#iscsi_pool_name: rbd
#iscsi_pool_size: "{{ osd_pool_default_size }}"
################## ##################
# RBD-TARGET-API # # RBD-TARGET-API #

View File

@ -7,7 +7,9 @@
# Whether or not to generate secure certificate to iSCSI gateway nodes # Whether or not to generate secure certificate to iSCSI gateway nodes
generate_crt: False generate_crt: False
rbd_pool_size: "{{ osd_pool_default_size }}" iscsi_conf_overrides: {}
iscsi_pool_name: rbd
iscsi_pool_size: "{{ osd_pool_default_size }}"
################## ##################
# RBD-TARGET-API # # RBD-TARGET-API #

View File

@ -9,9 +9,11 @@
when: cephx | bool when: cephx | bool
- name: deploy gateway settings, used by the ceph_iscsi_config modules - name: deploy gateway settings, used by the ceph_iscsi_config modules
template: config_template:
src: "{{ role_path }}/templates/iscsi-gateway.cfg.j2" src: "{{ role_path }}/templates/iscsi-gateway.cfg.j2"
dest: /etc/ceph/iscsi-gateway.cfg dest: /etc/ceph/iscsi-gateway.cfg
config_type: ini
config_overrides: '{{ iscsi_conf_overrides }}'
- name: set_fact container_exec_cmd - name: set_fact container_exec_cmd
set_fact: set_fact:
@ -22,24 +24,24 @@
- name: check if a rbd pool exists - name: check if a rbd pool exists
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool ls --format json" command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool ls --format json"
changed_when: false changed_when: false
register: rbd_pool_exists register: iscsi_pool_exists
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
- name: rbd pool related tasks - name: iscsi pool related tasks
when: "'rbd' not in (rbd_pool_exists.stdout | from_json)" when: "iscsi_pool_name not in (iscsi_pool_exists.stdout | from_json)"
block: block:
- name: create a rbd pool if it doesn't exist - name: create a iscsi pool if it doesn't exist
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool create rbd {{ osd_pool_default_pg_num }}" command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool create {{ iscsi_pool_name }} {{ osd_pool_default_pg_num }}"
changed_when: false changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
- name: assign application rbd to pool 'rbd' - name: assign application rbd to iscsi pool
command: "{{ container_exec_cmd }} ceph --connect-timeout 5 --cluster {{ cluster }} osd pool application enable rbd rbd" command: "{{ container_exec_cmd }} ceph --connect-timeout 5 --cluster {{ cluster }} osd pool application enable {{ iscsi_pool_name }} rbd"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: True run_once: True
- name: customize pool size - name: customize pool size
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool set rbd size {{ rbd_pool_size | default(osd_pool_default_size) }}" command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool set {{ iscsi_pool_name }} size {{ iscsi_pool_size | default(osd_pool_default_size) }}"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false changed_when: false
when: rbd_pool_size | default(osd_pool_default_size) != ceph_osd_pool_default_size when: iscsi_pool_size | default(osd_pool_default_size) != ceph_osd_pool_default_size

View File

@ -5,7 +5,6 @@
[config] [config]
cluster_name = {{ cluster }} cluster_name = {{ cluster }}
gateway_keyring = {{ cluster }}.client.admin.keyring
# API settings. # API settings.
# The API supports a number of options that allow you to tailor it to your # The API supports a number of options that allow you to tailor it to your