2 - name: install python-pip
\r
10 - name: install thin-provisioning-tools
\r
12 name: thin-provisioning-tools
\r
14 - name: install docker-compose
\r
16 name: docker-compose
\r
18 - name: copy opensds cinder backend file if specify cinder backend
\r
20 src: ../../../group_vars/cinder/cinder.yaml
\r
21 dest: "{{ cinder_config_path }}"
\r
23 - name: create directory to save source code and volume group file
\r
25 path: "{{ cinder_data_dir }}"
\r
29 - name: create volume group in thin mode
\r
32 function _create_lvm_volume_group {
\r
36 local backing_file={{ cinder_data_dir }}/${vg}.img
\r
37 if ! sudo vgs $vg; then
\r
38 # Only create if the file doesn't already exists
\r
39 [[ -f $backing_file ]] || truncate -s $size $backing_file
\r
41 vg_dev=`sudo losetup -f --show $backing_file`
\r
43 # Only create volume group if it doesn't already exist
\r
44 if ! sudo vgs $vg; then
\r
45 sudo vgcreate $vg $vg_dev
\r
49 modprobe dm_thin_pool
\r
50 _create_lvm_volume_group {{ cinder_volume_group }} 10G
\r
52 executable: /bin/bash
\r
55 - name: check for python-cinderclient source code existed
\r
57 path: "{{ cinder_data_dir }}/python-cinderclient"
\r
59 register: cinderclient_existed
\r
61 - name: download python-cinderclient source code
\r
63 repo: https://github.com/openstack/python-cinderclient.git
\r
64 dest: "{{ cinder_data_dir }}/python-cinderclient"
\r
66 - cinderclient_existed.stat.exists is undefined or cinderclient_existed.stat.exists == false
\r
68 # Tested successfully in this version `ab0185bfc6e8797a35a2274c2a5ee03afb03dd60`
\r
69 # git checkout -b ab0185bfc6e8797a35a2274c2a5ee03afb03dd60
\r
70 - name: pip install cinderclinet
\r
75 chdir: "{{ cinder_data_dir }}/python-cinderclient"
\r
77 - name: check for python-brick-cinderclient-ext source code existed
\r
79 path: "{{ cinder_data_dir }}/python-brick-cinderclient-ext"
\r
81 register: brick_existed
\r
83 - name: download python-brick-cinderclient-ext source code
\r
85 repo: https://github.com/openstack/python-brick-cinderclient-ext.git
\r
86 dest: "{{ cinder_data_dir }}/python-brick-cinderclient-ext"
\r
88 - brick_existed.stat.exists is undefined or brick_existed.stat.exists == false
\r
90 # Tested successfully in this version `a281e67bf9c12521ea5433f86cec913854826a33`
\r
91 # git checkout -b a281e67bf9c12521ea5433f86cec913854826a33
\r
92 - name: pip install python-brick-cinderclient-ext
\r
97 chdir: "{{ cinder_data_dir }}/python-brick-cinderclient-ext"
\r
100 - name: check for cinder source code existed
\r
102 path: "{{ cinder_data_dir }}/cinder"
\r
104 register: cinder_existed
\r
106 - name: download cinder source code
\r
108 repo: https://github.com/openstack/cinder.git
\r
109 dest: "{{ cinder_data_dir }}/cinder"
\r
111 - cinder_existed.stat.exists is undefined or cinder_existed.stat.exists == false
\r
113 # Tested successfully in this version `7bbc95344d3961d0bf059252723fa40b33d4b3fe`
\r
114 # git checkout -b 7bbc95344d3961d0bf059252723fa40b33d4b3fe
\r
115 - name: update blockbox configuration
\r
117 sed -i "s/PLATFORM ?= debian:stretch/PLATFORM ?= {{ cinder_container_platform }}/g" Makefile
\r
118 sed -i "s/TAG ?= debian-cinder:latest/TAG ?= {{ cinder_image_tag }}:latest/g" Makefile
\r
120 sed -i "s/image: debian-cinder/image: {{ cinder_image_tag }}/g" docker-compose.yml
\r
121 sed -i "s/image: lvm-debian-cinder/image: lvm-{{ cinder_image_tag }}/g" docker-compose.yml
\r
123 sed -i "s/volume_group = cinder-volumes /volume_group = {{ cinder_volume_group }}/g" etc/cinder.conf
\r
126 chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box"
\r
128 - name: make blockbox
\r
129 shell: make blockbox
\r
132 chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box"
\r
134 - name: start cinder-standalone service
\r
135 shell: docker-compose up -d
\r
138 chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box"
\r
140 - name: wait for cinder service to start normally
\r