summaryrefslogtreecommitdiffstats
path: root/ansible_collections/dellemc/powerflex/roles/powerflex_gateway
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/dellemc/powerflex/roles/powerflex_gateway')
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/README.md160
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/defaults/main.yml17
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/handlers/main.yml6
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/meta/argument_specs.yml47
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/meta/main.yml28
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation/converge.yml29
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation/molecule.yml1
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation_invalid_path_rpm/converge.yml32
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation_invalid_path_rpm/molecule.yml4
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_uninstallation/converge.yml48
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_uninstallation/molecule.yml1
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/install_gateway.yml52
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/install_keepalived.yml28
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/main.yml8
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/uninstall_gateway.yml20
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/templates/keepalived.conf.j218
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/CentOS.yml4
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/RedHat.yml4
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/SLES.yml4
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/Ubuntu.yml4
-rw-r--r--ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/main.yml6
21 files changed, 521 insertions, 0 deletions
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/README.md b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/README.md
new file mode 100644
index 000000000..eac43ab78
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/README.md
@@ -0,0 +1,160 @@
+# powerflex_gateway
+
+Role to manage the installation and uninstallation of Powerflex Gateway.
+
+## 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>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_gateway_is_redundant</td>
+ <td>false</td>
+ <td>Is the gateway redundant (will install keepalived).<br></td>
+ <td></td>
+ <td>bool</td>
+ <td>false</td>
+ </tr>
+ <tr>
+ <td>powerflex_gateway_admin_password</td>
+ <td>true</td>
+ <td>Admin password for the Powerflex gateway.<br></td>
+ <td></td>
+ <td>str</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>powerflex_gateway_http_port</td>
+ <td>false</td>
+ <td>Powerflex gateway HTTP port.<br></td>
+ <td></td>
+ <td>int</td>
+ <td>80</td>
+ </tr>
+ <tr>
+ <td>powerflex_gateway_https_port</td>
+ <td>false</td>
+ <td>Powerflex gateway HTTPS port.<br></td>
+ <td></td>
+ <td>int</td>
+ <td>443</td>
+ </tr>
+ <tr>
+ <td>powerflex_gateway_virtual_ip</td>
+ <td>false</td>
+ <td>Virtual IP address of Powerflex gateway.<br></td>
+ <td></td>
+ <td>str</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>powerflex_gateway_virtual_interface</td>
+ <td>false</td>
+ <td>Virtual interface of Powerflex gateway.<br></td>
+ <td></td>
+ <td>str</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>powerflex_gateway_state</td>
+ <td>false</td>
+ <td>Specify state of gateway.<br></td>
+ <td>absent, present</td>
+ <td>str</td>
+ <td>present</td>
+ </tr>
+ <tr>
+ <td>powerflex_gateway_skip_java</td>
+ <td>false</td>
+ <td>Specify whether to install the java or not.<br></td>
+ <td></td>
+ <td>bool</td>
+ <td>false</td>
+ </tr>
+</tbody>
+</table>
+
+## Examples
+----
+```
+ - name: Install and configure powerflex gateway
+ ansible.builtin.import_role:
+ name: powerflex_gateway
+ vars:
+ powerflex_common_file_install_location: "/opt/scaleio/rpm"
+ powerflex_gateway_admin_password: password
+ powerflex_gateway_state: present
+
+ - name: Uninstall powerflex gateway
+ ansible.builtin.import_role:
+ name: powerflex_gateway
+ vars:
+ powerflex_gateway_state: absent
+
+```
+
+## Notes
+- Supported only in PowerFlex version 3.6.
+
+## Usage instructions
+----
+### To install all dependency packages, including gateway, on node:
+ ```
+ ansible-playbook -i inventory site.yml
+ ```
+
+### To uninstall gateway:
+ ```
+ ansible-playbook -i inventory uninstall_powerflex.yml
+ ```
+
+Sample playbooks and inventory can be found in the playbooks directory.
+
+## Author Information
+------------------
+
+Dell Technologies <br>
+Bhavneet Sharma (ansible.team@Dell.com) 2023
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/defaults/main.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/defaults/main.yml
new file mode 100644
index 000000000..011911837
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/defaults/main.yml
@@ -0,0 +1,17 @@
+---
+# Is the gateway redundant (will install keepalived)
+powerflex_gateway_is_redundant: false
+# Virtual IP if redundant
+powerflex_gateway_virtual_ip: ''
+# Interface to attach the virtual ip
+powerflex_gateway_virtual_interface: eth1
+# Skip Java installation for PowerFlex (assume it's on the system)
+powerflex_gateway_skip_java: false
+# Disable GPG check to install PowerFlex gateway
+powerflex_gateway_disable_gpg_check: true
+powerflex_gateway_user_properties_file: /opt/emc/scaleio/gateway/webapps/ROOT/WEB-INF/classes/gatewayUser.properties
+powerflex_gateway_catalina_properties_file: /opt/emc/scaleio/gateway/conf/catalina.properties
+file_glob_name: gateway
+powerflex_role_environment:
+ MDM_IP: "{{ powerflex_mdm_ips }}"
+ GATEWAY_ADMIN_PASSWORD: "{{ powerflex_gateway_admin_password }}"
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/handlers/main.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/handlers/main.yml
new file mode 100644
index 000000000..ae7f1163f
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/handlers/main.yml
@@ -0,0 +1,6 @@
+---
+- name: Restart keepalived
+ ansible.builtin.service:
+ name: "keepalived"
+ state: "restarted"
+ enabled: true
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/meta/argument_specs.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/meta/argument_specs.yml
new file mode 100644
index 000000000..2fe8f150e
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/meta/argument_specs.yml
@@ -0,0 +1,47 @@
+---
+argument_specs:
+ main:
+ short_description: Role to manage the installation and uninstallation of
+ PowerFlex gateway
+ description:
+ - Role to manage the installation and uninstallation of PowerFlex gateway.
+ options:
+ powerflex_common_file_install_location:
+ type: path
+ 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
+ the PowerFlex software.
+ default: '/var/tmp'
+ powerflex_gateway_is_redundant:
+ type: bool
+ description: Is the gateway redundant (will install keepalived)
+ default: false
+ powerflex_gateway_admin_password:
+ required: true
+ type: str
+ description: Admin password for the PowerFlex gateway.
+ powerflex_gateway_http_port:
+ type: int
+ description: PowerFlex gateway HTTP port.
+ default: 80
+ powerflex_gateway_https_port:
+ type: int
+ description: PowerFlex gateway HTTPS port.
+ default: 443
+ powerflex_gateway_virtual_ip:
+ type: str
+ description: Virtual IP address of PowerFlex gateway.
+ powerflex_gateway_virtual_interface:
+ type: str
+ description: Virtual interface of PowerFlex gateway.
+ powerflex_gateway_state:
+ type: str
+ description: State of the PowerFlex gateway.
+ choices: ['present', 'absent']
+ default: 'present'
+ powerflex_gateway_skip_java:
+ type: bool
+ description: Specifies whether to install java or not.
+ default: false
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/meta/main.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/meta/main.yml
new file mode 100644
index 000000000..11db01ec5
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/meta/main.yml
@@ -0,0 +1,28 @@
+---
+galaxy_info:
+ role_name: powerflex_gateway
+ namespace: dellemc
+ author: Bhavneet Sharma
+ description: Role to manage the installation and uninstallation of Powerflex gateway
+ 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_gateway/molecule/gateway_installation/converge.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation/converge.yml
new file mode 100644
index 000000000..92183f3dc
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation/converge.yml
@@ -0,0 +1,29 @@
+---
+- name: Install gateway
+ hosts: gateway
+ gather_facts: true
+ tasks:
+ - name: Install and configure powerflex gateway
+ ansible.builtin.import_role:
+ name: "powerflex_gateway"
+ vars:
+ powerflex_gateway_state: present
+ register: powerflex_gateway_result_molecule
+
+ - 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
+ 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_gateway/molecule/gateway_installation/molecule.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation/molecule.yml
new file mode 100644
index 000000000..ed97d539c
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation/molecule.yml
@@ -0,0 +1 @@
+---
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation_invalid_path_rpm/converge.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation_invalid_path_rpm/converge.yml
new file mode 100644
index 000000000..258173d9a
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation_invalid_path_rpm/converge.yml
@@ -0,0 +1,32 @@
+---
+- name: Install gateway with invalid rpm path
+ hosts: gateway
+ gather_facts: true
+ tasks:
+ - name: Install and configure powerflex gateway with no rpm
+ ansible.builtin.import_role:
+ name: "powerflex_gateway"
+ vars:
+ powerflex_common_file_install_location: "/opt/empty"
+ powerflex_gateway_state: present
+ ignore_errors: true
+ register: powerflex_gateway_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 gateway with wrong file path
+ ansible.builtin.import_role:
+ name: "powerflex_gateway"
+ vars:
+ powerflex_common_file_install_location: "/opt/aaab"
+ powerflex_gateway_state: present
+ ignore_errors: true
+ register: powerflex_gateway_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_gateway/molecule/gateway_installation_invalid_path_rpm/molecule.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation_invalid_path_rpm/molecule.yml
new file mode 100644
index 000000000..93cad84c9
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_installation_invalid_path_rpm/molecule.yml
@@ -0,0 +1,4 @@
+---
+scenario:
+ test_sequence:
+ - converge
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_uninstallation/converge.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_uninstallation/converge.yml
new file mode 100644
index 000000000..6342d5f25
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_uninstallation/converge.yml
@@ -0,0 +1,48 @@
+---
+- name: Uninstall gateway
+ hosts: gateway
+ gather_facts: true
+ tasks:
+ - name: Uninstall powerflex gateway
+ ansible.builtin.import_role:
+ name: "powerflex_gateway"
+ vars:
+ powerflex_gateway_state: 'absent'
+
+ - name: Verifying uninstall package in check mode
+ ansible.builtin.assert:
+ that:
+ - powerflex_gateway_uninstall_output.msg == "Check mode: No changes made, but would have if not in check mode"
+ - powerflex_gateway_uninstall_output.changed is true
+ when: ansible_check_mode and ansible_distribution in ("RedHat", "CentOS", "SLES")
+
+ - name: Verifying uninstall package in converge
+ ansible.builtin.assert:
+ that:
+ - " 'Removed:' in powerflex_gateway_uninstall_output.results[0].results[0]"
+ when: not ansible_check_mode and powerflex_gateway_uninstall_output.changed and ansible_distribution in ("RedHat", "CentOS", "SLES")
+
+ - name: Verifying uninstall package in Idempotency
+ ansible.builtin.assert:
+ that:
+ - powerflex_gateway_uninstall_output.results[0].msg == 'Nothing to do'
+ when: not ansible_check_mode and not powerflex_gateway_uninstall_output.changed and ansible_distribution in ("RedHat", "CentOS", "SLES")
+
+ - name: Verifying uninstall package in check mode
+ ansible.builtin.assert:
+ that:
+ - powerflex_gateway_uninstall_deb_output.msg == "Check mode: No changes made, but would have if not in check mode"
+ - powerflex_gateway_uninstall_deb_output.changed is true
+ when: ansible_check_mode and ansible_distribution == "Ubuntu"
+
+ - name: Verifying uninstall package in converge
+ ansible.builtin.assert:
+ that:
+ - " 'Removed:' in powerflex_gateway_uninstall_deb_output.results[0].results[0]"
+ when: not ansible_check_mode and powerflex_gateway_uninstall_deb_output.changed and ansible_distribution == "Ubuntu"
+
+ - name: Verifying uninstall package in Idempotency
+ ansible.builtin.assert:
+ that:
+ - powerflex_gateway_uninstall_deb_output.results[0].msg == 'Nothing to do'
+ when: not ansible_check_mode and not powerflex_gateway_uninstall_deb_output.changed and ansible_distribution == "Ubuntu"
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_uninstallation/molecule.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_uninstallation/molecule.yml
new file mode 100644
index 000000000..ed97d539c
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/molecule/gateway_uninstallation/molecule.yml
@@ -0,0 +1 @@
+---
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/install_gateway.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/install_gateway.yml
new file mode 100644
index 000000000..58bbd1a08
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/install_gateway.yml
@@ -0,0 +1,52 @@
+---
+- name: Set Fact the powerflex_mdm_ips
+ ansible.builtin.set_fact:
+ powerflex_mdm_ips: "{{ hostvars[groups['mdm'][0]]['ansible_host'] }},{{ hostvars[groups['mdm'][1]]['ansible_host'] }}"
+
+- name: Install java
+ ansible.builtin.include_tasks: "../../powerflex_common/tasks/install_java_{{ ansible_distribution }}.yml"
+ when: not powerflex_gateway_skip_java
+
+- name: Set gateway admin password
+ ansible.builtin.set_fact:
+ token: "{{ powerflex_gateway_admin_password }}"
+
+- name: Include install_powerflex.yml
+ ansible.builtin.include_tasks: ../../powerflex_common/tasks/install_powerflex.yml
+
+- name: Include install_keepalived.yml
+ ansible.builtin.include_tasks: install_keepalived.yml
+ when: powerflex_gateway_is_redundant == "true"
+
+- name: Configure gateway with MDM addresses
+ ansible.builtin.lineinfile:
+ name: "{{ powerflex_gateway_user_properties_file }}"
+ regexp: '^mdm.ip.addresses'
+ line: "mdm.ip.addresses={{ powerflex_mdm_ips }}"
+ ignore_errors: "{{ ansible_check_mode }}"
+
+- name: Configure gateway to accept certificates
+ ansible.builtin.lineinfile:
+ name: "{{ powerflex_gateway_user_properties_file }}"
+ regexp: '^security.bypass_certificate_check'
+ line: "security.bypass_certificate_check=true"
+ ignore_errors: "{{ ansible_check_mode }}"
+
+- name: Configure gateway http port
+ ansible.builtin.lineinfile:
+ name: "{{ powerflex_gateway_catalina_properties_file }}"
+ regexp: '^http.port'
+ line: "http.port={{ powerflex_gateway_http_port }}"
+ ignore_errors: "{{ ansible_check_mode }}"
+
+- name: Configure gateway https port
+ ansible.builtin.lineinfile:
+ name: "{{ powerflex_gateway_catalina_properties_file }}"
+ regexp: '^ssl.port'
+ line: "ssl.port={{ powerflex_gateway_https_port }}"
+ ignore_errors: "{{ ansible_check_mode }}"
+
+- name: Restart service PowerFlex Gateway
+ ansible.builtin.service:
+ name: scaleio-gateway.service
+ state: restarted
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/install_keepalived.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/install_keepalived.yml
new file mode 100644
index 000000000..df6fd9dac
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/install_keepalived.yml
@@ -0,0 +1,28 @@
+---
+- name: Include vars
+ ansible.builtin.include_vars: "../vars/{{ ansible_distribution }}.yml"
+
+- name: Install required packages
+ ansible.builtin.package:
+ name: "{{ item }}"
+ state: present
+ with_items: "{{ keepalived_packages }}"
+
+- name: Set the priority of keepalived
+ ansible.builtin.set_fact:
+ keepalived_priority: 100
+ run_once: true
+
+- name: Set the priority of keepalived if not defined
+ ansible.builtin.set_fact:
+ keepalived_priority: 101
+ when: keepalived_priority is not defined
+
+- name: Configure keepalived
+ ansible.builtin.template:
+ src: keepalived.conf.j2
+ dest: "{{ keepalived_config_file_location }}/keepalived.conf"
+ mode: '0600'
+ owner: root
+ group: root
+ notify: restart keepalived
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/main.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/main.yml
new file mode 100644
index 000000000..80af948e2
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/main.yml
@@ -0,0 +1,8 @@
+---
+- name: Install Powerflex gateway
+ ansible.builtin.include_tasks: install_gateway.yml
+ when: powerflex_gateway_state == "present"
+
+- name: Uninstall Powerflex gateway
+ ansible.builtin.include_tasks: uninstall_gateway.yml
+ when: powerflex_gateway_state == "absent"
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/uninstall_gateway.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/uninstall_gateway.yml
new file mode 100644
index 000000000..39645d5a3
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/tasks/uninstall_gateway.yml
@@ -0,0 +1,20 @@
+---
+- name: Uninstall package
+ register: powerflex_gateway_uninstall_output
+ environment:
+ I_AM_SURE: "{{ i_am_sure | int }}"
+ ansible.builtin.package:
+ name: "{{ item }}"
+ state: "absent"
+ with_items:
+ - EMC-ScaleIO-gateway
+ when: ansible_distribution in ("RedHat", "CentOS", "SLES")
+
+- name: Uninstall deb package
+ register: powerflex_gateway_uninstall_deb_output
+ ansible.builtin.apt:
+ name: "{{ item }}"
+ state: absent
+ with_items:
+ - emc-scaleio-gateway
+ when: ansible_distribution == "Ubuntu"
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/templates/keepalived.conf.j2 b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/templates/keepalived.conf.j2
new file mode 100644
index 000000000..b9896823e
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/templates/keepalived.conf.j2
@@ -0,0 +1,18 @@
+vrrp_script chk_gateway { # Requires keepalived-1.1.13
+ script "killall -0 scaleio-gateway-wd.bash" # cheaper than pidof
+ interval 2 # check every 2 seconds
+ weight 2 # add 2 points of prio if OK
+}
+
+vrrp_instance gateway_vi_1 {
+ interface {{ powerflex_gateway_virtual_interface }}
+ state MASTER
+ virtual_router_id 51
+ priority {{ keepalived_priority }} # 101 on master, 100 on backup
+ virtual_ipaddress {
+ {{ powerflex_gateway_virtual_ip }}
+ }
+ track_script {
+ chk_gateway
+ }
+}
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/CentOS.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/CentOS.yml
new file mode 100644
index 000000000..cbb2739c1
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/CentOS.yml
@@ -0,0 +1,4 @@
+---
+keepalived_packages:
+ - keepalived
+keepalived_config_file_location: /etc/keepalived
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/RedHat.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/RedHat.yml
new file mode 100644
index 000000000..cbb2739c1
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/RedHat.yml
@@ -0,0 +1,4 @@
+---
+keepalived_packages:
+ - keepalived
+keepalived_config_file_location: /etc/keepalived
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/SLES.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/SLES.yml
new file mode 100644
index 000000000..cbb2739c1
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/SLES.yml
@@ -0,0 +1,4 @@
+---
+keepalived_packages:
+ - keepalived
+keepalived_config_file_location: /etc/keepalived
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/Ubuntu.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/Ubuntu.yml
new file mode 100644
index 000000000..cbb2739c1
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/Ubuntu.yml
@@ -0,0 +1,4 @@
+---
+keepalived_packages:
+ - keepalived
+keepalived_config_file_location: /etc/keepalived
diff --git a/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/main.yml b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/main.yml
new file mode 100644
index 000000000..6de60b1d3
--- /dev/null
+++ b/ansible_collections/dellemc/powerflex/roles/powerflex_gateway/vars/main.yml
@@ -0,0 +1,6 @@
+---
+file_glob_name: gateway
+file_gpg_name: RPM-GPG-KEY-ScaleIO
+powerflex_role_environment:
+ MDM_IP: "{{ powerflex_mdm_ips }}"
+ GATEWAY_ADMIN_PASSWORD: "{{ powerflex_gateway_admin_password }}"