Update stor4nfv install scripts according to opensds aruba release
[stor4nfv.git] / ci / ansible / roles / osdsdock / scenarios / cinder_standalone.yml
index 49f4063..b62d2d1 100644 (file)
@@ -1,21 +1,42 @@
----\r
-- name: install python-pip\r
-  apt:\r
-    name: python-pip\r
-\r
-- name: install lvm2\r
-  apt:\r
-    name: lvm2\r
+# Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+#     http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
 \r
-- name: install thin-provisioning-tools\r
+---\r
+- name: install python-pip, lvm2, thin-provisioning-tools and docker-compose\r
   apt:\r
-    name: thin-provisioning-tools\r
+    name: "{{ item }}"\r
+    state: present\r
+  with_items:\r
+    - python-pip\r
+    - lvm2\r
+    - thin-provisioning-tools\r
+    - docker-compose\r
+\r
+- name: configure cinder section in opensds global info if specify cinder backend\r
+  shell: |\r
+    cat >> opensds.conf <<OPENSDS_GLOABL_CONFIG_DOC\r
 \r
-- name: install docker-compose\r
-  pip:\r
-    name: docker-compose\r
+    [cinder]\r
+    name = {{ cinder_name }}\r
+    description = {{ cinder_description }}\r
+    driver_name = {{ cinder_driver_name }}\r
+    config_path = {{ cinder_config_path }}\r
+  args:\r
+    chdir: "{{ opensds_config_dir }}"\r
+  ignore_errors: yes\r
 \r
-- name: copy opensds cinder backend file if specify cinder backend\r
+- name: copy opensds cinder backend file to cinder config path if specify cinder backend\r
   copy:\r
     src: ../../../group_vars/cinder/cinder.yaml\r
     dest: "{{ cinder_config_path }}"\r
               local vg_dev\r
               vg_dev=`sudo losetup -f --show $backing_file`\r
 \r
+              # Only create physical volume if it doesn't already exist\r
+              if ! sudo pvs $vg_dev; then\r
+                  sudo pvcreate $vg_dev\r
+              fi\r
+\r
               # Only create volume group if it doesn't already exist\r
               if ! sudo vgs $vg; then\r
                   sudo vgcreate $vg $vg_dev\r
     sed -i "s/image: debian-cinder/image: {{ cinder_image_tag }}/g" docker-compose.yml\r
     sed -i "s/image: lvm-debian-cinder/image: lvm-{{ cinder_image_tag }}/g" docker-compose.yml\r
 \r
+    sed -i "s/3306:3306/3307:3306/g" docker-compose.yml\r
+\r
     sed -i "s/volume_group = cinder-volumes /volume_group = {{ cinder_volume_group }}/g" etc/cinder.conf\r
   become: true\r
   args:\r
   wait_for:\r
     host: 127.0.0.1\r
     port: 8776\r
-    delay: 2\r
+    delay: 15\r
     timeout: 120\r