Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
EOS-23494: Re-deployment fails on VM after running cortx_setup cluste…
Browse files Browse the repository at this point in the history
…r reset --type all (#6038)

* EOS-23494: Re-deployment fails on VM after running cortx_setup cluster reset --type all

Signed-off-by: Tanuja Shinde <[email protected]>

* EOS-23494: Re-deployment fails on VM after running cortx_setup cluster reset --type all

Signed-off-by: Tanuja Shinde <[email protected]>

* EOS-23494: Re-deployment fails on VM after running cortx_setup cluster reset --type all

Signed-off-by: Tanuja Shinde <[email protected]>

* EOS-23494: Re-deployment fails on VM after running cortx_setup cluster reset --type all

Signed-off-by: Tanuja Shinde <[email protected]>

* EOS-23494: Re-deployment fails on VM after running cortx_setup cluster reset --type all

Signed-off-by: Tanuja Shinde <[email protected]>

* EOS-23494: Re-deployment fails on VM after running cortx_setup cluster reset --type all

Signed-off-by: Tanuja Shinde <[email protected]>

Co-authored-by: Pritam Bhavsar <[email protected]>
  • Loading branch information
tanujashinde0405 and 83bhp authored Aug 12, 2021
1 parent 538ef0a commit 6836e08
Show file tree
Hide file tree
Showing 15 changed files with 589 additions and 6 deletions.
1 change: 1 addition & 0 deletions lr-cli/cortx_setup/commands/cluster/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ def run(self, **kwargs):

StatesApplier.apply(
[
"components.system.chrony.install",
"components.system.chrony.config",
"components.system.chrony.stop",
"components.system.chrony.start"
Expand Down
15 changes: 12 additions & 3 deletions lr-cli/cortx_setup/commands/cluster/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def run(self, **kwargs):
reset_type = kwargs.get('type')
cortx_components = get_reset_states()
non_cortx_components = get_pillar_data('reset/non_cortx_components')
system_components= get_pillar_data('reset/system_components')
self.node_list = get_cluster_nodes()

self.logger.debug(f"Reset to be done for type is {reset_type}")
Expand Down Expand Up @@ -168,13 +169,22 @@ def run(self, **kwargs):

self._destroy(
non_cortx_components,
stage=[
"reset"
]
)
self.logger.debug("Preparing Reset for system components")

self._destroy(
system_components,
stage=[
"teardown"
]
)
self.logger.debug("Preparing Reset for Provisioner commands")

provisioner_components = [
"system.reset",
"provisioner.salt.stop",
"system.storage.glusterfs.teardown.volume_remove",
"system.storage.glusterfs.teardown.stop",
Expand All @@ -187,9 +197,8 @@ def run(self, **kwargs):
self.logger.debug("Removing cluster id file")
self._run_cmd(['chattr -i /etc/cluster-id',
'rm -rf /etc/cluster-id'], self.node_list)
self._run_cmd(['mkdir -p /var/lib/seagate/cortx/provisioner/local/srv/pillar/groups/all'],
self.node_list)

self._run_cmd(['mkdir -p /var/lib/seagate/cortx/provisioner/local/srv/pillar/groups/all',
'mkdir -p /var/lib/seagate/cortx/provisioner/shared/locks'],self.node_list)

self.logger.debug("Performing provisioner cleanup")
self._run_cmd(list(map(lambda el: 'rm -rf ' + str(el),
Expand Down
3 changes: 2 additions & 1 deletion lr-cli/cortx_setup/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@
'/etc/yum.repos.d/RELEASE_FACTORY.INFO'
'/opt/seagate/cortx_configs/provisioner_generated',
'/opt/seagate/cortx/provisioner/pillar/groups/all',
'/var/lib/seagate/cortx/provisioner/shared/srv/pillar/groups/all'
'/var/lib/seagate/cortx/provisioner/shared/srv/pillar/groups/all',
'/opt/seagate/cortx_configs/provisioner_generated/srvnode-0.firewall'
]
4 changes: 2 additions & 2 deletions pillar/components/reset.sls
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ reset:
- misc_pkgs.consul
- misc_pkgs.openldap
- ha.haproxy
platform:
system_components:
system:
- system.chrony
- system.logrotate
- system.firewall
- misc_pkgs.rsyslog
- system.storage
- system.storage.multipath
- system
53 changes: 53 additions & 0 deletions srv/components/ha/corosync-pacemaker/reset.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# For any questions about this software or licensing,
# please email [email protected] or [email protected].
#

Remove user and group:
user.absent:
- name: hacluster
- purge: True
- force: True

{% for serv in ["corosync", "pacemaker", "pcsd"] %}
Stop service {{ serv }}:
service.dead:
- name: {{ serv }}
- enable: False
{% endfor %}

Remove pcs package:
cmd.run:
- name: "rpm -e --nodeps pcs pacemaker corosync fence-agents-ipmilan"

# Remove configuration directory:
# file.absent:
# - names:
# - /etc/corosync
# - /etc/pacemaker

Remove corosync-pacemaker data:
file.absent:
- names:
- /var/lib/corosync
- /var/lib/pacemaker
- /var/lib/pcsd
- /var/log/pcsd

# Enable and Start Firewall:
# cmd.run:
# - names:
# - systemctl enable firewalld
# - systemctl start firewalld
73 changes: 73 additions & 0 deletions srv/components/ha/haproxy/reset.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# For any questions about this software or licensing,
# please email [email protected] or [email protected].
#

Disable rsyslog:
service.dead:
- name: rsyslog
- enable: False

Remove haproxy config:
file.absent:
- name: /etc/haproxy

Remove haproxy 503 error code to http file:
file.absent:
- name: /etc/haproxy/errors/503.http

Remove haproxy config to enable logs:
file.absent:
- name: /etc/rsyslog.d/haproxy.conf

Remove logrotate config for haproxy to run hourly:
file.absent:
- name: /etc/cron.hourly/logrotate

Clean existing logrotate configuration to run daily:
file.absent:
- name: /etc/cron.daily/logrotate

Remove logrotate config for haproxy:
file.absent:
- name: /etc/logrotate.d/haproxy

Remove pcs package:
cmd.run:
- name: "rpm -e --nodeps haproxy"

Remove user haproxy:
user.absent:
- name: haproxy
- purge: True
- force: True

Reset selinux bool for haproxy:
selinux.boolean:
- name: haproxy_connect_any
- value: 0
- persist: True

Reset selinux bool for httpd:
selinux.boolean:
- name: httpd_can_network_connect
- value: false
- persist: True

Remove haproxy user to certs group:
group.present:
- name: certs
- delusers:
- haproxy
76 changes: 76 additions & 0 deletions srv/components/misc_pkgs/consul/reset.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# For any questions about this software or licensing,
# please email [email protected] or [email protected].
#

include:
- components.misc_pkgs.consul.stop

# Remove Consul:
# file.absent:
# - name: /opt/consul

# Remove consul from bash_profile:
# file.blockreplace:
# - name: ~/.bashrc
# - marker_start: '# DO NOT EDIT: Consul binaries'
# - marker_end: '# DO NOT EDIT: End'
# - content: ''

# Source bash_profile for consul cleanup:
# cmd.run:
# - name: source ~/.bashrc

# Remove Consul data directory:
# file.absent:
# - name: /opt/consul/data

# Remove Consul config directory:
# file.absent:
# - name: /etc/consul.d

# Remove Consul agent config file:
# file.absent:
# - name: /etc/consul.d/consul.json

# Remove Consul server config file:
# file.absent:
# - name: /etc/consul.d/consul_server.json
# - source: salt://components/misc_pkgs/consul/files/consul_server.json
# - mode: 640
# - template: jinja

# Remove Consul Agent Service:
# file.absent:
# - name: /etc/systemd/system/consul.service
# - source: salt://components/misc_pkgs/consul/files/consul.service
# - makedirs: True
# - mode: 644

# Reload service daemons post consul-agent.service removal:
# cmd.run:
# - name: systemctl daemon-reload

# Remove Consul user:
# user.absent:
# - name: consul

Remove Consul package:
cmd.run:
- name: "rpm -e --nodeps consul"

Delete consul checkpoint flag:
file.absent:
- name: /opt/seagate/cortx_configs/provisioner_generated/{{ grains['id'] }}.consul
43 changes: 43 additions & 0 deletions srv/components/misc_pkgs/elasticsearch/reset.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# For any questions about this software or licensing,
# please email [email protected] or [email protected].
#

include:
- components.misc_pkgs.elasticsearch.stop

Remove elasticsearch package:
cmd.run:
- name: "rpm -e --nodeps rsyslog-elasticsearch rsyslog-mmjsonparse opendistroforelasticsearch elasticsearch-oss opendistro-sql"

Remove opendistro package:
cmd.run:
- name: "rpm -e --nodeps opendistro-alerting opendistro-anomaly-detection opendistro-index-management opendistro-job-scheduler opendistro-knn opendistro-knnlib opendistro-performance-analyzer opendistro-reports-scheduler opendistro-security "

Remove elasticsearch config:
file.absent:
- name: /etc/elasticsearch

Remove elasticsearch data:
file.absent:
- name: /var/lib/elasticsearch

Remove elasticsearch logs:
file.absent:
- name: /var/log/elasticsearch

Delete elasticsearch checkpoint flag:
file.absent:
- name: /opt/seagate/cortx_configs/provisioner_generated/{{ grains['id'] }}.elasticsearch
44 changes: 44 additions & 0 deletions srv/components/misc_pkgs/kafka/reset.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# For any questions about this software or licensing,
# please email [email protected] or [email protected].
#


include:
- .stop

Remove kafka package:
cmd.run:
- name: "rpm -e --nodeps kafka"

Remove kafka directory:
file.absent:
- name: /opt/kafka

Remove zookeeper data directory:
file.absent:
- name: /var/lib/zookeeper

Remove zookeeper log directory:
file.absent:
- name: /var/log/zookeeper

Remove kafka log directory:
file.absent:
- name: /var/log/kafka

Remove kafka flag:
file.absent:
- name: /opt/seagate/cortx_configs/provisioner_generated/{{ grains['id'] }}.kafka
Loading

0 comments on commit 6836e08

Please sign in to comment.