#!/bin/bash host_list=(10.129.80.217) host_list=(134.80.124.6 134.80.124.7 134.80.124.8 134.80.124.9 134.80.124.10 134.80.124.11 134.80.124.12 134.80.124.13 134.80.124.14 134.80.124.15 134.80.124.16 134.80.124.17 134.80.124.18 134.80.124.19 134.80.124.20 134.80.124.21 134.80.124.22) host_list=(10.129.80.217 10.129.80.245 10.129.80.222 10.129.80.223) host_list=(134.80.124.6 134.80.124.7 134.80.124.8 134.80.124.9 134.80.124.10 134.80.124.11 134.80.124.12 134.80.124.13 134.80.124.14 134.80.124.15 134.80.124.16 134.80.124.17 134.80.124.18 134.80.124.19 134.80.124.20 134.80.124.21 134.80.124.22) for ip in "${host_list[@]}";do echo "current ip is $ip" ssh root@${ip} "echo yes" echo "" ssh root@${ip} "systemctl stop ntpd" ssh root@${ip} "systemctl disable ntpd" ssh root@${ip} "sed -i '/^pool pool.ntp.org iburst/a server 10.19.244.52 iburst' /etc/chrony.conf && sed -i 's/^pool pool.ntp.org iburst/# &/' /etc/chrony.conf" ssh root@${ip} "systemctl start chronyd" ssh root@${ip} "systemctl enable chronyd" sleep 3 ssh root@${ip} "timedatectl status" ssh root@${ip} "chronyc sourcestats" echo "" done systemctl stop ntpd systemctl disable ntpd sed -i '/^pool pool.ntp.org iburst/a server 10.19.244.52 iburst' /etc/chrony.conf && sed -i 's/^pool pool.ntp.org iburst/# &/' /etc/chrony.conf systemctl start chronyd systemctl enable chronyd sleep 3 chronyc sourcestats host_list=(134.80.124.17 134.80.124.18 134.80.124.19 134.80.124.20 134.80.124.21 134.80.124.22) for ip in "${host_list[@]}";do echo "current ip is $ip" ssh root@${ip} "echo yes" echo "" scp /home/aiox/*.rpm root@${ip}:/home/aiox/ ssh root@${ip} "rpm -ivh /home/aiox/compat-openssl10-1.0.2o-3.el8.x86_64.rpm" ssh root@${ip} "rpm -ivh /home/aiox/ntpdate-4.2.6p5-22.el7.centos.2.x86_64.rpm" ssh root@${ip} "rpm -ivh /home/aiox/ntp-4.2.6p5-22.el7.centos.2.x86_64.rpm" ssh root@${ip} "systemctl start ntpd" ssh root@${ip} "systemctl enable ntpd" ssh root@${ip} "timedatectl status" echo "" done sed -i rpm -ivh /home/aiox/compat-openssl10-1.0.2o-3.el8.x86_64.rpm rpm -ivh /home/aiox/ntpdate-4.2.6p5-22.el7.centos.2.x86_64.rpm rpm -ivh /home/aiox/ntp-4.2.6p5-22.el7.centos.2.x86_64.rpm systemctl start ntpd systemctl enable ntpd timedatectl status mv /home/aiox/octopus-agent_linux_amd64 /usr/local/bin/octopus-agent chmod +x /usr/local/bin/octopus-agent ssh root@${ip} "mkdir /root/wdd" scp octopus-agent root@${ip}:/root/wdd/ scp /root/wdd/docker-amd64-20.10.15.tgz root@${ip}:/root/wdd/ scp /root/wdd/nfs_client_22.04.4_amd64.tar.gz root@${ip}:/root/wdd/ scp /root/wdd/nfs_server_22.04.4_amd64.tar.gz root@${ip}:/root/wdd/ scp /root/wdd/docker-compose-linux-x86_64-v2.18.0 root@${ip}:/root/wdd/ ssh root@${ip} "chmod +x /usr/local/bin/octopus-agent" ssh root@${ip} "printf 'firewall\n' | octopus-agent --mode=bastion" ssh root@${ip} "printf 'sysconfig\n' | octopus-agent --mode=bastion" ssh root@${ip} "printf 'swap\n' | octopus-agent --mode=bastion" ssh root@${ip} "printf 'selinux\n' | octopus-agent --mode=bastion" ssh root@${ip} "printf 'docker\n' | octopus-agent --mode=bastion" ssh root@${ip} "printf 'dockercompose\n' | octopus-agent --mode=bastion" printf 'dockerconfig\n' | octopus-agent --mode=bastion ssh root@${ip} "mkdir /etc/docker" scp /etc/docker/daemon.json root@${ip}:/etc/docker/ ssh root@${ip} "systemctl restart docker && sleep 3 && docker info" sleep 3 sed -i '/^$/d' ~/.ssh/* printf 'rke\n' | octopus-agent --mode=bastion