Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Strato UI installation and clean up #570

Merged
merged 5 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ansible/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- group_vars/orchestration.yml
- group_vars/delfin.yml
- group_vars/srm-toolchain.yml
- group_vars/strato-ui.yml
gather_facts: false
become: True
tasks:
Expand Down
39 changes: 39 additions & 0 deletions ansible/group_vars/strato-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2023 The SODA Authors.
#
# 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.

---
# Dummy variable to avoid error because ansible does not recognize the
# file as a good configuration file when no variable in it.
dummy:


###########
# GENERAL #
###########

enable_strato_ui: false

strato_ui_port: 9003

strato_ui_release_version: v1.8.1


# Strato UI Console Login Address
strato_ui_console_login_url: "{{ host_ip }}:{{ strato_ui_port }}"

##########
# DOCKER #
##########

strato_ui_docker_image: sodafoundation/strato-ui:{{ strato_ui_release_version }}
33 changes: 33 additions & 0 deletions ansible/roles/cleaner/scenarios/strato-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2023 The SODA Authors.
#
# 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.

---

- name: stop container where Strato UI is located
docker_container:
name: strato-ui
image: "{{ strato_ui_docker_image }}"
state: absent
ignore_errors: true
tags: stratoui

- name: Remove Strato UI docker image
docker_image:
state: absent
name: sodafoundation/strato-ui
tag: "{{ strato_ui_release_version }}"
when:
- enable_strato_ui == true
- source_purge == true
tags: stratoui
5 changes: 5 additions & 0 deletions ansible/roles/cleaner/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
when: enable_dashboard == true
tags: dashboard

- name: Uninstall and cleanup Strato UI
include_tasks: scenarios/strato-ui.yml
when: enable_strato_ui == true
tags: stratoui

- name: Uninstall and cleanup Hotpot
include_tasks: scenarios/hotpot.yml
when: enable_hotpot == true
Expand Down
50 changes: 50 additions & 0 deletions ansible/roles/strato-ui-installer/scenarios/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2018 The OpenSDS Authors.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls update this

#
# 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.

---
- name: install docker-py package with pip when enabling containerized deployment
pip:
name: docker-py

- name: run Strato UI containerized service
docker_container:
name: strato-ui
image: "{{ strato_ui_docker_image }}"
state: started
network_mode: host
restart_policy: always
env:
OPENSDS_AUTH_URL: "http://{{ host_ip }}/identity"
OPENSDS_GELATO_URL: "http://{{ host_ip }}:8089"
OPENSDS_S3_URL: "http://{{ host_ip }}:8090"
OPENSDS_S3_HOST: "{{ host_ip }}"
OPENSDS_S3_PORT: "8090"
STORAGE_SERVICE_PLAN_ENABLED: "{{ enable_storage_service_plans | string }}"
when: gelato_ha != true

- name: run Strato UI containerized service for mulit-cloud HA
docker_container:
name: strato-ui
image: "{{ strato_ui_docker_image }}"
state: started
network_mode: host
restart_policy: always
env:
OPENSDS_AUTH_URL: "http://{{ host_ip }}/identity"
OPENSDS_GELATO_URL: "http://{{ gelato_ha_api_ip }}:{{ gelato_ha_api_port }}"
OPENSDS_S3_URL: "http://{{ gelato_ha_s3_ip }}:{{ gelato_ha_s3_port }}"
OPENSDS_S3_HOST: "{{ gelato_ha_s3_ip }}"
OPENSDS_S3_PORT: "{{ gelato_ha_s3_port | quote }}"
STORAGE_SERVICE_PLAN_ENABLED: "{{ enable_storage_service_plans | string }}"
when: gelato_ha == true
26 changes: 26 additions & 0 deletions ansible/roles/strato-ui-installer/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2023 The OpenSDS Authors.
#
# 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.

---
- name: use container to install dashboard
include_tasks: scenarios/container.yml
when:
- enable_strato_ui == true
- opensds_auth_strategy == "keystone"

- name: Strato UI login console
debug: msg="please use '{{ strato_ui_console_login_url }}' login console"
when:
- enable_strato_ui == true
- opensds_auth_strategy == "keystone"
22 changes: 21 additions & 1 deletion ansible/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@
- group_vars/dashboard.yml
- group_vars/gelato.yml
- group_vars/gelato-ha.yml
- group_vars/strato-ui.yml
gather_facts: false
become: True
tasks:
- import_role:
name: auth-installer
when:
- enable_dashboard == true or enable_hotpot == true or enable_gelato == true or gelato_ha == true
- enable_dashboard == true or enable_hotpot == true or enable_gelato == true or gelato_ha == true or enable_strato_ui == true
tags: keystone

- name: Install Gelato/Gelato-HA
Expand Down Expand Up @@ -164,6 +165,25 @@
- enable_dashboard == true
tags: dashboard

- name: deploy Strato UI
hosts: controllers
remote_user: root
vars_files:
- group_vars/common.yml
- group_vars/auth.yml
- group_vars/strato-ui.yml
- group_vars/gelato-ha.yml
gather_facts: false
become: True
tasks:
- include_vars:
file: group_vars/gelato-ha.yml
- include_role:
name: strato-ui-installer
when:
- enable_strato_ui == true
tags: stratoui

- name: deploy tools for telemetry
hosts: controllers
remote_user: root
Expand Down