support repeatly create secret key for ceph deploy 47/2547/3
authorgrakiss <grakiss.wanglei@huawei.com>
Thu, 15 Oct 2015 06:29:58 +0000 (14:29 +0800)
committergrakiss <grakiss.wanglei@huawei.com>
Tue, 27 Oct 2015 10:51:21 +0000 (18:51 +0800)
JIRA: COMPASS-101
  - undefine libvirt secret before creating new one

Change-Id: Ideb68cfbb31a6cddfcb15c7b15aa762e5632f8da
Signed-off-by: grakiss <grakiss.wanglei@huawei.com>
deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_pre.yml

index 52e54cb..d0ee7e2 100644 (file)
@@ -1,7 +1,7 @@
 ---
 
 - name: create pool
-  shell: ceph osd pool create {{ item }} 80
+  shell: ceph osd pool create {{ item }} 50
   with_items:
     - volumes
     - images
   tags:
     - ceph_copy_secret
 
+- name: undefine libvirt secret in case of repeatedly execute ceph_deploy
+  shell: ssh -o StrictHostKeyChecking=no -t {{ item }}  "virsh secret-list | awk '\$1 ~ /[0-9]+/ {print \$1}' | xargs virsh secret-undefine"
+  with_items:
+    - "{{ groups['compute'] }}"
+  tags:
+    - ceph_copy_secret
+  ignore_errors: True
+
+
 - name: create key for libvirt on compute nodes
-  shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "virsh secret-define --file secret.xml && virsh secret-set-value --secret {{ ceph_uuid.stdout_lines[0] }} --base64 \$(cat client.cinder.key) && rm client.cinder.key secret.xml"
+  shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "virsh secret-define --file secret.xml && virsh secret-set-value --secret {{ ceph_uuid.stdout_lines[0] }} --base64 $(cat client.cinder.key)"
   with_items:
     - "{{ groups['compute'] }}"
   tags: