Commit f701adc6 by tingweiwang

fix bug

1 parent fdde8fe1
Showing with 3 additions and 2 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` -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 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` -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 'if [ `lspci |grep -i nvidia|wc -l` -gt 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"
...@@ -73,6 +73,7 @@ sed -i s/$harbor_host/harbor_host/g /root/k8s/config/daemon.json_cpu ...@@ -73,6 +73,7 @@ sed -i s/$harbor_host/harbor_host/g /root/k8s/config/daemon.json_cpu
:<< :<<
test=`lspci |grep -i nvidia` test=`lspci |grep -i nvidia`
if [ $test -ep 0 ];then if [ $test -ep 0 ];then
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!