aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/ceph-openstack/tasks
diff options
context:
space:
mode:
authorliyuenan <liyuenan@huawei.com>2016-12-27 17:44:34 +0800
committerliyuenan <liyuenan@huawei.com>2017-01-05 09:42:35 +0800
commit92f6ca7bb6d7b2f295406aab34094b1dba76ff94 (patch)
treec4e62927a3bf9862f7ba9ce286cbece2c4335ef4 /deploy/adapters/ansible/roles/ceph-openstack/tasks
parent6072a49adb33f2bce3f48b9c7b8be7d96cf8501c (diff)
Yamllint test
JIRA: COMPASS-516 Change-Id: I482ce9bc86f4f963258c5b8823e0b00e83556eef Signed-off-by: liyuenan <liyuenan@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/ceph-openstack/tasks')
-rwxr-xr-xdeploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_conf.yml98
-rw-r--r--deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_post.yml1
-rwxr-xr-xdeploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_pre.yml32
-rw-r--r--deploy/adapters/ansible/roles/ceph-openstack/tasks/main.yml1
4 files changed, 115 insertions, 17 deletions
diff --git a/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_conf.yml b/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_conf.yml
index 0496ba97..84515267 100755
--- a/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_conf.yml
+++ b/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_conf.yml
@@ -12,29 +12,113 @@
when: inventory_hostname in groups['controller']
tags:
- ceph_conf_glance
- ignore_errors: True
+ ignore_errors: "True"
- name: modify glance-api.conf for ceph
- shell: sed -i 's/^\(default_store\).*/\1 = rbd/g' /etc/glance/glance-api.conf && sed -i '/^\[glance_store/a rbd_store_pool = images\nrbd_store_user = glance\nrbd_store_ceph_conf = /etc/ceph/ceph.conf\nrbd_store_chunk_size = 8\nshow_image_direct_url=True' /etc/glance/glance-api.conf
+ shell: |
+ sed -i 's/^\(default_store\).*/\1 = rbd/g' /etc/glance/glance-api.conf;
+ sed -i '/^\[glance_store/a rbd_store_pool = images' \
+ /etc/glance/glance-api.conf;
+ sed -i '/^\[glance_store/a rbd_store_user = glance' \
+ /etc/glance/glance-api.conf;
+ sed -i '/^\[glance_store/a rbd_store_ceph_conf = /etc/ceph/ceph.conf' \
+ /etc/glance/glance-api.conf;
+ sed -i '/^\[glance_store/a rbd_store_chunk_size = 8' \
+ /etc/glance/glance-api.conf;
+ sed -i '/^\[glance_store/a show_image_direct_url=True' \
+ /etc/glance/glance-api.conf;
when: inventory_hostname in groups['controller']
tags:
- ceph_conf_glance
-- name: restart glance
- shell: rm -f /var/log/glance/api.log && chown -R glance:glance /var/log/glance && service {{ glance_service }} restart
+- name: remove glance-api log
+ shell: |
+ rm -f /var/log/glance/api.log;
+ chown -R glance:glance /var/log/glance;
+ when: inventory_hostname in groups['controller']
+ tags:
+ - ceph_conf_glance
+ ignore_errors: "True"
+
+- name: restart glance service
+ shell: service {{ glance_service }} restart
+ register: result
+ until: result.rc == 0
+ retries: 10
+ delay: 3
when: inventory_hostname in groups['controller']
tags:
- ceph_conf_glance
- ignore_errors: True
- name: modify cinder.conf for ceph
- shell: sed -i 's/^\(volume_driver\).*/\1 = cinder.volume.drivers.rbd.RBDDriver/g' /etc/cinder/cinder.conf && sed -i 's/^\(rbd_secret_uuid\).*/\1 = {{ ceph_uuid }}/g' /etc/cinder/cinder.conf && sed -i '/^\[DEFAULT/a rbd_pool = volumes\nrbd_ceph_conf = /etc/ceph/ceph.conf\nrbd_flatten_volume_from_snapshot = false\nrbd_max_clone_depth = 5\nrbd_store_chunk_size = 4\nrados_connect_timeout = -1\nglance_api_version = 2\nrbd_user = cinder\nrbd_secret_uuid = {{ ceph_uuid }}' /etc/cinder/cinder.conf && service {{ cinder_service }} restart
+ shell: |
+ sed -i 's/^\(volume_driver\).*/\1 = cinder.volume.drivers.rbd.RBDDriver/g' \
+ /etc/cinder/cinder.conf;
+ sed -i 's/^\(rbd_secret_uuid\).*/\1 = {{ ceph_uuid }}/g' \
+ /etc/cinder/cinder.conf;
+ sed -i '/^\[DEFAULT/a rbd_pool = volumes' \
+ /etc/cinder/cinder.conf;
+ sed -i '/^\[DEFAULT/a rbd_ceph_conf = /etc/ceph/ceph.conf' \
+ /etc/cinder/cinder.conf;
+ sed -i '/^\[DEFAULT/a rbd_flatten_volume_from_snapshot = false' \
+ /etc/cinder/cinder.conf;
+ sed -i '/^\[DEFAULT/a rbd_max_clone_depth = 5' \
+ /etc/cinder/cinder.conf;
+ sed -i '/^\[DEFAULT/a rbd_store_chunk_size = 4' \
+ /etc/cinder/cinder.conf;
+ sed -i '/^\[DEFAULT/a rados_connect_timeout = -1' \
+ /etc/cinder/cinder.conf;
+ sed -i '/^\[DEFAULT/a glance_api_version = 2' \
+ /etc/cinder/cinder.conf;
+ sed -i '/^\[DEFAULT/a rbd_user = cinder' \
+ /etc/cinder/cinder.conf;
+ sed -i '/^\[DEFAULT/a rbd_secret_uuid = {{ ceph_uuid }}' \
+ /etc/cinder/cinder.conf;
+ when: inventory_hostname in groups['compute']
+ tags:
+ - ceph_conf_cinder
+
+- name: restart cinder service
+ shell: service {{ cinder_service }} restart
+ register: result
+ until: result.rc == 0
+ retries: 10
+ delay: 3
when: inventory_hostname in groups['compute']
tags:
- ceph_conf_cinder
- name: modify nova.conf for ceph
- shell: sed -i 's/^\(images_type\).*/\1 = rbd/g' /etc/nova/nova-compute.conf && sed -i 's/^\(rbd_secret_uuid\).*/\1 = {{ ceph_uuid }}/g' /etc/nova/nova-compute.conf && sed -i '/^\[libvirt/a images_rbd_pool = vms\nimages_rbd_ceph_conf = /etc/ceph/ceph.conf\nrbd_user = cinder\nrbd_secret_uuid = {{ ceph_uuid }}\ndisk_cachemodes=\"network=writeback\"\nlive_migration_flag=\"VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST,VIR_MIGRATE_TUNNELLED\"' /etc/nova/nova-compute.conf && service {{ nova_service }} restart
+ shell: |
+ sed -i 's/^\(images_type\).*/\1 = rbd/g' \
+ /etc/nova/nova-compute.conf;
+ sed -i 's/^\(rbd_secret_uuid\).*/\1 = {{ ceph_uuid }}/g' \
+ /etc/nova/nova-compute.conf;
+ when: inventory_hostname in groups['compute']
+ tags:
+ - ceph_conf_nova
+
+- name: modify nova.conf libvirt for ceph
+ blockinfile:
+ dest: /etc/nova/nova-compute.conf
+ insertafter: "libvirt"
+ block: |
+ images_rbd_pool = vms
+ images_rbd_ceph_conf = /etc/ceph/ceph.conf
+ rbd_user = cinder
+ rbd_secret_uuid = {{ ceph_uuid }}
+ disk_cachemodes = "network=writeback"
+ live_migration_flag = "{{ live_migration_flag | join(',') }}"
+ when: inventory_hostname in groups['compute']
+ tags:
+ - ceph_conf_nova
+
+- name: restart nova service
+ shell: service {{ nova_service }} restart
+ register: result
+ until: result.rc == 0
+ retries: 10
+ delay: 3
when: inventory_hostname in groups['compute']
tags:
- ceph_conf_nova
diff --git a/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_post.yml b/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_post.yml
index 2097ca57..b7ec4a23 100644
--- a/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_post.yml
+++ b/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_post.yml
@@ -16,4 +16,3 @@
umount /var/lib/glance/images
sed -i '/\/var\/lib\/glance\/images/d' /etc/fstab
when: mount_info.stdout.find('images') != -1
-
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
index ece4154f..3ff9df48 100755
--- a/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_pre.yml
+++ b/deploy/adapters/ansible/roles/ceph-openstack/tasks/ceph_openstack_pre.yml
@@ -62,15 +62,26 @@
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'
+ 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';
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
+ 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
+ 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
@@ -88,18 +99,21 @@
- 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"
+ 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
+ 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 }} --base64 $(cat client.cinder.key)"
+ shell: |
+ virsh secret-define --file ~/secret.xml;
+ virsh secret-set-value --secret {{ ceph_uuid }} \
+ --base64 $(cat client.cinder.key);
when: inventory_hostname in groups['compute']
tags:
- ceph_copy_secret
- ignore_errors: True
-
-
+ ignore_errors: "True"
diff --git a/deploy/adapters/ansible/roles/ceph-openstack/tasks/main.yml b/deploy/adapters/ansible/roles/ceph-openstack/tasks/main.yml
index 06c3acb6..c34d1376 100644
--- a/deploy/adapters/ansible/roles/ceph-openstack/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/ceph-openstack/tasks/main.yml
@@ -1,3 +1,4 @@
+---
##############################################################################
# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
#