diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 18d2e23cc..5606e3556 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -354,8 +354,8 @@ dummy: #cephfs_metadata: cephfs_metadata # name of the metadata pool for a given filesystem #cephfs_pools: -# - { name: "{{ cephfs_data }}", pgs: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}", size: "" } -# - { name: "{{ cephfs_metadata }}", pgs: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}", size: "" } +# - { name: "{{ cephfs_data }}", pgs: "{{ osd_pool_default_pg_num }}", size: "" } +# - { name: "{{ cephfs_metadata }}", pgs: "{{ osd_pool_default_pg_num }}", size: "" } ## OSD options # @@ -578,8 +578,8 @@ dummy: #openstack_config: false #openstack_glance_pool: # name: "images" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -588,8 +588,8 @@ dummy: # size: "" #openstack_cinder_pool: # name: "volumes" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -598,8 +598,8 @@ dummy: # size: "" #openstack_nova_pool: # name: "vms" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -608,8 +608,8 @@ dummy: # size: "" #openstack_cinder_backup_pool: # name: "backups" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -618,8 +618,8 @@ dummy: # size: "" #openstack_gnocchi_pool: # name: "metrics" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -628,8 +628,8 @@ dummy: # size: "" #openstack_cephfs_data_pool: # name: "manila_data" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -638,8 +638,8 @@ dummy: # size: "" #openstack_cephfs_metadata_pool: # name: "manila_metadata" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" diff --git a/group_vars/clients.yml.sample b/group_vars/clients.yml.sample index 5bae33868..39a3c04b4 100644 --- a/group_vars/clients.yml.sample +++ b/group_vars/clients.yml.sample @@ -20,8 +20,8 @@ dummy: #user_config: false #test: # name: "test" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -29,8 +29,8 @@ dummy: # size: "" #test2: # name: "test2" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index 8031d0279..7cd0c7017 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -354,8 +354,8 @@ ceph_rhcs_version: 3 #cephfs_metadata: cephfs_metadata # name of the metadata pool for a given filesystem #cephfs_pools: -# - { name: "{{ cephfs_data }}", pgs: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}", size: "" } -# - { name: "{{ cephfs_metadata }}", pgs: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}", size: "" } +# - { name: "{{ cephfs_data }}", pgs: "{{ osd_pool_default_pg_num }}", size: "" } +# - { name: "{{ cephfs_metadata }}", pgs: "{{ osd_pool_default_pg_num }}", size: "" } ## OSD options # @@ -578,8 +578,8 @@ ceph_docker_registry: "registry.access.redhat.com/rhceph/" #openstack_config: false #openstack_glance_pool: # name: "images" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -588,8 +588,8 @@ ceph_docker_registry: "registry.access.redhat.com/rhceph/" # size: "" #openstack_cinder_pool: # name: "volumes" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -598,8 +598,8 @@ ceph_docker_registry: "registry.access.redhat.com/rhceph/" # size: "" #openstack_nova_pool: # name: "vms" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -608,8 +608,8 @@ ceph_docker_registry: "registry.access.redhat.com/rhceph/" # size: "" #openstack_cinder_backup_pool: # name: "backups" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -618,8 +618,8 @@ ceph_docker_registry: "registry.access.redhat.com/rhceph/" # size: "" #openstack_gnocchi_pool: # name: "metrics" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -628,8 +628,8 @@ ceph_docker_registry: "registry.access.redhat.com/rhceph/" # size: "" #openstack_cephfs_data_pool: # name: "manila_data" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" @@ -638,8 +638,8 @@ ceph_docker_registry: "registry.access.redhat.com/rhceph/" # size: "" #openstack_cephfs_metadata_pool: # name: "manila_metadata" -# pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" -# pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" +# pg_num: "{{ osd_pool_default_pg_num }}" +# pgp_num: "{{ osd_pool_default_pg_num }}" # rule_name: "replicated_rule" # type: 1 # erasure_profile: "" diff --git a/roles/ceph-client/defaults/main.yml b/roles/ceph-client/defaults/main.yml index 80f9a5552..ad9779cf5 100644 --- a/roles/ceph-client/defaults/main.yml +++ b/roles/ceph-client/defaults/main.yml @@ -12,8 +12,8 @@ copy_admin_key: false user_config: false test: name: "test" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "replicated_rule" type: 1 erasure_profile: "" @@ -21,8 +21,8 @@ test: size: "" test2: name: "test2" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "replicated_rule" type: 1 erasure_profile: "" diff --git a/roles/ceph-client/tasks/create_users_keys.yml b/roles/ceph-client/tasks/create_users_keys.yml index 401b838c4..cd2eb0cef 100644 --- a/roles/ceph-client/tasks/create_users_keys.yml +++ b/roles/ceph-client/tasks/create_users_keys.yml @@ -102,9 +102,9 @@ command: > {{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool create {{ item.0.name }} - {{ item.0.pg_num }} - {{ item.0.pgp_num }} - {{ 'replicated_rule' if item.0.rule_name | default('replicated_rule') == '' else item.0.rule_name | default('replicated_rule') }} + {{ item.0.pg_num | default(osd_pool_default_pg_num) }} + {{ item.0.pgp_num | default(item.0.pg_num) | default(osd_pool_default_pg_num) }} + {{ 'replicated_rule' if not item.0.rule_name | default('replicated_rule') else item.0.rule_name | default('replicated_rule') }} {{ 1 if item.0.type|default(1) == 'replicated' else 3 if item.0.type|default(1) == 'erasure' else item.0.type|default(1) }} {%- if (item.0.type | default("1") == '3' or item.0.type | default("1") == 'erasure') and item.0.erasure_profile != '' %} {{ item.0.erasure_profile }} diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index 807b3bc4a..7bb8226ef 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -346,8 +346,8 @@ cephfs_data: cephfs_data # name of the data pool for a given filesystem cephfs_metadata: cephfs_metadata # name of the metadata pool for a given filesystem cephfs_pools: - - { name: "{{ cephfs_data }}", pgs: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}", size: "" } - - { name: "{{ cephfs_metadata }}", pgs: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}", size: "" } + - { name: "{{ cephfs_data }}", pgs: "{{ osd_pool_default_pg_num }}", size: "" } + - { name: "{{ cephfs_metadata }}", pgs: "{{ osd_pool_default_pg_num }}", size: "" } ## OSD options # @@ -570,8 +570,8 @@ docker_pull_timeout: "300s" openstack_config: false openstack_glance_pool: name: "images" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "replicated_rule" type: 1 erasure_profile: "" @@ -580,8 +580,8 @@ openstack_glance_pool: size: "" openstack_cinder_pool: name: "volumes" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "replicated_rule" type: 1 erasure_profile: "" @@ -590,8 +590,8 @@ openstack_cinder_pool: size: "" openstack_nova_pool: name: "vms" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "replicated_rule" type: 1 erasure_profile: "" @@ -600,8 +600,8 @@ openstack_nova_pool: size: "" openstack_cinder_backup_pool: name: "backups" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "replicated_rule" type: 1 erasure_profile: "" @@ -610,8 +610,8 @@ openstack_cinder_backup_pool: size: "" openstack_gnocchi_pool: name: "metrics" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "replicated_rule" type: 1 erasure_profile: "" @@ -620,8 +620,8 @@ openstack_gnocchi_pool: size: "" openstack_cephfs_data_pool: name: "manila_data" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "replicated_rule" type: 1 erasure_profile: "" @@ -630,8 +630,8 @@ openstack_cephfs_data_pool: size: "" openstack_cephfs_metadata_pool: name: "manila_metadata" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "replicated_rule" type: 1 erasure_profile: "" diff --git a/roles/ceph-defaults/tasks/facts.yml b/roles/ceph-defaults/tasks/facts.yml index 45d7bba6e..39b28555c 100644 --- a/roles/ceph-defaults/tasks/facts.yml +++ b/roles/ceph-defaults/tasks/facts.yml @@ -240,5 +240,9 @@ - ceph_current_status['servicemap']['services'] is defined - ceph_current_status['servicemap']['services']['rgw'] is defined +- name: set_fact osd_pool_default_pg_num + set_fact: + osd_pool_default_pg_num: "{{ ceph_conf_overrides.get('global', {}).get('osd_pool_default_pg_num', ceph_osd_pool_default_pg_num) }}" + - name: populate service facts service_facts: diff --git a/roles/ceph-iscsi-gw/tasks/common.yml b/roles/ceph-iscsi-gw/tasks/common.yml index 9f54ebde2..a40b75506 100644 --- a/roles/ceph-iscsi-gw/tasks/common.yml +++ b/roles/ceph-iscsi-gw/tasks/common.yml @@ -35,14 +35,8 @@ - name: rbd pool related tasks when: "'rbd' not in (rbd_pool_exists.stdout | from_json)" block: - - name: get default value for osd_pool_default_pg_num - command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} daemon mon.{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} config get osd_pool_default_pg_num" - changed_when: false - register: osd_pool_default_pg_num - delegate_to: "{{ groups[mon_group_name][0] }}" - - name: create a rbd pool if it doesn't exist - command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool create rbd {{ (osd_pool_default_pg_num.stdout | from_json).osd_pool_default_pg_num }}" + command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool create rbd {{ osd_pool_default_pg_num }}" changed_when: false delegate_to: "{{ groups[mon_group_name][0] }}" diff --git a/roles/ceph-mds/tasks/create_mds_filesystems.yml b/roles/ceph-mds/tasks/create_mds_filesystems.yml index 787fbe2bd..0f9a5d451 100644 --- a/roles/ceph-mds/tasks/create_mds_filesystems.yml +++ b/roles/ceph-mds/tasks/create_mds_filesystems.yml @@ -2,7 +2,7 @@ - name: filesystem pools related tasks block: - name: create filesystem pools - command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.pgs }}" + command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.pgs | default(osd_pool_default_pg_num) }}" changed_when: false delegate_to: "{{ groups[mon_group_name][0] }}" with_items: diff --git a/roles/ceph-mon/tasks/main.yml b/roles/ceph-mon/tasks/main.yml index 3181879e8..4aa0b2739 100644 --- a/roles/ceph-mon/tasks/main.yml +++ b/roles/ceph-mon/tasks/main.yml @@ -33,6 +33,3 @@ include_tasks: crush_rules.yml when: - crush_rule_config - -- name: include set_osd_pool_default_pg_num.yml - include_tasks: set_osd_pool_default_pg_num.yml diff --git a/roles/ceph-mon/tasks/set_osd_pool_default_pg_num.yml b/roles/ceph-mon/tasks/set_osd_pool_default_pg_num.yml deleted file mode 100644 index f9a3c206f..000000000 --- a/roles/ceph-mon/tasks/set_osd_pool_default_pg_num.yml +++ /dev/null @@ -1,31 +0,0 @@ -# NOTE(leseb): we add a conditional for backward compatibility -# so people that had 'pool_default_pg_num' declared will get -# the same behaviour -# -- name: get default value for osd_pool_default_pg_num - shell: | - {{ docker_exec_cmd }} ceph --cluster {{ cluster }} daemon mon.{{ monitor_name }} config get osd_pool_default_pg_num - failed_when: false - changed_when: false - run_once: true - register: default_pool_default_pg_num - when: - - pool_default_pg_num is not defined - - ceph_conf_overrides.get('global', {}).get('osd_pool_default_pg_num', False) == False - -- name: set_fact osd_pool_default_pg_num with pool_default_pg_num (backward compatibility) - set_fact: - osd_pool_default_pg_num: "{{ pool_default_pg_num }}" - when: pool_default_pg_num is defined - -- name: set_fact osd_pool_default_pg_num with default_pool_default_pg_num.stdout - set_fact: - osd_pool_default_pg_num: "{{ (default_pool_default_pg_num.stdout | from_json).osd_pool_default_pg_num }}" - when: - - default_pool_default_pg_num.get('rc') == 0 - -- name: set_fact osd_pool_default_pg_num ceph_conf_overrides.global.osd_pool_default_pg_num - set_fact: - osd_pool_default_pg_num: "{{ ceph_conf_overrides.global.osd_pool_default_pg_num }}" - when: - - ceph_conf_overrides.get('global', {}).get('osd_pool_default_pg_num', False) != False diff --git a/roles/ceph-osd/tasks/openstack_config.yml b/roles/ceph-osd/tasks/openstack_config.yml index 052345aef..c42d1f985 100644 --- a/roles/ceph-osd/tasks/openstack_config.yml +++ b/roles/ceph-osd/tasks/openstack_config.yml @@ -24,9 +24,9 @@ command: > {{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool create {{ item.0.name }} - {{ item.0.pg_num }} - {{ item.0.pgp_num | default(item.0.pg_num) }} - {{ 'replicated_rule' if item.0.rule_name | default('replicated_rule') == '' else item.0.rule_name | default('replicated_rule') }} + {{ item.0.pg_num | default(osd_pool_default_pg_num) }} + {{ item.0.pgp_num | default(item.0.pg_num) | default(osd_pool_default_pg_num) }} + {{ 'replicated_rule' if not item.0.rule_name | default('replicated_rule') else item.0.rule_name | default('replicated_rule') }} {{ 1 if item.0.type|default(1) == 'replicated' else 3 if item.0.type|default(1) == 'erasure' else item.0.type|default(1) }} {%- if (item.0.type | default("1") == '3' or item.0.type | default("1") == 'erasure') and item.0.erasure_profile != '' %} {{ item.0.erasure_profile }} diff --git a/roles/ceph-rgw/tasks/main.yml b/roles/ceph-rgw/tasks/main.yml index 2d62cb372..e239c113c 100644 --- a/roles/ceph-rgw/tasks/main.yml +++ b/roles/ceph-rgw/tasks/main.yml @@ -27,7 +27,7 @@ - rgw_create_pools is defined block: - name: create rgw pools if rgw_create_pools is defined - command: "{{ docker_exec_cmd }} ceph --connect-timeout 5 --cluster {{ cluster }} osd pool create {{ item.key }} {{ item.value.pg_num }}" + command: "{{ docker_exec_cmd }} ceph --connect-timeout 5 --cluster {{ cluster }} osd pool create {{ item.key }} {{ item.value.pg_num | default(osd_pool_default_pg_num) }}" changed_when: false with_dict: "{{ rgw_create_pools }}" delegate_to: "{{ groups[mon_group_name][0] }}" diff --git a/tests/functional/centos/7/cluster/group_vars/all b/tests/functional/centos/7/cluster/group_vars/all index 37c6df130..e5342684a 100644 --- a/tests/functional/centos/7/cluster/group_vars/all +++ b/tests/functional/centos/7/cluster/group_vars/all @@ -14,8 +14,8 @@ nfs_ganesha_flavor: "ceph_master" openstack_config: True openstack_glance_pool: name: "images" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "HDD" type: 1 erasure_profile: "" @@ -23,8 +23,8 @@ openstack_glance_pool: size: 1 openstack_cinder_pool: name: "volumes" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "HDD" type: 1 erasure_profile: "" diff --git a/tests/functional/centos/7/cluster/group_vars/clients b/tests/functional/centos/7/cluster/group_vars/clients index 34e79cd76..b892f8024 100644 --- a/tests/functional/centos/7/cluster/group_vars/clients +++ b/tests/functional/centos/7/cluster/group_vars/clients @@ -3,8 +3,8 @@ copy_admin_key: True user_config: True test: name: "test" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "HDD" type: 1 erasure_profile: "" @@ -12,8 +12,8 @@ test: size: "{{ osd_pool_default_size }}" test2: name: "test2" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "HDD" type: 1 erasure_profile: "" diff --git a/tests/functional/centos/7/docker-collocation/group_vars/clients b/tests/functional/centos/7/docker-collocation/group_vars/clients index 0fcdc83f7..1131a16c5 100644 --- a/tests/functional/centos/7/docker-collocation/group_vars/clients +++ b/tests/functional/centos/7/docker-collocation/group_vars/clients @@ -2,16 +2,16 @@ user_config: True test: name: "test" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "HDD" type: 1 erasure_profile: "" expected_num_objects: "" test2: name: "test2" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "HDD" type: 1 erasure_profile: "" diff --git a/tests/functional/centos/7/docker/group_vars/all b/tests/functional/centos/7/docker/group_vars/all index ea1eaaa2e..f9582c127 100644 --- a/tests/functional/centos/7/docker/group_vars/all +++ b/tests/functional/centos/7/docker/group_vars/all @@ -18,8 +18,8 @@ ceph_conf_overrides: openstack_config: True openstack_glance_pool: name: "images" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "HDD" type: 1 erasure_profile: "" @@ -27,8 +27,8 @@ openstack_glance_pool: size: 1 openstack_cinder_pool: name: "volumes" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "HDD" type: 1 erasure_profile: "" diff --git a/tests/functional/centos/7/docker/group_vars/clients b/tests/functional/centos/7/docker/group_vars/clients index cbd665ce3..a8ea366d0 100644 --- a/tests/functional/centos/7/docker/group_vars/clients +++ b/tests/functional/centos/7/docker/group_vars/clients @@ -3,16 +3,16 @@ user_config: True copy_admin_key: True test: name: "test" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "HDD" type: 1 erasure_profile: "" expected_num_objects: "" test2: name: "test2" - pg_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" - pgp_num: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" + pg_num: "{{ osd_pool_default_pg_num }}" + pgp_num: "{{ osd_pool_default_pg_num }}" rule_name: "HDD" type: 1 erasure_profile: ""