feat(pillar-4): complete dual-npm keepalived HA cluster on VIP 140.44.4.70
This commit is contained in:
24
scripts/setup_dual_npm_cluster.py
Normal file
24
scripts/setup_dual_npm_cluster.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import paramiko
|
||||
import json
|
||||
import time
|
||||
|
||||
def main():
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect('140.44.4.71', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
print("=== STEP 1: Add node labels 'npm=true' to swm01 (.71) and swm02 (.72) ===")
|
||||
stdin, stdout, stderr = ssh.exec_command('sudo docker node update --label-add npm=true snshpd4lnxswm01 && sudo docker node update --label-add npm=true snshpd4lnxswm02')
|
||||
print("Labels update:", stdout.read().decode().strip(), stderr.read().decode().strip())
|
||||
|
||||
# Check node labels
|
||||
stdin, stdout, stderr = ssh.exec_command("sudo docker node inspect snshpd4lnxswm01 --format '{{json .Spec.Labels}}'")
|
||||
print("Labels swm01:", stdout.read().decode().strip())
|
||||
stdin, stdout, stderr = ssh.exec_command("sudo docker node inspect snshpd4lnxswm02 --format '{{json .Spec.Labels}}'")
|
||||
print("Labels swm02:", stdout.read().decode().strip())
|
||||
|
||||
ssh.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user