Update stor4nfv install scripts according to opensds aruba release
[stor4nfv.git] / ci / ansible / roles / common / tasks / main.yml
index 7ae2234..daee059 100644 (file)
@@ -1,84 +1,72 @@
+# 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
 ---\r
+- name: set script dir permissions\r
+  file:\r
+    path: ./script\r
+    mode: 0755\r
+    recurse: yes\r
+  ignore_errors: yes\r
+  become: yes\r
+    \r
+- name: check ansible version\r
+  shell: "{{ item }}"\r
+  with_items:\r
+    - bash ./script/check_ansible_version.sh\r
+  become: yes\r
+\r
 - name: run the equivalent of "apt-get update" as a separate step\r
   apt:\r
     update_cache: yes\r
 \r
-- name: install librados-dev and librbd-dev external packages\r
+- name: install make, gcc and pip external packages\r
   apt:\r
     name: "{{ item }}"\r
     state: present\r
   with_items:\r
-    - librados-dev\r
-    - librbd-dev\r
+    - make\r
+    - gcc\r
+    - python-pip\r
 \r
-- name: install docker-py package with pip when enabling containerized deployment\r
-  pip:\r
-    name: docker-py\r
-  when: container_enabled == true\r
-\r
-- name: check for opensds release files existed\r
-  stat:\r
-    path: "{{ opensds_dir }}"\r
-  ignore_errors: yes\r
-  register: opensdsreleasesexisted\r
-\r
-- name: download opensds release files\r
-  get_url:\r
-    url={{ opensds_download_url }}\r
-    dest={{ opensds_tarball_url }}\r
-  when:\r
-    - opensdsreleasesexisted.stat.exists is undefined or opensdsreleasesexisted.stat.exists == false\r
-\r
-- name: extract the opensds release tarball\r
-  unarchive:\r
-    src={{ opensds_tarball_url }}\r
-    dest=/opt/\r
-  when:\r
-    - opensdsreleasesexisted.stat.exists is undefined or opensdsreleasesexisted.stat.exists == false\r
-\r
-- name: check for nbp release files existed\r
-  stat:\r
-    path: "{{ nbp_dir }}"\r
-  ignore_errors: yes\r
-  register: nbpreleasesexisted\r
-\r
-- name: download nbp release files\r
-  get_url:\r
-    url={{ nbp_download_url }}\r
-    dest={{ nbp_tarball_url }}\r
-  when:\r
-    - nbpreleasesexisted.stat.exists is undefined or nbpreleasesexisted.stat.exists == false\r
-\r
-- name: extract the nbp release tarball\r
-  unarchive:\r
-    src={{ nbp_tarball_url }}\r
-    dest=/opt/\r
-  when:\r
-    - nbpreleasesexisted.stat.exists is undefined or nbpreleasesexisted.stat.exists == false\r
-\r
-- name: change the mode of all binary files in opensds release\r
+- name: create opensds work directory if it doesn't exist\r
   file:\r
-    path: "{{ opensds_dir }}/bin"\r
+    path: "{{ item }}"\r
+    state: directory\r
     mode: 0755\r
-    recurse: yes\r
+  with_items:\r
+    - "{{ opensds_work_dir }}"\r
+    - "{{ opensds_config_dir }}"\r
+    - "{{ opensds_driver_config_dir }}"\r
+    - "{{ opensds_log_dir }}"\r
 \r
-- name: change the mode of all binary files in nbp release\r
-  file:\r
-    path: "{{ nbp_dir }}/flexvolume"\r
-    mode: 0755\r
-    recurse: yes\r
+- name: include scenarios/repository.yml when installing from repository\r
+  include: scenarios/repository.yml\r
+  when: install_from == "repository"\r
 \r
-- name: create opensds global config directory if it doesn't exist\r
-  file:\r
-    path: "{{ opensds_config_dir }}/driver"\r
-    state: directory\r
-    mode: 0755\r
+- name: include scenarios/release.yml when installing from release\r
+  include: scenarios/release.yml\r
+  when: install_from == "release"\r
 \r
-- name: create opensds log directory if it doesn't exist\r
-  file:\r
-    path: "{{ opensds_log_dir }}"\r
-    state: directory\r
-    mode: 0755\r
+- name: include scenarios/container.yml when installing from container\r
+  include: scenarios/container.yml\r
+  when: install_from == "container"\r
+\r
+- name: copy config templates into opensds global config folder\r
+  copy:\r
+    src: ../../../../conf/\r
+    dest: "{{ opensds_config_dir }}"\r
 \r
 - name: configure opensds global info\r
   shell: |\r
     graceful = True\r
     log_file = {{ controller_log_file }}\r
     socket_order = inc\r
+    auth_strategy = {{ opensds_auth_strategy }}\r
 \r
     [osdsdock]\r
     api_endpoint = {{ dock_endpoint }}\r
     log_file = {{ dock_log_file }}\r
+    # Choose the type of dock resource, only support 'provisioner' and 'attacher'.\r
+    dock_type = {{ dock_type }}\r
     # Specify which backends should be enabled, sample,ceph,cinder,lvm and so on.\r
     enabled_backends = {{ enabled_backend }}\r
 \r
-    [lvm]\r
-    name = {{ lvm_name }}\r
-    description = {{ lvm_description }}\r
-    driver_name = {{ lvm_driver_name }}\r
-    config_path = {{ lvm_config_path }}\r
-\r
-    [ceph]\r
-    name = {{ ceph_name }}\r
-    description = {{ ceph_description }}\r
-    driver_name = {{ ceph_driver_name }}\r
-    config_path = {{ ceph_config_path }}\r
-\r
-    [cinder]\r
-    name = {{ cinder_name }}\r
-    description = {{ cinder_description }}\r
-    driver_name = {{ cinder_driver_name }}\r
-    config_path = {{ cinder_config_path }}\r
-\r
     [database]\r
     endpoint = {{ db_endpoint }}\r
     driver = {{ db_driver }}\r
   args:\r
     chdir: "{{ opensds_config_dir }}"\r
   ignore_errors: yes\r
+\r
+- name: include nbp-installer role if nbp_plugin_type != hotpot_only\r
+  include_role:\r
+    name: nbp-installer\r
+  when: nbp_plugin_type != "hotpot_only"\r