
I went ahead and tried to add this script to the appropriate section of the ovirt.org website. Opened a pull request here: https://github.com/oVirt/ovirt-site/pull/1650 On Thu, Jun 14, 2018 at 10:15 AM, RabidCicada <rabidcicada@gmail.com> wrote:
All, I put together a full purge ansible script for CentOS. I figured I'd share it here. I ran into many issues with spurious failures of installs when I would try to reinstall ovirt on CentOS after having "removed" it.
I was developing an automated install of our own software along with ovirt but along the way I had to reinstall on the same box numerous times. Initially I'd get spurious failures from leftover cruft that would get in the way. I eventually found this:https://www.ovirt.org/documentation/how-to/hosted-engine/#recoving-from-fail... and then crafted my own ansible purge script.
It uses ovirts own engine cleanup script first if it exists, then fully cleans every other thing that can affect it.
Tested on CentOS, probably will work on other distros without too much trouble. Hopefully someone saves themselves some grief
- name: Clean Old Install
#This attempts to remove all old cruft from previous install attempts
#The reason we include the ovirt packages is so that they can be reinstall
#At potentially newer versions along with dependency packages
block:
- name: Detect existing cleanup script
shell: which ovirt-hosted-engine-cleanup | cat
register: ohes_cleanup
- name: Debug ohes_cleanup.stdout
debug:
var: ohes_cleanup.stdout
- name: Run Ovirt's Hosted Engine Cleanup Script
shell: ovirt-hosted-engine-cleanup -q
when: ohes_cleanup.stdout != ""
- name: Clean old packages
package:
name: "{{item}}"
state: absent
with_items:
- "*vdsm*"
- "*ovirt*"
- "*libvirt*"
- "*cockpit*"
- name: Remove old configs etc
shell: "rm -rf /etc/{{item}}"
args:
warn: False
with_items:
- "/etc/*ovirt*"
- "/etc/*vdsm*"
- "/etc/libvirt/qemu/HostedEngine*"
- "/etc/*libvirt*"
- "/etc/guacamole"
- "/etc/pki/vdsm"
- "/etc/pki/libvirt"
- "/etc/pki/CA"
- "/etc/pki/keystore"
- "/etc/ovirt-hosted-engine"
- "/var/lib/libvirt/"
- "/var/lib/vdsm/"
- "/var/lib/ovirt-hosted-engine-*"
- "/var/log/ovirt-hosted-engine-setup/"
- "/var/cache/libvirt/"
- "/etc/libvirt/nwfilter/vdsm-no-mac-spoofing.xml"
- "/var/cache/tomcat/temp/*"
- "/var/cache/tomcat/work/Catalina/localhost/*"
- "/usr/share/tomcat/webapps/guacamole"
- "/usr/share/tomcat/webapps/guacamole.war"
- "/etc/guacamole/extensions/guacamole*"
- name: Clean old repo files
shell: "rm -rf /etc/yum.repos.d/{{item}}"
args:
warn: False
with_items:
- "ovirt*"
- "virt*"
- name: clean interface configs
shell: "rm -rf /etc/sysconfig/network-scripts/ifcfg-ovirtmgmt"
args:
warn: False
- name: clean network stuff
shell: "{{item}}"
args:
warn: False
with_items:
- "brctl delbr ovirtmgmt | cat"
- "ip link del ovirtmgmt | cat"
- "ip link del dummy0 | cat"
- "ip link del virbr0 | cat"
- "ip link del virbr0-nic | cat"
- 'ip link del \;vdsmdummy\; | cat'