diff options
author | leonwang <wanghui71@huawei.com> | 2018-03-15 08:25:05 +0000 |
---|---|---|
committer | leonwang <wanghui71@huawei.com> | 2018-03-15 08:39:22 +0000 |
commit | 6bc7e08cc5d80941c80e8d36d3a2b1373f147a05 (patch) | |
tree | 3e236cfc1f4ce35ad8ab09843010d16010da4054 /ci/ansible/roles/osdsdock/scenarios/cinder_standalone.yml | |
parent | 6018fcdd41c2074b2c94d8033f1434be028b054b (diff) |
Merge nbp installation into opensds ansible script
In this update, the nbp-ansible is removed from stor4nfv repo and
all code has been merged into ansible repo. Besides, the latest
update reduce a lot of work to download and build opensds source
code. And some installation docs are also updated.
Remove license statement for the moment.
Change-Id: Ib8504d96e2d41e1c3ab7e0c94689111679d56abd
Signed-off-by: leonwang <wanghui71@huawei.com>
Diffstat (limited to 'ci/ansible/roles/osdsdock/scenarios/cinder_standalone.yml')
-rw-r--r-- | ci/ansible/roles/osdsdock/scenarios/cinder_standalone.yml | 291 |
1 files changed, 145 insertions, 146 deletions
diff --git a/ci/ansible/roles/osdsdock/scenarios/cinder_standalone.yml b/ci/ansible/roles/osdsdock/scenarios/cinder_standalone.yml index 7bf2b97..49f4063 100644 --- a/ci/ansible/roles/osdsdock/scenarios/cinder_standalone.yml +++ b/ci/ansible/roles/osdsdock/scenarios/cinder_standalone.yml @@ -1,146 +1,145 @@ ---- - -- name: install python-pip - apt: - name: python-pip - -- name: install lvm2 - apt: - name: lvm2 - -- name: install thin-provisioning-tools - apt: - name: thin-provisioning-tools - -- name: install docker-compose - pip: - name: docker-compose - -- name: copy opensds cinder backend file if specify cinder backend - copy: - src: ../../../group_vars/cinder/cinder.yaml - dest: "{{ cinder_config_path }}" - -- name: create directory to save source code and volume group file - file: - path: "{{ cinder_data_dir }}" - state: directory - recurse: yes - -- name: create volume group in thin mode - shell: - _raw_params: | - function _create_lvm_volume_group { - local vg=$1 - local size=$2 - - local backing_file={{ cinder_data_dir }}/${vg}.img - if ! sudo vgs $vg; then - # Only create if the file doesn't already exists - [[ -f $backing_file ]] || truncate -s $size $backing_file - local vg_dev - vg_dev=`sudo losetup -f --show $backing_file` - - # Only create volume group if it doesn't already exist - if ! sudo vgs $vg; then - sudo vgcreate $vg $vg_dev - fi - fi - } - modprobe dm_thin_pool - _create_lvm_volume_group {{ cinder_volume_group }} 10G - args: - executable: /bin/bash - become: true - -- name: check for python-cinderclient source code existed - stat: - path: "{{ cinder_data_dir }}/python-cinderclient" - ignore_errors: yes - register: cinderclient_existed - -- name: download python-cinderclient source code - git: - repo: https://github.com/openstack/python-cinderclient.git - dest: "{{ cinder_data_dir }}/python-cinderclient" - when: - - cinderclient_existed.stat.exists is undefined or cinderclient_existed.stat.exists == false - -# Tested successfully in this version `ab0185bfc6e8797a35a2274c2a5ee03afb03dd60` -# git checkout -b ab0185bfc6e8797a35a2274c2a5ee03afb03dd60 -- name: pip install cinderclinet - shell: | - pip install -e . - become: true - args: - chdir: "{{ cinder_data_dir }}/python-cinderclient" - -- name: check for python-brick-cinderclient-ext source code existed - stat: - path: "{{ cinder_data_dir }}/python-brick-cinderclient-ext" - ignore_errors: yes - register: brick_existed - -- name: download python-brick-cinderclient-ext source code - git: - repo: https://github.com/openstack/python-brick-cinderclient-ext.git - dest: "{{ cinder_data_dir }}/python-brick-cinderclient-ext" - when: - - brick_existed.stat.exists is undefined or brick_existed.stat.exists == false - -# Tested successfully in this version `a281e67bf9c12521ea5433f86cec913854826a33` -# git checkout -b a281e67bf9c12521ea5433f86cec913854826a33 -- name: pip install python-brick-cinderclient-ext - shell: | - pip install -e . - become: true - args: - chdir: "{{ cinder_data_dir }}/python-brick-cinderclient-ext" - - -- name: check for cinder source code existed - stat: - path: "{{ cinder_data_dir }}/cinder" - ignore_errors: yes - register: cinder_existed - -- name: download cinder source code - git: - repo: https://github.com/openstack/cinder.git - dest: "{{ cinder_data_dir }}/cinder" - when: - - cinder_existed.stat.exists is undefined or cinder_existed.stat.exists == false - -# Tested successfully in this version `7bbc95344d3961d0bf059252723fa40b33d4b3fe` -# git checkout -b 7bbc95344d3961d0bf059252723fa40b33d4b3fe -- name: update blockbox configuration - shell: | - sed -i "s/PLATFORM ?= debian:stretch/PLATFORM ?= {{ cinder_container_platform }}/g" Makefile - sed -i "s/TAG ?= debian-cinder:latest/TAG ?= {{ cinder_image_tag }}:latest/g" Makefile - - sed -i "s/image: debian-cinder/image: {{ cinder_image_tag }}/g" docker-compose.yml - sed -i "s/image: lvm-debian-cinder/image: lvm-{{ cinder_image_tag }}/g" docker-compose.yml - - sed -i "s/volume_group = cinder-volumes /volume_group = {{ cinder_volume_group }}/g" etc/cinder.conf - become: true - args: - chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box" - -- name: make blockbox - shell: make blockbox - become: true - args: - chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box" - -- name: start cinder-standalone service - shell: docker-compose up -d - become: true - args: - chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box" - -- name: wait for cinder service to start normally - wait_for: - host: 127.0.0.1 - port: 8776 - delay: 2 - timeout: 120 +---
+- name: install python-pip
+ apt:
+ name: python-pip
+
+- name: install lvm2
+ apt:
+ name: lvm2
+
+- name: install thin-provisioning-tools
+ apt:
+ name: thin-provisioning-tools
+
+- name: install docker-compose
+ pip:
+ name: docker-compose
+
+- name: copy opensds cinder backend file if specify cinder backend
+ copy:
+ src: ../../../group_vars/cinder/cinder.yaml
+ dest: "{{ cinder_config_path }}"
+
+- name: create directory to save source code and volume group file
+ file:
+ path: "{{ cinder_data_dir }}"
+ state: directory
+ recurse: yes
+
+- name: create volume group in thin mode
+ shell:
+ _raw_params: |
+ function _create_lvm_volume_group {
+ local vg=$1
+ local size=$2
+
+ local backing_file={{ cinder_data_dir }}/${vg}.img
+ if ! sudo vgs $vg; then
+ # Only create if the file doesn't already exists
+ [[ -f $backing_file ]] || truncate -s $size $backing_file
+ local vg_dev
+ vg_dev=`sudo losetup -f --show $backing_file`
+
+ # Only create volume group if it doesn't already exist
+ if ! sudo vgs $vg; then
+ sudo vgcreate $vg $vg_dev
+ fi
+ fi
+ }
+ modprobe dm_thin_pool
+ _create_lvm_volume_group {{ cinder_volume_group }} 10G
+ args:
+ executable: /bin/bash
+ become: true
+
+- name: check for python-cinderclient source code existed
+ stat:
+ path: "{{ cinder_data_dir }}/python-cinderclient"
+ ignore_errors: yes
+ register: cinderclient_existed
+
+- name: download python-cinderclient source code
+ git:
+ repo: https://github.com/openstack/python-cinderclient.git
+ dest: "{{ cinder_data_dir }}/python-cinderclient"
+ when:
+ - cinderclient_existed.stat.exists is undefined or cinderclient_existed.stat.exists == false
+
+# Tested successfully in this version `ab0185bfc6e8797a35a2274c2a5ee03afb03dd60`
+# git checkout -b ab0185bfc6e8797a35a2274c2a5ee03afb03dd60
+- name: pip install cinderclinet
+ shell: |
+ pip install -e .
+ become: true
+ args:
+ chdir: "{{ cinder_data_dir }}/python-cinderclient"
+
+- name: check for python-brick-cinderclient-ext source code existed
+ stat:
+ path: "{{ cinder_data_dir }}/python-brick-cinderclient-ext"
+ ignore_errors: yes
+ register: brick_existed
+
+- name: download python-brick-cinderclient-ext source code
+ git:
+ repo: https://github.com/openstack/python-brick-cinderclient-ext.git
+ dest: "{{ cinder_data_dir }}/python-brick-cinderclient-ext"
+ when:
+ - brick_existed.stat.exists is undefined or brick_existed.stat.exists == false
+
+# Tested successfully in this version `a281e67bf9c12521ea5433f86cec913854826a33`
+# git checkout -b a281e67bf9c12521ea5433f86cec913854826a33
+- name: pip install python-brick-cinderclient-ext
+ shell: |
+ pip install -e .
+ become: true
+ args:
+ chdir: "{{ cinder_data_dir }}/python-brick-cinderclient-ext"
+
+
+- name: check for cinder source code existed
+ stat:
+ path: "{{ cinder_data_dir }}/cinder"
+ ignore_errors: yes
+ register: cinder_existed
+
+- name: download cinder source code
+ git:
+ repo: https://github.com/openstack/cinder.git
+ dest: "{{ cinder_data_dir }}/cinder"
+ when:
+ - cinder_existed.stat.exists is undefined or cinder_existed.stat.exists == false
+
+# Tested successfully in this version `7bbc95344d3961d0bf059252723fa40b33d4b3fe`
+# git checkout -b 7bbc95344d3961d0bf059252723fa40b33d4b3fe
+- name: update blockbox configuration
+ shell: |
+ sed -i "s/PLATFORM ?= debian:stretch/PLATFORM ?= {{ cinder_container_platform }}/g" Makefile
+ sed -i "s/TAG ?= debian-cinder:latest/TAG ?= {{ cinder_image_tag }}:latest/g" Makefile
+
+ sed -i "s/image: debian-cinder/image: {{ cinder_image_tag }}/g" docker-compose.yml
+ sed -i "s/image: lvm-debian-cinder/image: lvm-{{ cinder_image_tag }}/g" docker-compose.yml
+
+ sed -i "s/volume_group = cinder-volumes /volume_group = {{ cinder_volume_group }}/g" etc/cinder.conf
+ become: true
+ args:
+ chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box"
+
+- name: make blockbox
+ shell: make blockbox
+ become: true
+ args:
+ chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box"
+
+- name: start cinder-standalone service
+ shell: docker-compose up -d
+ become: true
+ args:
+ chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box"
+
+- name: wait for cinder service to start normally
+ wait_for:
+ host: 127.0.0.1
+ port: 8776
+ delay: 2
+ timeout: 120
|