----\r
-# If we can't get golang installed before any module is used we will fail\r
-# so just try what we can to get it installed\r
-- name: check for golang\r
- stat:\r
- path: /usr/local/go\r
- ignore_errors: yes\r
- register: systemgolang\r
-\r
-- name: install golang for debian based systems\r
- shell:\r
- cmd: |\r
- set -e\r
- set -x\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
- wget https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz\r
- tar xvf go1.9.linux-amd64.tar.gz -C /usr/local/\r
- cat >> /etc/profile <<GOLANG__CONFIG_DOC\r
- export GOROOT=/usr/local/go\r
- export GOPATH=\$HOME/gopath\r
- export PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin\r
- GOLANG__CONFIG_DOC\r
-\r
- executable: /bin/bash\r
+---\r
+- name: set script dir permissions\r
+ file:\r
+ path: ./script\r
+ mode: 0755\r
+ recurse: yes\r
ignore_errors: yes\r
- when:\r
- - systemgolang.stat.exists is undefined or systemgolang.stat.exists == false\r
-\r
-- name: Run the equivalent of "apt-get update" as a separate step\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 external package\r
- apt:\r
- name: librados-dev\r
-\r
-- name: install librbd-dev external package\r
- apt:\r
- name: librbd-dev\r
-\r
-- name: check for opensds source code existed\r
- stat:\r
- path: "{{ opensds_root_dir }}"\r
- ignore_errors: yes\r
- register: opensdsexisted\r
-\r
-- name: download opensds source code\r
- git:\r
- repo: "{{ remote_url }}"\r
- dest: "{{ opensds_root_dir }}"\r
- when:\r
- - opensdsexisted.stat.exists is undefined or opensdsexisted.stat.exists == false\r
-\r
-- name: check for opensds binary file existed\r
- stat:\r
- path: "{{ opensds_build_dir }}"\r
- ignore_errors: yes\r
- register: opensdsbuilt\r
-\r
-- name: build opensds binary file\r
- shell: . /etc/profile; make\r
- args:\r
- chdir: "{{ opensds_root_dir }}"\r
- when:\r
- - opensdsbuilt.stat.exists is undefined or opensdsbuilt.stat.exists == false\r
-\r
-- name: create opensds global config directory if it doesn't exist\r
+- name: install system packages\r
+ package:\r
+ name: "{{ item }}"\r
+ state: present\r
+ with_items:\r
+ - make\r
+ - gcc\r
+ - python-pip\r
+\r
+- name: install Red Hat system packages\r
+ package:\r
+ name: "{{ item }}"\r
+ state: present\r
+ with_items:\r
+ - librados-devel\r
+ - librbd-devel\r
+ when: ansible_os_family == "RedHat"\r
+\r
+- name: install Ubuntu system packages\r
+ package:\r
+ name: "{{ item }}"\r
+ state: present\r
+ with_items:\r
+ - librados-dev\r
+ - librbd-dev\r
+ when: ansible_os_family == "Debian"\r
+\r
+- name: create opensds work directory if it doesn't exist\r
file:\r
- path: "{{ opensds_config_dir }}/driver"\r
+ path: "{{ item }}"\r
state: directory\r
mode: 0755\r
+ with_items:\r
+ - "{{ opensds_work_dir }}"\r
+ - "{{ opensds_config_dir }}"\r
+ - "{{ opensds_driver_config_dir }}"\r
+ - "{{ opensds_log_dir }}"\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/repository.yml when installing from repository\r
+ include: scenarios/repository.yml\r
+ when: install_from == "repository"\r
+\r
+- name: include scenarios/release.yml when installing from release\r
+ include: scenarios/release.yml\r
+ when: install_from == "release"\r
+\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: copy opensds lvm backend file if specify lvm backend\r
- copy:\r
- src: ../../../group_vars/lvm/lvm.yaml\r
- dest: "{{ lvm_config_path }}"\r
- when: enabled_backend == "lvm"\r
-\r
-- name: copy opensds ceph backend file if specify ceph backend\r
- copy:\r
- src: ../../../group_vars/ceph/ceph.yaml\r
- dest: "{{ ceph_config_path }}"\r
- when: enabled_backend == "ceph"\r
-\r
-- name: copy opensds cinder backend file if specify cinder backend\r
- copy:\r
- src: ../../../group_vars/cinder/cinder.yaml\r
- dest: "{{ cinder_config_path }}"\r
- when: enabled_backend == "cinder"\r