Use ceph_adm node to create global config 55/8755/1
authorgrakiss <grakiss.wanglei@huawei.com>
Sat, 16 Jan 2016 08:55:17 +0000 (16:55 +0800)
committerJustin chi <chigang@huawei.com>
Sat, 30 Jan 2016 05:16:47 +0000 (05:16 +0000)
JIRA: COMPASS-276
  - use ceph_adm for global config

Change-Id: I9229699909aff6ba0f0f429e8a883746cf37e5dc
Signed-off-by: grakiss <grakiss.wanglei@huawei.com>
(cherry picked from commit 36ab89d5ddcd76c2bf7c7db5e6d60887ae44b12f)

deploy/adapters/ansible/roles/ceph-config/tasks/create_config.yml
deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_pre.yml

index 0822239..2ef9b0c 100755 (executable)
@@ -1,14 +1,14 @@
 - name: gen ceph fsid
   shell: uuidgen
   register: ceph_fsid
-  run_once: true
+  when: inventory_hostname in groups['ceph_adm']
 
 - name: gen ceph conf
   local_action:
     module: "template"
     src: "ceph.j2"
     dest: "/tmp/ceph.conf"
-  run_once: true
+  when: inventory_hostname in groups['ceph_adm']
 
 - name: "make directory for ceph config file"
   file: path="/etc/ceph" state="directory"
@@ -23,7 +23,7 @@
 
 - name: gen create monmap script
   local_action: template src="create_monmap.j2" dest="/tmp/create_monmap.sh" mode=0755
-  run_once: true
+  when: inventory_hostname in groups['ceph_adm']
 
 - name: create monmap
   script: /tmp/create_monmap.sh
 
 - name: create mon.keyring
   shell: "ceph-authtool --create-keyring /tmp/ceph.mon.keyring --gen-key -n mon. --cap mon 'allow *'"
-  when: inventory_hostname == groups['ceph_mon'][0]
+  when: inventory_hostname in groups['ceph_adm']
 
 - name: create admin.keyring
   shell: "ceph-authtool --create-keyring /etc/ceph/ceph.client.admin.keyring --gen-key -n client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow'"
-  when: inventory_hostname == groups['ceph_mon'][0]
+  when: inventory_hostname in groups['ceph_adm']
+
 - name: Add the client.admin key to the ceph.mon.keyring
   shell: "ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/ceph.client.admin.keyring"
-  when: inventory_hostname == groups['ceph_mon'][0]
+  when: inventory_hostname in groups['ceph_adm']
 
 - name: fetch mon.keyring to local
   fetch: src="/tmp/ceph.mon.keyring" dest="/tmp/ceph.mon.keyring" flat=yes
-  when: inventory_hostname == groups['ceph_mon'][0]
+  when: inventory_hostname in groups['ceph_adm']
 
 - name: fetch client.admin.keyring to local
   fetch: src="/etc/ceph/ceph.client.admin.keyring" dest="/tmp/ceph.client.admin.keyring" flat=yes
-  when: inventory_hostname == groups['ceph_mon'][0]
+  when: inventory_hostname in groups['ceph_adm']
 
 - name: copy mon.keyring to remote nodes
   copy: src="/tmp/ceph.mon.keyring" dest="/tmp/ceph.mon.keyring"
index 8433d7c..12afa7b 100755 (executable)
@@ -2,7 +2,7 @@
 - name: gen ceph uuid
   shell: uuidgen
   register: ceph_uuid
-  run_once: True
+  run_once: true
   tags:
     - ceph_copy_secret
 
@@ -12,7 +12,7 @@
     src: "secret.j2"
     dest: "/tmp/secret.xml"
     mode: "0777"
-  run_once: True
+  when: inventory_hostname in groups['ceph_adm']
   tags:
     - ceph_copy_secret
 
     - images
     - backups
     - vms
-  run_once: True
+  when: inventory_hostname in groups['ceph_adm']
+
 - name: create ceph users for openstack
   shell: ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images' && ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'
-  run_once: True
+  when: inventory_hostname in groups['ceph_adm']
 
 - name: send glance key to controller nodes
   shell: ceph auth get-or-create client.glance | tee /etc/ceph/ceph.client.glance.keyring && chown glance:glance /etc/ceph/ceph.client.glance.keyring 
@@ -35,7 +35,7 @@
 
 - name: send cinder key to compute nodes
   shell: ceph auth get-or-create client.cinder | tee /etc/ceph/ceph.client.cinder.keyring && chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring
-  when: inventory_hostname in groups['compute']  
+  when: inventory_hostname in groups['compute']
   tags:
     - ceph_send_key