Files
CmiiDeploy/17-重庆林业局/00-install-all-demand-softwares.sh
zeaslity 437acbeb63 add
2024-10-30 16:30:51 +08:00

61 lines
3.3 KiB
Bash

#!/bin/bash
all_ip_list=(192.168.0.6 192.168.0.19 192.168.0.8 192.168.0.3 192.168.0.13)
#all_ip_list=(192.168.0.19 192.168.0.8 192.168.0.3 192.168.0.13)
#all_ip_list=(192.168.0.6)
install_docker_manual(){
local DOCKER_VERSION="20.10.15"
apt-cache madison docker-ce | grep $(echo ${DOCKER_VERSION} | cut -d"." -f1) | awk '{print$3}'
local dockerSpecific=$(apt-cache madison docker-ce | grep $(echo ${DOCKER_VERSION} | cut -d"." -f1) | awk '{print$3}' | grep ${DOCKER_VERSION})
apt-get install -y "docker-ce=${dockerSpecific}" "docker-ce-cli=${dockerSpecific}" "containerd.io" "docker-compose-plugin" "docker-ce-rootless-extras=${dockerSpecific}"
}
install_docker_manual
install_ssh_key(){
echo "yes"
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCcQyyavsRj54vwDBQsbVPSAugsqi0DKQG8JhZNs1719D/6iGomyq1U+095RLDiEKmLQNu3lEnIeqIds2YYR4JVgUoPKI/c6/k5NdR7fOFLWIWd4DX3crWcArBRHuKXTZnQoYPcC9I5Y7+LgRFHzAOOSrUswIOZ/zLZ5JaJUBO/imyYUlS9lXLKXf7M6iMpbNQ6EHfLdKJgSmkxQbfjrSAC1EDO9M4sMU109hBVjB7s/+Q/5f9FeVLEMP1ShxNoWk5ljTjuHCCZoP7JAiZf4e1d6SI6acMwv4ohluPSeN0torPRqMNcTqe/Ty4pWBxWDCYrsJX8F33SwmApyCyn2Ykjgd1fQCa63ATZqENpffZRapAHzxQ7jQGCO8gktKQ6wqHsxfaUx/Zey4OCvvzzkAkTgXAfGHugnPvMPawBcOvPZ+ta7aYIlhSJL9UT/8KWMVDypFrnveLyP/Z0+Qa+freKeyo/rRXS++C+0tV4shKKt+HluhWcDDVbYc4bAqk0iioecAbw42x5hvhVZpb7JqbvU2jnc1n8np3g0/rqJbySWFYVVwigbXnI/DFQG+qZgKz17qjJ7hS78xFxy0FY2+NH0QUXwxa/XwFuIUcObW9oCOVhrNXnmn//Lm9b01mcJixMmoiQeodDQ0pG1pyTRqxA5CBgaH/LB5jWgy0hnjJlAQ== root@ecs-web" >> /root/.ssh/authorized_keys
}
install_octopus_agent(){
local server
for server in "${all_ip_list[@]}";do
echo "current servr is ${server}"
ssh root@"${server}" "echo yes"
# ssh root@"${server}" "rm -rf init-script-wdd.sh && wget http://192.168.0.6:9000/octopus/init-script-wdd.sh -O init-script-wdd.sh && chmod +x init-script-wdd.sh && bash init-script-wdd.sh --url http://192.168.0.6:9000/octopus --agent-install --offline"
# scp /usr/local/etc/octpus-agent/octopus-agent.conf root@${server}:/usr/local/etc/octpus-agent/octopus-agent.conf
# scp /etc/systemd/system/octopus-agent.service root@${server}:/etc/systemd/system/octopus-agent.service
# ssh root@"${server}" "sed -i s/OFFLINE_HOST_IP/192.168.0.6/g /usr/local/etc/octpus-agent/octopus-agent-standard.yaml"
# ssh root@"${server}" "sed -i s/-T10/-T3/g /usr/local/etc/octpus-agent/lib/wdd-lib-env.sh"
# ssh root@"${server}" "bash /usr/local/etc/octpus-agent/lib/wdd-lib-env.sh"
# ssh root@"${server}" "systemctl daemon-reload && systemctl start octopus-agent && systemctl enable octopus-agent"
# ssh root@"${server}" "systemctl restart octopus-agent"
# ssh root@"${server}" "mkdir -p /root/wdd/offline/nfs_common/"
# scp -r /root/wdd/offline/nfs_common/ root@${server}:/root/wdd/offline/nfs_common/
# ssh root@"${server}" "ls /root/wdd/offline/nfs_common/"
# ssh root@"${server}" "dpkg -i /root/wdd/offline/nfs_common/nfs_common/*.deb"
# ssh root@"${server}" "sed -i \"s/net.ipv4.conf.all.accept_redirects=0/net.ipv4.conf.all.accept_redirects=1/g\" /etc/sysctl.conf"
# ssh root@"${server}" "sed -i \"s/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g\" /etc/sysctl.conf"
# ssh root@"${server}" "sysctl -p"
# ssh root@"${server}" "systemctl restart docker"
ssh root@"${server}" "docker restart $(docker ps -aq)"
done
}
#install_octopus_agent