From 2616357bbf1d5cfc1f7e3923e12b8adfc5627fc6 Mon Sep 17 00:00:00 2001 From: grakiss Date: Wed, 13 Jan 2016 14:59:11 +0800 Subject: deploy CEPH nodes parallelly JIRA:COMPASS-264 - do not use ceph-deploy - do not need centeral node to deploy ceph Change-Id: I0f9c459060a2fccbad73a323697ec23ea2115410 Signed-off-by: grakiss --- .../ceph-openstack/tasks/ceph_openstack_pre.yml | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_pre.yml (limited to 'deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_pre.yml') diff --git a/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_pre.yml b/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_pre.yml new file mode 100755 index 00000000..8433d7cb --- /dev/null +++ b/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_pre.yml @@ -0,0 +1,69 @@ +--- +- name: gen ceph uuid + shell: uuidgen + register: ceph_uuid + run_once: True + tags: + - ceph_copy_secret + +- name: gen template secret.xml + local_action: + module: "template" + src: "secret.j2" + dest: "/tmp/secret.xml" + mode: "0777" + run_once: True + tags: + - ceph_copy_secret + +- name: create pool + shell: ceph osd pool create {{ item }} 50 + with_items: + - volumes + - images + - backups + - vms + run_once: True + +- 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 + +- 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 + when: inventory_hostname in groups['controller'] + +- 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'] + tags: + - ceph_send_key + +- name: copy cinder key to compute node + shell: ceph auth get-key client.cinder | tee client.cinder.key + when: inventory_hostname in groups['compute'] + tags: + - ceph_copy_secret + +- name: copy secret.xml to compute nodes + copy: src="/tmp/secret.xml" dest="~/secret.xml" + when: inventory_hostname in groups['compute'] + tags: + - ceph_copy_secret + +- name: undefine libvirt secret in case of repeatedly execute ceph_deploy + shell: "virsh secret-list | awk '$1 ~ /[0-9]+/ {print $1}' | xargs virsh secret-undefine" + when: inventory_hostname in groups['compute'] + tags: + - ceph_copy_secret + ignore_errors: True + + +- name: create key for libvirt on compute nodes + shell: "virsh secret-define --file ~/secret.xml && virsh secret-set-value --secret {{ ceph_uuid.stdout_lines[0] }} --base64 $(cat client.cinder.key)" + when: inventory_hostname in groups['compute'] + tags: + - ceph_copy_secret + ignore_errors: True + + -- cgit 1.2.3-korg