3 - name: install python-pip
11 - name: install thin-provisioning-tools
13 name: thin-provisioning-tools
15 - name: install docker-compose
19 - name: copy opensds cinder backend file if specify cinder backend
21 src: ../../../group_vars/cinder/cinder.yaml
22 dest: "{{ cinder_config_path }}"
24 - name: create directory to save source code and volume group file
26 path: "{{ cinder_data_dir }}"
30 - name: create volume group in thin mode
33 function _create_lvm_volume_group {
37 local backing_file={{ cinder_data_dir }}/${vg}.img
38 if ! sudo vgs $vg; then
39 # Only create if the file doesn't already exists
40 [[ -f $backing_file ]] || truncate -s $size $backing_file
42 vg_dev=`sudo losetup -f --show $backing_file`
44 # Only create volume group if it doesn't already exist
45 if ! sudo vgs $vg; then
46 sudo vgcreate $vg $vg_dev
51 _create_lvm_volume_group {{ cinder_volume_group }} 10G
56 - name: check for python-cinderclient source code existed
58 path: "{{ cinder_data_dir }}/python-cinderclient"
60 register: cinderclient_existed
62 - name: download python-cinderclient source code
64 repo: https://github.com/openstack/python-cinderclient.git
65 dest: "{{ cinder_data_dir }}/python-cinderclient"
67 - cinderclient_existed.stat.exists is undefined or cinderclient_existed.stat.exists == false
69 # Tested successfully in this version `ab0185bfc6e8797a35a2274c2a5ee03afb03dd60`
70 # git checkout -b ab0185bfc6e8797a35a2274c2a5ee03afb03dd60
71 - name: pip install cinderclinet
76 chdir: "{{ cinder_data_dir }}/python-cinderclient"
78 - name: check for python-brick-cinderclient-ext source code existed
80 path: "{{ cinder_data_dir }}/python-brick-cinderclient-ext"
82 register: brick_existed
84 - name: download python-brick-cinderclient-ext source code
86 repo: https://github.com/openstack/python-brick-cinderclient-ext.git
87 dest: "{{ cinder_data_dir }}/python-brick-cinderclient-ext"
89 - brick_existed.stat.exists is undefined or brick_existed.stat.exists == false
91 # Tested successfully in this version `a281e67bf9c12521ea5433f86cec913854826a33`
92 # git checkout -b a281e67bf9c12521ea5433f86cec913854826a33
93 - name: pip install python-brick-cinderclient-ext
98 chdir: "{{ cinder_data_dir }}/python-brick-cinderclient-ext"
101 - name: check for cinder source code existed
103 path: "{{ cinder_data_dir }}/cinder"
105 register: cinder_existed
107 - name: download cinder source code
109 repo: https://github.com/openstack/cinder.git
110 dest: "{{ cinder_data_dir }}/cinder"
112 - cinder_existed.stat.exists is undefined or cinder_existed.stat.exists == false
114 # Tested successfully in this version `7bbc95344d3961d0bf059252723fa40b33d4b3fe`
115 # git checkout -b 7bbc95344d3961d0bf059252723fa40b33d4b3fe
116 - name: update blockbox configuration
118 sed -i "s/PLATFORM ?= debian:stretch/PLATFORM ?= {{ cinder_container_platform }}/g" Makefile
119 sed -i "s/TAG ?= debian-cinder:latest/TAG ?= {{ cinder_image_tag }}:latest/g" Makefile
121 sed -i "s/image: debian-cinder/image: {{ cinder_image_tag }}/g" docker-compose.yml
122 sed -i "s/image: lvm-debian-cinder/image: lvm-{{ cinder_image_tag }}/g" docker-compose.yml
124 sed -i "s/volume_group = cinder-volumes /volume_group = {{ cinder_volume_group }}/g" etc/cinder.conf
127 chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box"
129 - name: make blockbox
133 chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box"
135 - name: start cinder-standalone service
136 shell: docker-compose up -d
139 chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box"
141 - name: wait for cinder service to start normally