diff options
author | Justin chi <chigang@huawei.com> | 2015-08-06 06:23:23 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-08-06 06:23:24 +0000 |
commit | 5aedf594112c0749b6e9039d15b9fe70d210a942 (patch) | |
tree | 9855abff580522e7eb048568f1dfb2ce39edcbe9 /deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml | |
parent | 4fb32751f9c8e82a729780fc5dedae71cecc32b6 (diff) | |
parent | 974a3c3bf5b71cd6b07c1b4b51044bc535ff4456 (diff) |
Merge "support deployment openstack juno with ansible for compass in ubuntu 14.04"
Diffstat (limited to 'deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml')
-rw-r--r-- | deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml new file mode 100644 index 00000000..d727b66b --- /dev/null +++ b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml @@ -0,0 +1,54 @@ +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: install cinder-volume and lvm2 packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" + with_items: packages + +- name: generate cinder volume service list + shell: echo {{ item }} >> /opt/service + with_items: services + +- name: check if physical device exists + stat: path={{ physical_device }} + register: st + +- name: repace physical_device if st is false + local_action: copy src=loop.yml dest=/tmp/loop.yml + when: st.stat.exists == False + +- name: load loop.yml + include_vars: /tmp/loop.yml + when: st.stat.exists == False + +- name: check if cinder-volumes is mounted + shell: ls /mnt + register: cindervolumes + +- name: get available partition size + shell: df / | awk '$3 ~ /[0-9]+/ { print $4 }' + register: partition_size + +- name: if not mounted, mount it + shell: dd if=/dev/zero of=/mnt/cinder-volumes + bs=1 count=0 seek={{ partition_size.stdout }} + when: cindervolumes.stdout != 'cinder-volumes' + +- name: get first lo device + shell: ls /dev/loop* | egrep 'loop[0-9]+'|sed -n 1p + register: first_lo + when: cindervolumes.stdout != 'cinder-volumes' + +- name: do a losetup on /mnt/cinder-volumes + shell: losetup {{ first_lo.stdout }} /mnt/cinder-volumes + when: cindervolumes.stdout != 'cinder-volumes' + +- name: create physical and group volumes + lvg: vg=cinder-volumes pvs={{ physical_device }} + vg_options=--force + +- name: upload cinder-volume configuration + template: src=cinder.conf dest=/etc/cinder/cinder.conf + backup=yes + notify: + - restart cinder-volume |