From 53f8855cb81dc7cee40a9f4b36eca196db79f5a2 Mon Sep 17 00:00:00 2001 From: Anvith KS Date: Wed, 28 Jun 2023 21:25:23 +0530 Subject: [PATCH 1/4] Added Strato UI installation and clean up --- ansible/clean.yml | 1 + ansible/group_vars/strato-ui.yml | 39 +++++++++++++++ ansible/roles/cleaner/scenarios/strato-ui.yml | 23 +++++++++ ansible/roles/cleaner/tasks/main.yml | 5 ++ .../scenarios/container.yml | 50 +++++++++++++++++++ .../roles/strato-ui-installer/tasks/main.yml | 26 ++++++++++ ansible/site.yml | 19 +++++++ 7 files changed, 163 insertions(+) create mode 100644 ansible/group_vars/strato-ui.yml create mode 100644 ansible/roles/cleaner/scenarios/strato-ui.yml create mode 100644 ansible/roles/strato-ui-installer/scenarios/container.yml create mode 100644 ansible/roles/strato-ui-installer/tasks/main.yml diff --git a/ansible/clean.yml b/ansible/clean.yml index 81e82d3b..f5ca128e 100644 --- a/ansible/clean.yml +++ b/ansible/clean.yml @@ -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: diff --git a/ansible/group_vars/strato-ui.yml b/ansible/group_vars/strato-ui.yml new file mode 100644 index 00000000..2db10ffe --- /dev/null +++ b/ansible/group_vars/strato-ui.yml @@ -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: latest + + +# 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 }} diff --git a/ansible/roles/cleaner/scenarios/strato-ui.yml b/ansible/roles/cleaner/scenarios/strato-ui.yml new file mode 100644 index 00000000..c572525e --- /dev/null +++ b/ansible/roles/cleaner/scenarios/strato-ui.yml @@ -0,0 +1,23 @@ +# 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 diff --git a/ansible/roles/cleaner/tasks/main.yml b/ansible/roles/cleaner/tasks/main.yml index c50bb494..6391edeb 100644 --- a/ansible/roles/cleaner/tasks/main.yml +++ b/ansible/roles/cleaner/tasks/main.yml @@ -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 diff --git a/ansible/roles/strato-ui-installer/scenarios/container.yml b/ansible/roles/strato-ui-installer/scenarios/container.yml new file mode 100644 index 00000000..4b7691e5 --- /dev/null +++ b/ansible/roles/strato-ui-installer/scenarios/container.yml @@ -0,0 +1,50 @@ +# Copyright 2018 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: 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 diff --git a/ansible/roles/strato-ui-installer/tasks/main.yml b/ansible/roles/strato-ui-installer/tasks/main.yml new file mode 100644 index 00000000..dd10bc18 --- /dev/null +++ b/ansible/roles/strato-ui-installer/tasks/main.yml @@ -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" diff --git a/ansible/site.yml b/ansible/site.yml index 8a32b806..d7f2fd61 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -164,6 +164,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 From ca9813d6172bf6fa9552dd42cc41c6ef4789bc9e Mon Sep 17 00:00:00 2001 From: Anvith KS Date: Fri, 7 Jul 2023 16:08:06 +0530 Subject: [PATCH 2/4] Updated cleanup. removed the strato ui image. fixed missing install flag --- ansible/roles/cleaner/scenarios/strato-ui.yml | 6 ++++++ ansible/site.yml | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ansible/roles/cleaner/scenarios/strato-ui.yml b/ansible/roles/cleaner/scenarios/strato-ui.yml index c572525e..fff84ff8 100644 --- a/ansible/roles/cleaner/scenarios/strato-ui.yml +++ b/ansible/roles/cleaner/scenarios/strato-ui.yml @@ -21,3 +21,9 @@ 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 }}" diff --git a/ansible/site.yml b/ansible/site.yml index d7f2fd61..1bd81cc7 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -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 From 5a33763e4530e9c5422e2eb7b239ab06a994f141 Mon Sep 17 00:00:00 2001 From: Anvith KS Date: Mon, 10 Jul 2023 12:24:54 +0530 Subject: [PATCH 3/4] Added conditionals to removing the strato ui docker image during cleanup. Fixed release version. --- ansible/group_vars/strato-ui.yml | 2 +- ansible/roles/cleaner/scenarios/strato-ui.yml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ansible/group_vars/strato-ui.yml b/ansible/group_vars/strato-ui.yml index 2db10ffe..55f6ff22 100644 --- a/ansible/group_vars/strato-ui.yml +++ b/ansible/group_vars/strato-ui.yml @@ -26,7 +26,7 @@ enable_strato_ui: false strato_ui_port: 9003 -strato_ui_release_version: latest +strato_ui_release_version: v1.8.1 # Strato UI Console Login Address diff --git a/ansible/roles/cleaner/scenarios/strato-ui.yml b/ansible/roles/cleaner/scenarios/strato-ui.yml index fff84ff8..0cc4f92c 100644 --- a/ansible/roles/cleaner/scenarios/strato-ui.yml +++ b/ansible/roles/cleaner/scenarios/strato-ui.yml @@ -27,3 +27,7 @@ state: absent name: sodafoundation/strato-ui tag: "{{ strato_ui_release_version }}" + when: + - enable_strato_ui == true + - source_purge == true + tags: stratoui From ad7ecd3073a050e7321ce2e220fcb3dd6627c582 Mon Sep 17 00:00:00 2001 From: Anvith KS Date: Tue, 11 Jul 2023 09:15:12 +0530 Subject: [PATCH 4/4] Fixed incorrect license attribution --- ansible/roles/strato-ui-installer/scenarios/container.yml | 2 +- ansible/roles/strato-ui-installer/tasks/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/roles/strato-ui-installer/scenarios/container.yml b/ansible/roles/strato-ui-installer/scenarios/container.yml index 4b7691e5..608e29f4 100644 --- a/ansible/roles/strato-ui-installer/scenarios/container.yml +++ b/ansible/roles/strato-ui-installer/scenarios/container.yml @@ -1,4 +1,4 @@ -# Copyright 2018 The OpenSDS Authors. +# 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. diff --git a/ansible/roles/strato-ui-installer/tasks/main.yml b/ansible/roles/strato-ui-installer/tasks/main.yml index dd10bc18..6b95bbb0 100644 --- a/ansible/roles/strato-ui-installer/tasks/main.yml +++ b/ansible/roles/strato-ui-installer/tasks/main.yml @@ -1,4 +1,4 @@ -# Copyright 2023 The OpenSDS Authors. +# 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.