client: fix pgs num for client pool creation

The `pools` dict defined in `roles/ceph-client/defaults/main.yml`
shouldn't have `{{ ceph_conf_overrides.global.osd_pool_default_pg_num
}}` as default value for `pgs` keys.

For instance, if you want some pools to be created but without explicitely
specifying the pgs for these pools (it means you want to use the
`osd_pool_default_pg_num`), you will be obliged to define
`{{ ceph_conf_overrides.global.osd_pool_default_pg_num }}` anyway while you
wanted to use the current default value already defined in the cluster which is
retrieved early in the playbook and stored in the
`{{ osd_pool_default_pg_num }}` fact.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/2436/head
Guillaume Abrioux 2018-02-26 16:03:30 +01:00 committed by Sébastien Han
parent 96c049be5b
commit 9181c94adf
3 changed files with 5 additions and 6 deletions

View File

@ -15,8 +15,8 @@ dummy:
#user_config: false
#pools:
# - { name: test, pgs: "{{ ceph_conf_overrides.global.osd_pool_default_pg_num }}" }
# - { name: test2, pgs: "{{ ceph_conf_overrides.global.osd_pool_default_pg_num }}" }
# - { name: test, pgs: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" }
# - { name: test2, pgs: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" }
# Can add `mds_cap` attribute to override the default value which is '' for mds capabilities.
# To have have ansible setfacl the generated key for $user, set the acls var like so:

View File

@ -7,8 +7,8 @@ copy_admin_key: false
user_config: false
pools:
- { name: test, pgs: "{{ ceph_conf_overrides.global.osd_pool_default_pg_num }}" }
- { name: test2, pgs: "{{ ceph_conf_overrides.global.osd_pool_default_pg_num }}" }
- { name: test, pgs: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" }
- { name: test2, pgs: "{{ hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num'] }}" }
# Can add `mds_cap` attribute to override the default value which is '' for mds capabilities.
# To have have ansible setfacl the generated key for $user, set the acls var like so:

View File

@ -46,12 +46,11 @@
- copy_admin_key
- name: create pools
command: "{{ docker_exec_client_cmd }} --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.pgs }}"
command: "{{ docker_exec_client_cmd }} --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.get('pgs', hostvars[groups[mon_group_name][0]]['osd_pool_default_pg_num']) }}"
with_items: "{{ pools }}"
changed_when: false
failed_when: false
when:
- ceph_conf_overrides.get('global', {}).get('osd_pool_default_pg_num', False) != False
- pools | length > 0
- copy_admin_key