diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:35 +0000 |
commit | 7fec0b69a082aaeec72fee0612766aa42f6b1b4d (patch) | |
tree | efb569b86ca4da888717f5433e757145fa322e08 /ansible_collections/dellemc/powerflex/roles/powerflex_webui | |
parent | Releasing progress-linux version 7.7.0+dfsg-3~progress7.99u1. (diff) | |
download | ansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.tar.xz ansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.zip |
Merging upstream version 9.4.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/dellemc/powerflex/roles/powerflex_webui')
14 files changed, 426 insertions, 0 deletions
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/README.md b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/README.md new file mode 100644 index 000000000..794eb6b08 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/README.md @@ -0,0 +1,165 @@ +# powerflex_webui + +Role to manage the installation and uninstallation of Powerflex Web UI. + +## Table of contents + +* [Requirements](#requirements) +* [Ansible collections](#ansible-collections) +* [Role Variables](#role-variables) +* [Examples](#examples) +* [Notes](#notes) +* [Usage instructions](#usage-instructions) +* [Author Information](#author-information) + +## Requirements + +``` +ansible +python +``` + +## Ansible collections + +Collections required to use the role. + +``` +dellemc.powerflex +``` + +## Role Variables + +<table> +<thead> + <tr> + <th>Name</th> + <th>Required</th> + <th>Description</th> + <th>Choices</th> + <th>Type</th> + <th>Default Value</th> + </tr> +</thead> +<tbody> + <tr> + <td>hostname</td> + <td>true</td> + <td>IP or FQDN of the PowerFlex gateway.</td> + <td></td> + <td>str</td> + <td></td> + </tr> + <tr> + <td>username</td> + <td>true</td> + <td>The username of the PowerFlex gateway.</td> + <td></td> + <td>str</td> + <td></td> + </tr> + <tr> + <td>password</td> + <td>true</td> + <td>The password of the PowerFlex gateway.</td> + <td></td> + <td>str</td> + <td></td> + </tr> + <tr> + <td>port</td> + <td>false</td> + <td>The port of the PowerFlex gateway.</td> + <td></td> + <td>int</td> + <td>443</td> + </tr> + <tr> + <td>validate_certs</td> + <td>false</td> + <td>If C(false), the SSL certificates will not be validated.<br>Configure C(false) only on personally controlled sites where self-signed certificates are used.</td> + <td></td> + <td>bool</td> + <td>false</td> + </tr> + <tr> + <td>timeout</td> + <td>false</td> + <td>Time after which connection will get terminated.</td> + <td></td> + <td>int</td> + <td>120</td> + </tr> + <tr> + <td>powerflex_common_file_install_location</td> + <td>false</td> + <td>Location of installation, compatible installation software package based on the operating system of the node. + <br> The files can be downloaded from the Dell Product support page for PowerFlex software.</td> + <td></td> + <td>path</td> + <td>/var/tmp</td> + </tr> + <tr> + <td>powerflex_webui_skip_java</td> + <td>false</td> + <td>Specifies whether to install java or not.<br></td> + <td></td> + <td>bool</td> + <td>false</td> + </tr> + <tr> + <td>powerflex_webui_state</td> + <td>false</td> + <td>Specify state of web UI. + <br>present will install the web UI and absent will uninstall the web UI.</td> + <td>absent, present</td> + <td>str</td> + <td>present</td> + </tr> +</tbody> +</table> + +## Examples +---- +``` + - name: Install and configure powerflex web UI + ansible.builtin.import_role: + name: "powerflex_webui" + vars: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + powerflex_common_file_install_location: "/opt/scaleio/rpm" + powerflex_webui_skip_java: true + powerflex_webui_state: present + + - name: Uninstall powerflex web UI + ansible.builtin.import_role: + name: "powerflex_webui" + vars: + powerflex_webui_state: absent + +``` +## Notes +- Supported only in PowerFlex version 3.6. + +## Usage instructions +---- +### To install all dependency packages, including web UI, on node: + ``` + ansible-playbook -i inventory site.yml + ``` + +### To uninstall web UI: + ``` + ansible-playbook -i inventory uninstall_powerflex.yml + ``` + +Sample playbooks and inventory can be found in the playbooks directory. + +## Author Information +------------------ + +Dell Technologies <br> +Trisha Datta (ansible.team@Dell.com) 2023 diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/defaults/main.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/defaults/main.yml new file mode 100644 index 000000000..fd2b592a8 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/defaults/main.yml @@ -0,0 +1,6 @@ +--- +powerflex_skip_java: false +file_glob_name: mgmt-server +powerflex_role_environment: + MDM_IP: "{{ powerflex_webui_mdm_ips }}" +powerflex_webui_state: "present" diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/meta/argument_specs.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/meta/argument_specs.yml new file mode 100644 index 000000000..50aee5bbe --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/meta/argument_specs.yml @@ -0,0 +1,52 @@ +--- +argument_specs: + main: + short_description: Role to manage the installation and uninstallation of Powerflex web UI. + description: + - Role to manage the installation and uninstallation of Powerflex web UI. + options: + hostname: + required: true + type: str + description: IP or FQDN of the PowerFlex gateway. + username: + required: true + type: str + description: The username of the PowerFlex gateway. + password: + required: true + type: str + description: The password of the PowerFlex gateway. + port: + type: int + description: Port of the PowerFlex gateway. + default: 443 + validate_certs: + description: + - If C(false), the SSL certificates will not be validated. + - Configure C(false) only on personally controlled sites where self-signed certificates are used. + type: bool + default: false + timeout: + description: Time after which connection will get terminated. + type: int + default: 120 + powerflex_common_file_install_location: + description: + - Location of installation, compatible installation software package + based on the operating system of the node. + - The files can be downloaded from the Dell Product support page for PowerFlex software. + type: path + default: /var/tmp + powerflex_webui_skip_java: + type: bool + description: Specifies whether to install java or not. + default: false + powerflex_webui_state: + description: + - Specifies the state of the web UI. + - present will install the web UI if not already installed. + - absent will uninstall the web UI if installed. + type: str + choices: ['absent', 'present'] + default: present diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/meta/main.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/meta/main.yml new file mode 100644 index 000000000..2872690ea --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/meta/main.yml @@ -0,0 +1,29 @@ +--- +galaxy_info: + role_name: powerflex_webui + author: Trisha Datta + namespace: dellemc + description: Role to manage the installation and uninstallation of Powerflex WebUI. + company: Dell Technologies + + license: GPL-3.0-only + + min_ansible_version: "2.14.0" + + platforms: + - name: EL + versions: + - "9" + - "8" + - name: Ubuntu + versions: + - jammy + + - name: SLES + versions: + - "15SP3" + - "15SP4" + + galaxy_tags: [] +dependencies: + - role: powerflex_common diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation/converge.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation/converge.yml new file mode 100644 index 000000000..cd2b9c8b5 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation/converge.yml @@ -0,0 +1,30 @@ +--- +- name: Converge + hosts: webui + vars_files: + - ../../../../playbooks/roles/vars_files/connection.yml + gather_facts: true + tasks: + - name: Install and configure powerflex webui + ansible.builtin.import_role: + name: "powerflex_webui" + vars: + powerflex_webui_state: present + + - name: Verifying installation package in check mode + ansible.builtin.assert: + that: + - " 'No changes made, but would have if not in check mode' in powerflex_common_install_package_output.msg" + when: ansible_check_mode + + - name: Verifying installation package in converge + ansible.builtin.assert: + that: + - " 'Installed' in powerflex_common_install_package_output.results[0]" + when: not ansible_check_mode and powerflex_common_install_package_output.changed + + - name: Verifying installation package in idempotency + ansible.builtin.assert: + that: + - " 'Nothing to do' in powerflex_common_install_package_output.msg" + when: not ansible_check_mode and not powerflex_common_install_package_output.changed diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation/molecule.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation/molecule.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation/molecule.yml @@ -0,0 +1 @@ +--- diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation_invalid_path_rpm/converge.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation_invalid_path_rpm/converge.yml new file mode 100644 index 000000000..f614a1862 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation_invalid_path_rpm/converge.yml @@ -0,0 +1,34 @@ +--- +- name: Converge + hosts: webui + vars_files: + - ../../../../playbooks/roles/vars_files/connection.yml + gather_facts: true + tasks: + - name: Install and configure powerflex webui with no rpm + ansible.builtin.import_role: + name: "powerflex_webui" + vars: + powerflex_common_file_install_location: "/opt/empty" + powerflex_webui_state: present + ignore_errors: true + register: powerflex_webui_install_config_no_rpm_result + + - name: Verifying failure of install package with respect to no rpm file + ansible.builtin.assert: + that: + - powerflex_common_package_file.files | length == 0 + + - name: Install and configure powerflex webui with wrong file path + ansible.builtin.import_role: + name: "powerflex_webui" + vars: + powerflex_common_file_install_location: "/opt/aaab" + powerflex_webui_state: present + ignore_errors: true + register: powerflex_webui_install_config_wrong_path_result + + - name: Verifying failure of install package with wrong file path + ansible.builtin.assert: + that: + - powerflex_common_package_file.files | length == 0 diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation_invalid_path_rpm/molecule.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation_invalid_path_rpm/molecule.yml new file mode 100644 index 000000000..93cad84c9 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_installation_invalid_path_rpm/molecule.yml @@ -0,0 +1,4 @@ +--- +scenario: + test_sequence: + - converge diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_uninstallation/converge.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_uninstallation/converge.yml new file mode 100644 index 000000000..625f18a32 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_uninstallation/converge.yml @@ -0,0 +1,48 @@ +--- +- name: Converge + hosts: webui + vars_files: + - ../../../../playbooks/roles/vars_files/connection.yml + gather_facts: true + tasks: + - name: Uninstall powerflex webui + ansible.builtin.import_role: + name: "powerflex_webui" + vars: + powerflex_webui_state: 'absent' + + - name: Verifying uninstall package in converge + ansible.builtin.assert: + that: + - " 'Removed:' in powerflex_webui_uninstall_output.results[0].results[0]" + when: not ansible_check_mode and powerflex_webui_uninstall_output.changed and ansible_distribution in ("RedHat", "CentOS", "SLES") + + - name: Verifying uninstall package in check mode + ansible.builtin.assert: + that: + - powerflex_webui_uninstall_output.results[0].msg == "Check mode: No changes made, but would have if not in check mode" + when: ansible_check_mode and ansible_distribution in ("RedHat", "CentOS", "SLES") + + - name: Verifying uninstall package in Idempotency + ansible.builtin.assert: + that: + - powerflex_webui_uninstall_output.results[0].msg == 'Nothing to do' + when: not ansible_check_mode and not powerflex_webui_uninstall_output.changed and ansible_distribution in ("RedHat", "CentOS", "SLES") + + - name: Verifying uninstall package in check mode for deb + ansible.builtin.assert: + that: + - powerflex_webui_uninstall_deb_output.results[0].msg == "Check mode: No changes made, but would have if not in check mode" + when: ansible_check_mode and ansible_distribution == "Ubuntu" + + - name: Verifying uninstall package in converge for deb + ansible.builtin.assert: + that: + - " 'Removed:' in powerflex_webui_uninstall_deb_output.results[0].results[0]" + when: not ansible_check_mode and powerflex_webui_uninstall_deb_output.changed and ansible_distribution == "Ubuntu" + + - name: Verifying uninstall package in Idempotency for deb + ansible.builtin.assert: + that: + - powerflex_webui_uninstall_deb_output.results[0].msg == 'Nothing to do' + when: not ansible_check_mode and not powerflex_webui_uninstall_deb_output.changed and ansible_distribution == "Ubuntu" diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_uninstallation/molecule.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_uninstallation/molecule.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/molecule/webui_uninstallation/molecule.yml @@ -0,0 +1 @@ +--- diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/tasks/install_webui.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/tasks/install_webui.yml new file mode 100644 index 000000000..13d58ffac --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/tasks/install_webui.yml @@ -0,0 +1,23 @@ +--- +- name: Check if webui package is available + delegate_to: localhost + ansible.builtin.find: + paths: "{{ powerflex_common_file_install_location }}" + patterns: "*{{ file_glob_name }}*" + +- name: Get configured MDM IP addresses + dellemc.powerflex.mdm_cluster: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + state: present + register: powerflex_webui_result + delegate_to: "{{ lookup('ansible.builtin.env', 'RUNON', default='localhost') }}" + +- name: Set fact - powerflex_webui_mdm_ips + ansible.builtin.set_fact: + powerflex_webui_mdm_ips: "{{ powerflex_webui_result.mdm_cluster_details.mdmAddresses | join(',') }}" + +- name: Include install_powerflex.yml + ansible.builtin.include_tasks: ../../powerflex_common/tasks/install_powerflex.yml diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/tasks/main.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/tasks/main.yml new file mode 100644 index 000000000..417f5d504 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/tasks/main.yml @@ -0,0 +1,8 @@ +--- +- name: Install and Configure PowerFlex webUI + ansible.builtin.include_tasks: install_webui.yml + when: powerflex_webui_state == "present" + +- name: Uninstall PowerFlex webUI + ansible.builtin.include_tasks: uninstall_webui.yml + when: powerflex_webui_state == "absent" diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/tasks/uninstall_webui.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/tasks/uninstall_webui.yml new file mode 100644 index 000000000..72d7fd53a --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/tasks/uninstall_webui.yml @@ -0,0 +1,20 @@ +--- +- name: Uninstall web UI package + register: powerflex_webui_uninstall_output + environment: + I_AM_SURE: "{{ i_am_sure | int }}" + ansible.builtin.package: + name: "{{ item }}" + state: "absent" + with_items: + - EMC-ScaleIO-mgmt-server + when: ansible_distribution in ("RedHat", "CentOS", "SLES") + +- name: Uninstall deb package + register: powerflex_webui_uninstall_deb_output + ansible.builtin.apt: + name: "{{ item }}" + state: absent + with_items: + - EMC-ScaleIO-mgmt-server + when: ansible_distribution == "Ubuntu" diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_webui/vars/main.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/vars/main.yml new file mode 100644 index 000000000..aba9fecd1 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/roles/powerflex_webui/vars/main.yml @@ -0,0 +1,5 @@ +--- +file_glob_name: mgmt-server +powerflex_role_environment: + MDM_IP: "{{ powerflex_webui_mdm_ips }}" +file_gpg_name: RPM-GPG-KEY-ScaleIO |