From: Guillaume Abrioux Date: Wed, 4 Oct 2017 06:58:03 +0000 (+0200) Subject: iscsi-gw: Create a rbd pool if it doesn't exist X-Git-Tag: v3.0.0rc16^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8fac8f54a67f58b5a0882ded17def90003c729c6;p=ceph-ansible.git iscsi-gw: Create a rbd pool if it doesn't exist iscsi-gw needs a 'rbd' pool to configure iscsi target. Note: I could have used the facts already set in `ceph-mon` but I voluntarily didn't do it to not create a dependancy between these two roles. Signed-off-by: Guillaume Abrioux --- diff --git a/roles/ceph-iscsi-gw/tasks/configure_iscsi.yml b/roles/ceph-iscsi-gw/tasks/configure_iscsi.yml index 4138b0c49..22ec4d396 100644 --- a/roles/ceph-iscsi-gw/tasks/configure_iscsi.yml +++ b/roles/ceph-iscsi-gw/tasks/configure_iscsi.yml @@ -1,4 +1,19 @@ --- +- name: check if a rbd pool exists + command: ceph --cluster {{ cluster }} osd pool ls --format json + register: rbd_pool_exists + +- name: get default value for osd_pool_default_pg_num + command: ceph --cluster {{ cluster }} daemon mon.{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} config get osd_pool_default_pg_num + register: osd_pool_default_pg_num + when: "'rbd' not in (rbd_pool_exists.stdout | from_json)" + delegate_to: "{{ groups[mon_group_name][0] }}" + +- name: create a rbd pool if it doesn't exist + command: ceph --cluster {{ cluster }} osd pool create rbd {{ (osd_pool_default_pg_num.stdout | from_json).osd_pool_default_pg_num }} + when: "'rbd' not in (rbd_pool_exists.stdout | from_json)" + delegate_to: "{{ groups[mon_group_name][0] }}" + - name: igw_gateway (tgt) | configure iscsi target (gateway) igw_gateway: mode: "target"