From a13094b88863dda79434b90e23054467cbf2f85a Mon Sep 17 00:00:00 2001 From: Paulo Matias Date: Wed, 21 Sep 2016 09:21:41 -0300 Subject: [PATCH] Allow deployer to customize openstack pools By overriding the openstack_pools variable introduced by this commit, the deployer may choose not to create some of the openstack pools, or to add new pools which were not foreseen by ceph-ansible, e.g. for a gnocchi storage backend. For backwards compatibility, we keep the openstack_glance_pool, openstack_cinder_pool, openstack_nova_pool and openstack_cinder_backup_pool variables, although the user may now choose to specify the pools directly as dictionary literals inside the openstack_pools list. --- group_vars/mons.sample | 6 ++++++ roles/ceph-mon/defaults/main.yml | 6 ++++++ roles/ceph-mon/tasks/openstack_config.yml | 8 ++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/group_vars/mons.sample b/group_vars/mons.sample index 689734990..e4ea4d434 100644 --- a/group_vars/mons.sample +++ b/group_vars/mons.sample @@ -61,6 +61,12 @@ dummy: # name: backups # pg_num: "{{ pool_default_pg_num }}" +#openstack_pools: +# - "{{ openstack_glance_pool }}" +# - "{{ openstack_cinder_pool }}" +# - "{{ openstack_nova_pool }}" +# - "{{ openstack_cinder_backup_pool }}" + #openstack_keys: # - { name: client.glance, value: "mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool={{ openstack_glance_pool.name }}'" } # - { name: client.cinder, value: "mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool={{ openstack_cinder_pool.name }}, allow rwx pool={{ openstack_nova_pool.name }}, allow rx pool={{ openstack_glance_pool.name }}'" } diff --git a/roles/ceph-mon/defaults/main.yml b/roles/ceph-mon/defaults/main.yml index 8a7f20ad2..0737ef3ea 100644 --- a/roles/ceph-mon/defaults/main.yml +++ b/roles/ceph-mon/defaults/main.yml @@ -53,6 +53,12 @@ openstack_cinder_backup_pool: name: backups pg_num: "{{ pool_default_pg_num }}" +openstack_pools: + - "{{ openstack_glance_pool }}" + - "{{ openstack_cinder_pool }}" + - "{{ openstack_nova_pool }}" + - "{{ openstack_cinder_backup_pool }}" + openstack_keys: - { name: client.glance, value: "mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool={{ openstack_glance_pool.name }}'" } - { name: client.cinder, value: "mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool={{ openstack_cinder_pool.name }}, allow rwx pool={{ openstack_nova_pool.name }}, allow rx pool={{ openstack_glance_pool.name }}'" } diff --git a/roles/ceph-mon/tasks/openstack_config.yml b/roles/ceph-mon/tasks/openstack_config.yml index d0d39ca52..02b21272e 100644 --- a/roles/ceph-mon/tasks/openstack_config.yml +++ b/roles/ceph-mon/tasks/openstack_config.yml @@ -1,11 +1,7 @@ --- - name: create openstack pool command: ceph --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.pg_num }} - with_items: - - "{{ openstack_glance_pool }}" - - "{{ openstack_cinder_pool }}" - - "{{ openstack_nova_pool }}" - - "{{ openstack_cinder_backup_pool }}" + with_items: "{{ openstack_pools }}" changed_when: false failed_when: false @@ -13,6 +9,6 @@ command: ceph --cluster {{ cluster }} auth get-or-create {{ item.name }} {{ item.value }} -o /etc/ceph/{{ cluster }}.{{ item.name }}.keyring args: creates: /etc/ceph/{{ cluster }}.{{ item.name }}.keyring - with_items: openstack_keys + with_items: "{{ openstack_keys }}" changed_when: false when: cephx