Commit fdde8fe1 by tingweiwang

Update add_node.sh

1 parent 500736f7
Showing with 4 additions and 4 deletions
...@@ -61,8 +61,8 @@ ansible new_node -m copy -a "src=/root/k8s/config/daemon.json_gpu dest=/tmp/" ...@@ -61,8 +61,8 @@ ansible new_node -m copy -a "src=/root/k8s/config/daemon.json_gpu dest=/tmp/"
ansible new_node -m copy -a "src=/root/k8s/config/daemon.json_cpu dest=/tmp/" ansible new_node -m copy -a "src=/root/k8s/config/daemon.json_cpu dest=/tmp/"
################################################################################ ################################################################################
echo "判断当前节点是gpu,还是cpu节点,根据节点不同,完成不同操作&& sleep 2" echo "判断当前节点是gpu,还是cpu节点,根据节点不同,完成不同操作&& sleep 2"
ansible new_node -m shell -a 'if [ `lspci |grep -i nvidia |wc -l` -gt 1 ]; then echo "gpu节点安装docker && apt install nvidia-docker2 docker-ce --allow-unauthenticated -y"; else echo "cpu节点安装docker"&& apt install docker-ce --allow-unauthenticated -y ; fi' ansible new_node -m shell -a 'if [ `lspci |grep -i nvidia` -ep 0 ]; then echo "gpu节点安装docker && apt install nvidia-docker2 docker-ce --allow-unauthenticated -y"; else echo "cpu节点安装docker"&& apt install docker-ce --allow-unauthenticated -y ; fi'
ansible new_node -m shell -a 'if [ `lspci |grep -i nvidia |wc -l` -gt 1 ]; then echo "gpu节点分发自己节点tmp目录下的daemon.json && mv /tmp/daemon.json_gpu /etc/docker/daemon.json"; else echo "cpu节点分发自己节点tmp目录下的daemon.json"&& mv /tmp/daemon.json_cpu /etc/docker/daemon.json; fi' ansible new_node -m shell -a 'if [ `lspci |grep -i nvidia` -ep 0 ]; then echo "gpu节点分发自己节点tmp目录下的daemon.json && mv /tmp/daemon.json_gpu /etc/docker/daemon.json"; else echo "cpu节点分发自己节点tmp目录下的daemon.json"&& mv /tmp/daemon.json_cpu /etc/docker/daemon.json; fi'
ansible new_node -m shell -a "service docker restart" ansible new_node -m shell -a "service docker restart"
ansible new_node -m shell -a "service docker status" ansible new_node -m shell -a "service docker status"
ansible new_node -m shell -a "cat /etc/docker/daemon.json" ansible new_node -m shell -a "cat /etc/docker/daemon.json"
...@@ -74,8 +74,8 @@ sed -i s/$harbor_host/harbor_host/g /root/k8s/config/daemon.json_cpu ...@@ -74,8 +74,8 @@ sed -i s/$harbor_host/harbor_host/g /root/k8s/config/daemon.json_cpu
:<< :<<
test=`lspci |grep -i vga |wc -l` test=`lspci |grep -i nvidia`
if [ $test -gt 1 ];then if [ $test -ep 0 ];then
echo "当前节点是GPU节点,开始配置gpu类型docker" && sleep 2 && apt install nvidia-docker2 --allow-unauthenticated -y echo "当前节点是GPU节点,开始配置gpu类型docker" && sleep 2 && apt install nvidia-docker2 --allow-unauthenticated -y
echo "当前harbor仓库地址为$harbor_host" echo "当前harbor仓库地址为$harbor_host"
sed -i s/harbor_host/$harbor_host/g /root/k8s/config/daemon.json_gpu sed -i s/harbor_host/$harbor_host/g /root/k8s/config/daemon.json_gpu
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!