#!/bin/bash

host_list=(10.129.80.217)
host_list=(10.129.80.218 10.129.80.245 10.129.80.222 10.129.80.223)

host_list=(10.129.80.217 10.129.80.245 10.129.80.222 10.129.80.223)

for ip in "${host_list[@]}";do
   echo "current ip is $ip"
   ssh root@${server} "curl 172.24.152.72"
done


disk

10.129.80.245

mv /root/wdd/octopus-agent_linux_amd64 /usr/local/bin/octopus-agent
chmod +x /usr/local/bin/octopus-agent


ssh root@${server} "mkdir /root/wdd"
scp /usr/local/bin/octopus-agent root@${server}:/usr/local/bin/octopus-agent
scp /root/wdd/docker-amd64-20.10.15.tgz root@${server}:/root/wdd/docker-amd64-20.10.15.tgz
scp /root/wdd/nfs_client_22.04.4_amd64.tar.gz root@${server}:/root/wdd/
scp /root/wdd/nfs_server_22.04.4_amd64.tar.gz root@${server}:/root/wdd/
scp /root/wdd/docker-compose-linux-x86_64-v2.18.0  root@${server}:/root/wdd/

ssh root@${server} "chmod +x /usr/local/bin/octopus-agent"
ssh root@${server} "printf 'firewall\n' | octopus-agent --mode=bastion"
ssh root@${server} "printf 'sysconfig\n' | octopus-agent --mode=bastion"
ssh root@${server} "printf 'swap\n' | octopus-agent --mode=bastion"
ssh root@${server} "printf 'selinux\n' | octopus-agent --mode=bastion"
ssh root@${server} "printf 'docker\n' | octopus-agent --mode=bastion"
ssh root@${server} "printf 'dockercompose\n' | octopus-agent --mode=bastion"

scp /etc/docker/daemon.json root@${server}:/etc/docker/

ssh root@${server} "systemctl restart docker && sleep 3 && docker info"

sed -i '/^$/d' ~/.ssh/*

chmod +x /usr/local/bin/octopus-agent
printf 'firewall\n' | octopus-agent --mode=bastion
printf 'sysconfig\n' | octopus-agent --mode=bastion
printf 'swap\n' | octopus-agent --mode=bastion
printf 'selinux\n' | octopus-agent --mode=bastion
printf 'docker\n' | octopus-agent --mode=bastion
printf 'dockercompose\n' | octopus-agent --mode=bastion
