diff --git a/ansible/clean.yml b/ansible/clean.yml index 4d30e217..abb1e51e 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 - group_vars/delfin-ui.yml gather_facts: false become: True diff --git a/ansible/group_vars/strato-ui.yml b/ansible/group_vars/strato-ui.yml new file mode 100644 index 00000000..55f6ff22 --- /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: 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 }} diff --git a/ansible/roles/cleaner/scenarios/strato-ui.yml b/ansible/roles/cleaner/scenarios/strato-ui.yml new file mode 100644 index 00000000..0cc4f92c --- /dev/null +++ b/ansible/roles/cleaner/scenarios/strato-ui.yml @@ -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 diff --git a/ansible/roles/cleaner/tasks/main.yml b/ansible/roles/cleaner/tasks/main.yml index bc0796af..6c7e9d93 100644 --- a/ansible/roles/cleaner/tasks/main.yml +++ b/ansible/roles/cleaner/tasks/main.yml @@ -17,6 +17,12 @@ 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 Delfin UI include_tasks: scenarios/delfin-ui.yml when: enable_delfin_ui == 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..608e29f4 --- /dev/null +++ b/ansible/roles/strato-ui-installer/scenarios/container.yml @@ -0,0 +1,50 @@ +# 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: 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..6b95bbb0 --- /dev/null +++ b/ansible/roles/strato-ui-installer/tasks/main.yml @@ -0,0 +1,26 @@ +# 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: 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 87d9f6a1..dd729011 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 @@ -164,6 +165,26 @@ - 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 Delfin UI hosts: controllers remote_user: root