diff --git a/ansible/clean.yml b/ansible/clean.yml index 81e82d3b..4d30e217 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/delfin-ui.yml gather_facts: false become: True tasks: diff --git a/ansible/group_vars/delfin-ui.yml b/ansible/group_vars/delfin-ui.yml new file mode 100644 index 00000000..d5976c40 --- /dev/null +++ b/ansible/group_vars/delfin-ui.yml @@ -0,0 +1,40 @@ +# 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_delfin_ui: false + +delfin_ui_port: 9001 + +delfin_ui_release_version: v1.7.1 + +#Dashboard Console Login Address +delfin_ui_login_url: "{{ host_ip }}:{{ delfin_ui_port }}" + +########## +# DOCKER # +########## + +delfin_ui_docker_image: sodafoundation/delfin-ui:{{ delfin_ui_release_version }} + + diff --git a/ansible/roles/cleaner/scenarios/delfin-ui.yml b/ansible/roles/cleaner/scenarios/delfin-ui.yml new file mode 100644 index 00000000..c860fd7a --- /dev/null +++ b/ansible/roles/cleaner/scenarios/delfin-ui.yml @@ -0,0 +1,33 @@ +# Copyright 2022 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 Delfin UI is located + docker_container: + name: delfin-ui + image: "{{ delfin_ui_docker_image }}" + state: absent + ignore_errors: true + tags: delfin_ui + +- name: Remove Delfin UI docker image + docker_image: + state: absent + name: sodafoundation/delfin-ui + tag: "{{ delfin_ui_release_version }}" + when: + - enable_delfin_ui == true + - source_purge == true + tags: delfin_ui diff --git a/ansible/roles/cleaner/tasks/main.yml b/ansible/roles/cleaner/tasks/main.yml index c50bb494..bc0796af 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 Delfin UI + include_tasks: scenarios/delfin-ui.yml + when: enable_delfin_ui == true + tags: delfin_ui + - name: Uninstall and cleanup Hotpot include_tasks: scenarios/hotpot.yml when: enable_hotpot == true diff --git a/ansible/roles/delfin-ui-installer/scenarios/container.yml b/ansible/roles/delfin-ui-installer/scenarios/container.yml new file mode 100644 index 00000000..f633e3ca --- /dev/null +++ b/ansible/roles/delfin-ui-installer/scenarios/container.yml @@ -0,0 +1,33 @@ +# 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 Delfin UI containerized service + docker_container: + name: delfin-ui + image: "{{ delfin_ui_docker_image }}" + state: started + network_mode: host + restart_policy: always + env: + SODA_HOST_IP: "{{ host_ip }}" + SODA_DELFIN_URL: "{{ soda_delfin_url }}" + SODA_PROMETHEUS_PORT: "{{ prometheus_port | quote }}" + SODA_ALERTMANAGER_PORT: "{{ alertmanager_port | quote }}" + SODA_ALERTMANAGER_URL: "http://{{ host_ip }}:{{ alertmanager_port }}" + SODA_GRAFANA_PORT: "{{ grafana_port | quote }}" diff --git a/ansible/roles/delfin-ui-installer/tasks/main.yml b/ansible/roles/delfin-ui-installer/tasks/main.yml new file mode 100644 index 00000000..65416e5d --- /dev/null +++ b/ansible/roles/delfin-ui-installer/tasks/main.yml @@ -0,0 +1,24 @@ +# 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 Delfin UI + include_tasks: scenarios/container.yml + when: + - enable_delfin_ui == true + +- name: Delfin UI console + debug: msg="please use '{{ delfin_ui_login_url }}' console" + when: + - enable_delfin_ui == true diff --git a/ansible/site.yml b/ansible/site.yml index 8a32b806..87d9f6a1 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -164,6 +164,22 @@ - enable_dashboard == true tags: dashboard +- name: Deploy Delfin UI + hosts: controllers + remote_user: root + vars_files: + - group_vars/common.yml + - group_vars/srm-toolchain.yml + - group_vars/delfin-ui.yml + gather_facts: false + become: True + tasks: + - include_role: + name: delfin-ui-installer + when: + - enable_delfin_ui == true + tags: delfin_ui + - name: deploy tools for telemetry hosts: controllers remote_user: root