优化代码
This commit is contained in:
23
998-常用脚本/啊-Agent-WDD运行/a-AgentWdd-基础依赖.ps1
Normal file
23
998-常用脚本/啊-Agent-WDD运行/a-AgentWdd-基础依赖.ps1
Normal file
@@ -0,0 +1,23 @@
|
||||
# 定义字符串数组
|
||||
$array = @("docker-amd64-20.10.15.tgz", "docker-compose-linux-x86_64-v2.18.0", "rke_linux-amd64", "kubectl-1.20.4-amd64", "mysql-8.0.27-linux-glibc2.17-x86_64-minimal.zip")
|
||||
|
||||
# 使用mc.exe下载文件
|
||||
# 定义下载路径
|
||||
$mc_path = "C:\Users\86188\Downloads\mc.exe"
|
||||
|
||||
# 定义mc的前缀
|
||||
$mc_prefix = "uav-demo/cmlc-installation/downloadfile/amd/"
|
||||
|
||||
|
||||
# 函数设置mc alias
|
||||
Start-Process -FilePath $mc_path alias set uav-demo https://oss.demo.uavcmlc.com cmii B#923fC7mk
|
||||
|
||||
# 循环遍历数组
|
||||
foreach ($item in $array) {
|
||||
# 拼接下载命令
|
||||
Write-Output "start to download $mc_prefix$item"
|
||||
|
||||
$mc_path get $mc_prefix$item C:\Users\86188\Documents\cmii\
|
||||
|
||||
Write-Output ""
|
||||
}
|
||||
26
998-常用脚本/啊-Agent-WDD运行/a-AgentWdd-基础依赖.sh
Normal file
26
998-常用脚本/啊-Agent-WDD运行/a-AgentWdd-基础依赖.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 下载agent
|
||||
rm -f /usr/local/bin/agent-wdd
|
||||
rm -f /usr/local/bin/test-shell.sh
|
||||
|
||||
wget https://pan.107421.xyz/d/oracle-seoul-2/agent-wdd_linux_amd64 -qO /usr/local/bin/agent-wdd
|
||||
|
||||
chmod +x /usr/local/bin/agent-wdd
|
||||
|
||||
|
||||
# 下载依赖文件
|
||||
mkdir /root/wdd/
|
||||
cd /root/wdd
|
||||
|
||||
export oss_url_prefix=https://oss.demo.uavcmlc.com/cmlc-installation/downloadfile/amd
|
||||
# export oss_url_prefix=http://42.192.52.227:9000/octopus
|
||||
|
||||
wget ${oss_url_prefix}/docker-amd64-20.10.15.tgz
|
||||
wget ${oss_url_prefix}/docker-compose-linux-x86_64-v2.18.0
|
||||
|
||||
wget ${oss_url_prefix/harbor-offline-installer-v2.9.0.tgz
|
||||
wget ${oss_url_prefix}/rke_linux-amd64
|
||||
wget ${oss_url_prefix}/kubectl-1.20.4-amd64
|
||||
|
||||
|
||||
13
998-常用脚本/啊-Agent-WDD运行/octopus-agent-run.sh
Normal file
13
998-常用脚本/啊-Agent-WDD运行/octopus-agent-run.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# internet
|
||||
bash <(curl -sL http://42.192.52.227:9000/octopus/init-script-wdd.sh) --url http://42.192.52.227:9000/octopus --agent-install --offline
|
||||
|
||||
# no internet
|
||||
export offline_minio=103.0.180.82
|
||||
bash <(curl -sL http://${offline_minio}:9000/octopus/init-script-wdd.sh) --url http://${offline_minio}:9000/octopus --agent-install --offline
|
||||
|
||||
|
||||
mc alias set local http://localhost:9000 cmii B#923fC7mk
|
||||
mc get local/octopus/nfs-client-amd64-Ubuntu-20.04.6-LTS.tar.gz ./
|
||||
mc get local/octopus/nfs-server-amd64-Ubuntu-20.04.6-LTS.tar.gz ./
|
||||
62
998-常用脚本/啊-Agent-WDD运行/z-同步资料-废弃.sh
Normal file
62
998-常用脚本/啊-Agent-WDD运行/z-同步资料-废弃.sh
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/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 server in "${host_list[@]}";do
|
||||
echo "current ip is $server"
|
||||
ssh root@${server} "curl 172.24.152.72"
|
||||
done
|
||||
|
||||
|
||||
|
||||
10.129.80.245
|
||||
|
||||
wget http://42.192.52.227:9000/octopus/octopus-agent_linux_amd64
|
||||
mv octopus-agent_linux_amd64 /usr/local/bin/octopus-agent
|
||||
chmod +x /usr/local/bin/octopus-agent
|
||||
|
||||
|
||||
wget http://42.192.52.227:9000/octopus/docker-amd64-20.10.15.tgz
|
||||
|
||||
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/docker-compose-linux-x86_64-v2.18.0 root@${server}:/root/wdd/
|
||||
|
||||
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/disk.sh root@${server}:/root/wdd/
|
||||
ssh root@${server} "bash /root/wdd/disk.sh && lsblk"
|
||||
|
||||
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 'sshkey\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"
|
||||
|
||||
printf 'dockerconfig\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 'sshkey\n' | octopus-agent --mode=bastion
|
||||
printf 'sshconfig\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
|
||||
|
||||
printf 'dockerconfig\n' | octopus-agent --mode=bastion
|
||||
59
998-常用脚本/啊-Agent-WDD运行/啊-批量命令.sh
Normal file
59
998-常用脚本/啊-Agent-WDD运行/啊-批量命令.sh
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# 获取环境信息
|
||||
/usr/local/bin/agent-wdd info all
|
||||
cat /usr/local/etc/wdd/agent-wdd-config.yaml
|
||||
|
||||
# 手动执行全部的命令
|
||||
/usr/local/bin/agent-wdd base ssh key
|
||||
/usr/local/bin/agent-wdd base ssh config
|
||||
|
||||
/usr/local/bin/agent-wdd base tools
|
||||
/usr/local/bin/agent-wdd base swap
|
||||
/usr/local/bin/agent-wdd base firewall
|
||||
/usr/local/bin/agent-wdd base selinux
|
||||
/usr/local/bin/agent-wdd base sysconfig
|
||||
|
||||
|
||||
/usr/local/bin/agent-wdd base docker local
|
||||
/usr/local/bin/agent-wdd base dockercompose local
|
||||
|
||||
# 仅在主节点执行
|
||||
/usr/local/bin/agent-wdd base docker config
|
||||
|
||||
|
||||
# 批量执行命令
|
||||
|
||||
host_list=(
|
||||
172.16.100.50
|
||||
172.16.100.51
|
||||
172.16.100.52
|
||||
172.16.100.53
|
||||
172.16.100.54
|
||||
172.16.100.56
|
||||
172.16.100.57
|
||||
172.16.100.58
|
||||
172.16.100.59
|
||||
172.16.100.60
|
||||
172.16.100.61
|
||||
)
|
||||
for server in "${host_list[@]}";do
|
||||
echo "current ip is $server"
|
||||
# ssh root@${server} "echo yes"
|
||||
|
||||
scp /usr/local/bin/agent-wdd root@${server}:/usr/local/bin/agent-wdd
|
||||
ssh root@${server} "/usr/local/bin/agent-wdd base ssh config"
|
||||
ssh root@${server} "/usr/local/bin/agent-wdd base ssh key"
|
||||
done
|
||||
|
||||
# 复制 同步文件
|
||||
|
||||
scp /usr/local/bin/agent-wdd root@${server}:/usr/local/bin/agent-wdd
|
||||
ssh root@${server} "/usr/local/bin/agent-wdd base ssh config"
|
||||
ssh root@${server} "/usr/local/bin/agent-wdd base ssh key"
|
||||
|
||||
ssh root@${server} "mkdir /root/wdd"
|
||||
scp /root/wdd/docker-amd64-20.10.15.tgz root@${server}:/root/wdd/docker-amd64-20.10.15.tgz
|
||||
scp /root/wdd/docker-compose-linux-x86_64-v2.18.0 root@${server}:/root/wdd/
|
||||
|
||||
Reference in New Issue
Block a user