summaryrefslogtreecommitdiffstats
path: root/ci/ansible/roles
diff options
context:
space:
mode:
authorleonwang <wanghui71@huawei.com>2018-08-07 14:49:27 +0800
committerleonwang <wanghui71@huawei.com>2018-08-07 14:57:29 +0800
commit91a84330494b100ac9077652c910fb248f737717 (patch)
tree2c86151a5276e9e4ea9b2ea16e24adfd9f34fb5f /ci/ansible/roles
parent078bb837513f3b83fdd07f2e10f9abeb0bd485db (diff)
Update the latest version of ansible script
This patch is proposed for merging the latest version of ansible code according to opensds-installer project. From the latest version code, we change the default installation way from source code to release, which means there is no need for golang environment prepare and long-time building work. Change-Id: I93d7d24f29e61979bc8fda7125ae753063eda423 Signed-off-by: leonwang <wanghui71@huawei.com>
Diffstat (limited to 'ci/ansible/roles')
-rw-r--r--ci/ansible/roles/cleaner/tasks/main.yml15
-rw-r--r--ci/ansible/roles/common/scenarios/release.yml6
-rw-r--r--ci/ansible/roles/common/tasks/main.yml22
-rw-r--r--ci/ansible/roles/dashboard-installer/scenarios/container.yml2
-rw-r--r--ci/ansible/roles/nbp-installer/scenarios/csi.yml4
-rw-r--r--ci/ansible/roles/nbp-installer/scenarios/flexvolume.yml33
-rw-r--r--ci/ansible/roles/nbp-installer/scenarios/release.yml8
-rw-r--r--ci/ansible/roles/nbp-installer/scenarios/repository.yml2
-rw-r--r--ci/ansible/roles/osdsdb/tasks/main.yml2
-rw-r--r--ci/ansible/roles/osdsdock/tasks/main.yml14
-rw-r--r--ci/ansible/roles/osdslet/tasks/main.yml6
11 files changed, 90 insertions, 24 deletions
diff --git a/ci/ansible/roles/cleaner/tasks/main.yml b/ci/ansible/roles/cleaner/tasks/main.yml
index 8399b08..ed887c6 100644
--- a/ci/ansible/roles/cleaner/tasks/main.yml
+++ b/ci/ansible/roles/cleaner/tasks/main.yml
@@ -14,7 +14,7 @@
- name: kill osdslet daemon service
shell: killall osdslet osdsdock
- when: container_enabled == false
+ when: install_from != "container"
ignore_errors: true
- name: kill osdslet containerized service
@@ -22,14 +22,14 @@
name: osdslet
image: "{{ controller_docker_image }}"
state: stopped
- when: container_enabled == true
+ when: install_from == "container"
- name: kill osdsdock containerized service
docker_container:
name: osdsdock
image: "{{ dock_docker_image }}"
state: stopped
- when: container_enabled == true
+ when: install_from == "container"
- name: stop container where dashboard is located
docker_container:
@@ -46,6 +46,15 @@
ignore_errors: yes
when: nbp_plugin_type == "flexvolume"
+- name: clean opensds external provisioner plugin if flexvolume specified
+ shell: |
+ . /etc/profile
+ kubectl delete -f deploy/
+ args:
+ chdir: "{{ nbp_work_dir }}/provisioner"
+ ignore_errors: yes
+ when: nbp_plugin_type == "flexvolume"
+
- name: clean opensds csi plugin if csi plugin specified
shell: |
. /etc/profile
diff --git a/ci/ansible/roles/common/scenarios/release.yml b/ci/ansible/roles/common/scenarios/release.yml
index 500d82e..83df8bd 100644
--- a/ci/ansible/roles/common/scenarios/release.yml
+++ b/ci/ansible/roles/common/scenarios/release.yml
@@ -21,8 +21,9 @@
- name: download and extract the opensds release tarball if not exists
unarchive:
- src={{ opensds_download_url }}
- dest=/tmp/
+ src: "{{ opensds_download_url }}"
+ dest: /tmp/
+ remote_src: yes
when:
- opensdsreleasesexisted.stat.exists is undefined or opensdsreleasesexisted.stat.exists == false
@@ -36,3 +37,4 @@
copy:
src: "{{ opensds_tarball_dir }}/"
dest: "{{ opensds_work_dir }}"
+ mode: 0755
diff --git a/ci/ansible/roles/common/tasks/main.yml b/ci/ansible/roles/common/tasks/main.yml
index daee059..14a28d3 100644
--- a/ci/ansible/roles/common/tasks/main.yml
+++ b/ci/ansible/roles/common/tasks/main.yml
@@ -31,8 +31,8 @@
apt:
update_cache: yes
-- name: install make, gcc and pip external packages
- apt:
+- name: install system packages
+ package:
name: "{{ item }}"
state: present
with_items:
@@ -40,6 +40,24 @@
- 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: "{{ item }}"
diff --git a/ci/ansible/roles/dashboard-installer/scenarios/container.yml b/ci/ansible/roles/dashboard-installer/scenarios/container.yml
index e25d90f..0c8fe18 100644
--- a/ci/ansible/roles/dashboard-installer/scenarios/container.yml
+++ b/ci/ansible/roles/dashboard-installer/scenarios/container.yml
@@ -20,7 +20,7 @@
- name: run dashboard containerized service
docker_container:
name: dashboard
- image: opensdsio/dashboard:latest
+ image: "{{ dashboard_docker_image }}"
state: started
network_mode: host
restart_policy: always
diff --git a/ci/ansible/roles/nbp-installer/scenarios/csi.yml b/ci/ansible/roles/nbp-installer/scenarios/csi.yml
index 93fff88..ef86967 100644
--- a/ci/ansible/roles/nbp-installer/scenarios/csi.yml
+++ b/ci/ansible/roles/nbp-installer/scenarios/csi.yml
@@ -19,14 +19,14 @@
regexp: '^ opensdsendpoint'
line: ' opensdsendpoint: {{ opensds_endpoint }}'
backup: yes
-
+
- name: Configure opensds auth strategy in opensds csi plugin
lineinfile:
dest: "{{ nbp_work_dir }}/csi/deploy/kubernetes/csi-configmap-opensdsplugin.yaml"
regexp: '^ opensdsauthstrategy'
line: ' opensdsauthstrategy: {{ opensds_auth_strategy }}'
backup: yes
-
+
- name: Configure keystone os auth url in opensds csi plugin
lineinfile:
dest: "{{ nbp_work_dir }}/csi/deploy/kubernetes/csi-configmap-opensdsplugin.yaml"
diff --git a/ci/ansible/roles/nbp-installer/scenarios/flexvolume.yml b/ci/ansible/roles/nbp-installer/scenarios/flexvolume.yml
index 52ec16d..2117411 100644
--- a/ci/ansible/roles/nbp-installer/scenarios/flexvolume.yml
+++ b/ci/ansible/roles/nbp-installer/scenarios/flexvolume.yml
@@ -21,5 +21,36 @@
- name: Copy opensds flexvolume plugin binary file into flexvolume plugin dir
copy:
- src: "{{ nbp_work_dir }}/flexvolume/opensds"
+ src: "{{ nbp_work_dir }}/bin/flexvolume.server.opensds"
dest: "{{ flexvolume_plugin_dir }}/opensds"
+ mode: 0755
+
+- name: Configure opensds endpoint IP in opensds external provisioner plugin
+ lineinfile:
+ dest: "{{ nbp_work_dir }}/provisioner/deploy/configmap.yaml"
+ regexp: '^ opensdsendpoint'
+ line: ' opensdsendpoint: {{ opensds_endpoint }}'
+ backup: yes
+
+- name: Configure opensds auth strategy in opensds external provisioner plugin
+ lineinfile:
+ dest: "{{ nbp_work_dir }}/provisioner/deploy/configmap.yaml"
+ regexp: '^ opensdsauthstrategy'
+ line: ' opensdsauthstrategy: {{ opensds_auth_strategy }}'
+ backup: yes
+
+- name: Configure keystone os auth url in opensds external provisioner plugin
+ lineinfile:
+ dest: "{{ nbp_work_dir }}/provisioner/deploy/configmap.yaml"
+ regexp: '^ osauthurl'
+ line: ' osauthurl: {{ keystone_os_auth_url }}'
+ backup: yes
+ when: opensds_auth_strategy == "keystone"
+
+- name: Prepare and deploy opensds external provisioner plugin
+ shell: |
+ . /etc/profile
+ kubectl create -f deploy/
+ args:
+ chdir: "{{ nbp_work_dir }}/provisioner"
+ ignore_errors: yes
diff --git a/ci/ansible/roles/nbp-installer/scenarios/release.yml b/ci/ansible/roles/nbp-installer/scenarios/release.yml
index 89429d7..b528724 100644
--- a/ci/ansible/roles/nbp-installer/scenarios/release.yml
+++ b/ci/ansible/roles/nbp-installer/scenarios/release.yml
@@ -21,14 +21,15 @@
- name: download and extract the nbp release tarball if not exists
unarchive:
- src={{ nbp_download_url }}
- dest=/tmp/
+ src: "{{ nbp_download_url }}"
+ dest: /tmp/
+ remote_src: yes
when:
- nbpreleasesexisted.stat.exists is undefined or nbpreleasesexisted.stat.exists == false
- name: change the mode of all binary files in nbp release
file:
- path: "{{ nbp_tarball_dir }}/flexvolume"
+ path: "{{ nbp_tarball_dir }}/bin"
mode: 0755
recurse: yes
@@ -36,3 +37,4 @@
copy:
src: "{{ nbp_tarball_dir }}/"
dest: "{{ nbp_work_dir }}"
+ mode: 0755
diff --git a/ci/ansible/roles/nbp-installer/scenarios/repository.yml b/ci/ansible/roles/nbp-installer/scenarios/repository.yml
index fb8059b..0c323d2 100644
--- a/ci/ansible/roles/nbp-installer/scenarios/repository.yml
+++ b/ci/ansible/roles/nbp-installer/scenarios/repository.yml
@@ -15,7 +15,7 @@
---
- set_fact:
go_path: "{{ lookup('env', 'GOPATH') }}"
-
+
- name: check go_path
shell: "{{ item }}"
with_items:
diff --git a/ci/ansible/roles/osdsdb/tasks/main.yml b/ci/ansible/roles/osdsdb/tasks/main.yml
index a826d21..396fd9a 100644
--- a/ci/ansible/roles/osdsdb/tasks/main.yml
+++ b/ci/ansible/roles/osdsdb/tasks/main.yml
@@ -22,4 +22,4 @@
- name: include scenarios/container.yml
include: scenarios/container.yml
- when: db_driver == "etcd" and container_enabled == true
+ when: db_driver == "etcd" and etcd_container_enabled == true
diff --git a/ci/ansible/roles/osdsdock/tasks/main.yml b/ci/ansible/roles/osdsdock/tasks/main.yml
index 8b18c8d..dc803b5 100644
--- a/ci/ansible/roles/osdsdock/tasks/main.yml
+++ b/ci/ansible/roles/osdsdock/tasks/main.yml
@@ -43,16 +43,20 @@
done
args:
chdir: "{{ opensds_work_dir }}"
- when: container_enabled == false
+ when: install_from != "container"
- name: run osdsdock containerized service
docker_container:
name: osdsdock
- image: opensdsio/opensds-dock:latest
+ image: "{{ dock_docker_image }}"
state: started
network_mode: host
privileged: true
volumes:
- - "/etc/opensds/:/etc/opensds"
- - "/etc/ceph/:/etc/ceph"
- when: container_enabled == true
+ - "/etc/opensds:/etc/opensds"
+ - "/etc/ceph:/etc/ceph"
+ - "/dev/:/dev/"
+ - "/run/:/run/:shared"
+ - "/etc/localtime:/etc/localtime:ro"
+ - "/lib/modules:/lib/modules:ro"
+ when: install_from == "container"
diff --git a/ci/ansible/roles/osdslet/tasks/main.yml b/ci/ansible/roles/osdslet/tasks/main.yml
index 87ea816..d844e3a 100644
--- a/ci/ansible/roles/osdslet/tasks/main.yml
+++ b/ci/ansible/roles/osdslet/tasks/main.yml
@@ -27,14 +27,14 @@
done
args:
chdir: "{{ opensds_work_dir }}"
- when: container_enabled == false
+ when: install_from != "container"
- name: run osdslet containerized service
docker_container:
name: osdslet
- image: opensdsio/opensds-controller:latest
+ image: "{{ controller_docker_image }}"
state: started
network_mode: host
volumes:
- "/etc/opensds/:/etc/opensds"
- when: container_enabled == true
+ when: install_from == "container"