Good afternoon all! long time lurker, first time poster here.
I am trying to use a script to remove an rpm remotely (foo). There are too many hosts to efficiently do this manually.
There are multiple versions of this *.rpm installed across the environment. So hardcoding the name in will not work. My solution, before, was to have a script that scp's a "removefoo.sh" to the remote host, with the following two bits inside:
INSTALL=$(rpm -qa | grep -i foo) rpm -e $INSTALL
And that worked... but this is not ideal as we would prefer to have one script "Do it all".
Obviously, putting that solution in this new script with will break as the script is ran from the management server, and it will attempt to remove the $INSTALL it gets from the management server, which doesn't even run this rpm...
The following did not help:
ssh -q $serverIP 'rpm -qa | grep -i foo ; rpm -e'
Anyone have a clue? I'm on RHEL 6 and 7 and everything else is fine (e.g. able to connect to hosts, etc.)