]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
client: fix pgs num for client pool creation
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 26 Feb 2018 15:03:30 +0000 (16:03 +0100)
committerSébastien Han <seb@redhat.com>
Wed, 7 Mar 2018 10:18:04 +0000 (11:18 +0100)
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>
group_vars/clients.yml.sample
roles/ceph-client/defaults/main.yml
roles/ceph-client/tasks/create_users_keys.yml

index f29b23a71f976d09ed1f97ec46db83fa3dd324c2..40bf811ac869cc9e1db1d31bfa71c0926ad6ed5c 100644 (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:
index 396bcd0ab21963cf3c12d85efd82644ad29962b7..0c538e5145c01d0e18f96a72e812504d7e8b573d 100644 (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:
index ec8f722d30623e0a3b7e3bcfa7a3ab4df0d8e5a8..5fa4fe94fd8681d6303b9ac49fa4f9c629a8f4db 100644 (file)
     - 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