Cleanup Openstack Script
When I am working on the openstack, I found that my design is not a right design. So I have to restart it from a scratch. I wrote a script to clean up the openstack. Any comments are welcome!
Another best way to do that is to take a snapshot before implementing the openstack if snapshot is an option.
rebuild openstack:
for i in `systemctl list-unit-files |grep openstack |grep enabled |awk '{print $1}'`; do systemctl stop $i; systemctl disable $i; done
for i in `systemctl list-unit-files |grep neutron |grep enabled |awk '{print $1}'`; do systemctl stop $i; systemctl disable $i; done
for i in `systemctl list-unit-files |grep rabbitmq |grep enabled |awk '{print $1}'`; do systemctl stop $i; systemctl disable $i; done
for i in "openvswitch ip6tables ovsdb-server ovs-vswitchd neutron-server httpd libvirtd virtlockd iscsi redis memcached gssproxy ksmtuned tuned"
do
systemctl stop $i
systemctl disable $i
done
cd /etc/openvswitch
mv conf.db conf.db.ORIG
cd /etc/libvirt/
mv virtlogd.conf virtlogd.conf.ORIG
mv virtlockd.conf virtlockd.conf.ORIG
mv qemu-lockd.conf qemu-lockd.conf.ORIG
mv qemu.conf qemu.conf.ORIG
mv libvirt.conf libvirt.conf.ORIG
mv libvirt-admin.conf libvirt-admin.conf.ORIG
mv libvirtd.conf libvirtd.conf.ORIG
cd /etc/neutron
mv neutron.conf neutron.conf.ORIG
cd /etc/nova
mv nova.conf nova.conf.ORIG
yum erase puppet-vswitch python2-openvswitch openvswitch python2-openstacksdk openstack-keystone openstack-swift-container openstack-selinux puppet-openstack_extras openstack-swift-proxy centos-release-openstack-rocky
yum erase openstack-glance openstack-aodh openstack-swift-object python-openstackclient-lang openssh-server openstack-aodh-common openstack-aodh-notifier openstack-swift-account puppet-openstacklib
yum erase python2-novaclient openstack-nova-migration openstack-nova-placement openstack-nova-common openstack-nova-scheduler openstack-nova-console puppet-nova openstack-nova-compute python-nova openstack-nova-conductor openstack-nova-novncproxy openstack-nova-api
yum erase puppet-rabbitmq rabbitmq-server
rm -rf /etc/rabbitmq/ /etc/swift/ /var/run/nova /etc/panko /etc/neutron/ /etc/nova/ /var/lib/mysql/
Another best way to do that is to take a snapshot before implementing the openstack if snapshot is an option.
rebuild openstack:
for i in `systemctl list-unit-files |grep openstack |grep enabled |awk '{print $1}'`; do systemctl stop $i; systemctl disable $i; done
for i in `systemctl list-unit-files |grep neutron |grep enabled |awk '{print $1}'`; do systemctl stop $i; systemctl disable $i; done
for i in `systemctl list-unit-files |grep rabbitmq |grep enabled |awk '{print $1}'`; do systemctl stop $i; systemctl disable $i; done
for i in "openvswitch ip6tables ovsdb-server ovs-vswitchd neutron-server httpd libvirtd virtlockd iscsi redis memcached gssproxy ksmtuned tuned"
do
systemctl stop $i
systemctl disable $i
done
cd /etc/openvswitch
mv conf.db conf.db.ORIG
cd /etc/libvirt/
mv virtlogd.conf virtlogd.conf.ORIG
mv virtlockd.conf virtlockd.conf.ORIG
mv qemu-lockd.conf qemu-lockd.conf.ORIG
mv qemu.conf qemu.conf.ORIG
mv libvirt.conf libvirt.conf.ORIG
mv libvirt-admin.conf libvirt-admin.conf.ORIG
mv libvirtd.conf libvirtd.conf.ORIG
cd /etc/neutron
mv neutron.conf neutron.conf.ORIG
cd /etc/nova
mv nova.conf nova.conf.ORIG
yum erase puppet-vswitch python2-openvswitch openvswitch python2-openstacksdk openstack-keystone openstack-swift-container openstack-selinux puppet-openstack_extras openstack-swift-proxy centos-release-openstack-rocky
yum erase openstack-glance openstack-aodh openstack-swift-object python-openstackclient-lang openssh-server openstack-aodh-common openstack-aodh-notifier openstack-swift-account puppet-openstacklib
yum erase python2-novaclient openstack-nova-migration openstack-nova-placement openstack-nova-common openstack-nova-scheduler openstack-nova-console puppet-nova openstack-nova-compute python-nova openstack-nova-conductor openstack-nova-novncproxy openstack-nova-api
yum erase puppet-rabbitmq rabbitmq-server
rm -rf /etc/rabbitmq/ /etc/swift/ /var/run/nova /etc/panko /etc/neutron/ /etc/nova/ /var/lib/mysql/
Comments