ceph crushmap and auth updates in remove node pipeline
Change-Id: Ic63f35fca3fc9b812c03b4b1ef4ada70170a3208
diff --git a/ceph-remove-node.groovy b/ceph-remove-node.groovy
index 6387b20..b34de91 100644
--- a/ceph-remove-node.groovy
+++ b/ceph-remove-node.groovy
@@ -95,7 +95,7 @@
if (HOST_TYPE.toLowerCase() != 'osd') {
// virsh destroy rgw04.deploy-name.local; virsh undefine rgw04.deploy-name.local;
- stage('Destroy VM') {
+ stage('Destroy/Undefine VM') {
_pillar = salt.getGrain(pepperEnv, 'I@salt:control', 'id')
def kvm01 = _pillar['return'][0].values()[0].values()[0]
@@ -225,6 +225,15 @@
runCephCommand(pepperEnv, HOST, 'apt purge ceph-base ceph-common ceph-fuse ceph-mds ceph-osd python-cephfs librados2 python-rados -y')
}
+ stage('Remove OSD host from crushmap') {
+ def hostname = runCephCommand(pepperEnv, HOST, "hostname -s")['return'][0].values()[0].split('\n')[0]
+ try {
+ runCephCommand(pepperEnv, ADMIN_HOST, "ceph osd crush remove ${hostname}")
+ } catch (Exception e) {
+ common.warningMsg(e)
+ }
+ }
+
// stop salt-minion service and move its configuration
stage('Stop salt-minion') {
salt.cmdRun(pepperEnv, HOST, "mv /etc/salt/minion.d/minion.conf minion.conf")
@@ -245,6 +254,25 @@
}
}
+ stage('Remove keyring') {
+ def keyring = ""
+ def keyring_lines = ""
+ try {
+ keyring_lines = runCephCommand(pepperEnv, ADMIN_HOST, "ceph auth list | grep ${target}")['return'][0].values()[0].split('\n')
+ } catch (Exception e) {
+ common.warningMsg(e)
+ }
+ for (line in keyring_lines) {
+ if (line.toLowerCase().contains(target.toLowerCase())) {
+ keyring = line
+ break
+ }
+ }
+ if (keyring?.trim()) {
+ runCephCommand(pepperEnv, ADMIN_HOST, "ceph auth del ${keyring}")
+ }
+ }
+
if (HOST_TYPE.toLowerCase() == 'mon') {
// Update Monmap
stage('Update monmap') {