summaryrefslogtreecommitdiffstats
path: root/ci/ansible/roles/common/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'ci/ansible/roles/common/tasks/main.yml')
-rw-r--r--ci/ansible/roles/common/tasks/main.yml185
1 files changed, 81 insertions, 104 deletions
diff --git a/ci/ansible/roles/common/tasks/main.yml b/ci/ansible/roles/common/tasks/main.yml
index 20f5381..4137812 100644
--- a/ci/ansible/roles/common/tasks/main.yml
+++ b/ci/ansible/roles/common/tasks/main.yml
@@ -1,80 +1,90 @@
----
-# If we can't get golang installed before any module is used we will fail
-# so just try what we can to get it installed
-- name: check for golang
- stat:
- path: /usr/local/go
- ignore_errors: yes
- register: systemgolang
-
-- name: install golang for debian based systems
- shell:
- cmd: |
- set -e
- set -x
+# Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
- wget https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz
- tar xvf go1.9.linux-amd64.tar.gz -C /usr/local/
- cat >> /etc/profile <<GOLANG__CONFIG_DOC
- export GOROOT=/usr/local/go
- export GOPATH=\$HOME/gopath
- export PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin
- GOLANG__CONFIG_DOC
-
- executable: /bin/bash
+---
+- name: set script dir permissions
+ file:
+ path: ./script
+ mode: 0755
+ recurse: yes
ignore_errors: yes
- when:
- - systemgolang.stat.exists is undefined or systemgolang.stat.exists == false
-
-- name: Run the equivalent of "apt-get update" as a separate step
+ become: yes
+
+- name: check ansible version
+ shell: "{{ item }}"
+ with_items:
+ - bash ./script/check_ansible_version.sh
+ become: yes
+
+- name: run the equivalent of "apt-get update" as a separate step
apt:
update_cache: yes
-- name: install librados-dev external package
- apt:
- name: librados-dev
-
-- name: install librbd-dev external package
- apt:
- name: librbd-dev
-
-- name: check for opensds source code existed
- stat:
- path: "{{ opensds_root_dir }}"
- ignore_errors: yes
- register: opensdsexisted
-
-- name: download opensds source code
- git:
- repo: "{{ remote_url }}"
- dest: "{{ opensds_root_dir }}"
- when:
- - opensdsexisted.stat.exists is undefined or opensdsexisted.stat.exists == false
-
-- name: check for opensds binary file existed
- stat:
- path: "{{ opensds_build_dir }}"
- ignore_errors: yes
- register: opensdsbuilt
-
-- name: build opensds binary file
- shell: . /etc/profile; make
- args:
- chdir: "{{ opensds_root_dir }}"
- when:
- - opensdsbuilt.stat.exists is undefined or opensdsbuilt.stat.exists == false
-
-- name: create opensds global config directory if it doesn't exist
+- name: install system packages
+ package:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - make
+ - gcc
+ - python-pip
+
+- name: install Red Hat system packages
+ package:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - librados-devel
+ - librbd-devel
+ when: ansible_os_family == "RedHat"
+
+- name: install Ubuntu system packages
+ package:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - librados-dev
+ - librbd-dev
+ when: ansible_os_family == "Debian"
+
+- name: create opensds work directory if it doesn't exist
file:
- path: "{{ opensds_config_dir }}/driver"
+ path: "{{ item }}"
state: directory
mode: 0755
+ with_items:
+ - "{{ opensds_work_dir }}"
+ - "{{ opensds_config_dir }}"
+ - "{{ opensds_driver_config_dir }}"
+ - "{{ opensds_log_dir }}"
-- name: create opensds log directory if it doesn't exist
- file:
- path: "{{ opensds_log_dir }}"
- state: directory
- mode: 0755
+- name: include scenarios/repository.yml when installing from repository
+ include: scenarios/repository.yml
+ when: install_from == "repository"
+
+- name: include scenarios/release.yml when installing from release
+ include: scenarios/release.yml
+ when: install_from == "release"
+
+- name: include scenarios/container.yml when installing from container
+ include: scenarios/container.yml
+ when: install_from == "container"
+
+- name: copy config templates into opensds global config folder
+ copy:
+ src: ../../../../conf/
+ dest: "{{ opensds_config_dir }}"
- name: configure opensds global info
shell: |
@@ -84,52 +94,19 @@
graceful = True
log_file = {{ controller_log_file }}
socket_order = inc
+ auth_strategy = {{ opensds_auth_strategy }}
[osdsdock]
api_endpoint = {{ dock_endpoint }}
log_file = {{ dock_log_file }}
+ # Choose the type of dock resource, only support 'provisioner' and 'attacher'.
+ dock_type = {{ dock_type }}
# Specify which backends should be enabled, sample,ceph,cinder,lvm and so on.
enabled_backends = {{ enabled_backend }}
- [lvm]
- name = {{ lvm_name }}
- description = {{ lvm_description }}
- driver_name = {{ lvm_driver_name }}
- config_path = {{ lvm_config_path }}
-
- [ceph]
- name = {{ ceph_name }}
- description = {{ ceph_description }}
- driver_name = {{ ceph_driver_name }}
- config_path = {{ ceph_config_path }}
-
- [cinder]
- name = {{ cinder_name }}
- description = {{ cinder_description }}
- driver_name = {{ cinder_driver_name }}
- config_path = {{ cinder_config_path }}
-
[database]
endpoint = {{ db_endpoint }}
driver = {{ db_driver }}
args:
chdir: "{{ opensds_config_dir }}"
ignore_errors: yes
-
-- name: copy opensds lvm backend file if specify lvm backend
- copy:
- src: ../../../group_vars/lvm/lvm.yaml
- dest: "{{ lvm_config_path }}"
- when: enabled_backend == "lvm"
-
-- name: copy opensds ceph backend file if specify ceph backend
- copy:
- src: ../../../group_vars/ceph/ceph.yaml
- dest: "{{ ceph_config_path }}"
- when: enabled_backend == "ceph"
-
-- name: copy opensds cinder backend file if specify cinder backend
- copy:
- src: ../../../group_vars/cinder/cinder.yaml
- dest: "{{ cinder_config_path }}"
- when: enabled_backend == "cinder"