Commit 2bd8a9c2 by tingweiwang

解决add_node.sh node节点安装docker没有分发定制flannel配置的docker.service

1 parent 1e9ddaf6
Showing with 2 additions and 0 deletions
...@@ -62,6 +62,8 @@ ansible new_node -m copy -a "src=/root/k8s/config/daemon.json_cpu dest=/tmp/" ...@@ -62,6 +62,8 @@ 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 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|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 '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'
echo "为新加节点拷贝自定义docker.service" && sleep 3 && \
ansible new_node -m copy -a "src=/root/k8s/service/docker.service dest=/lib/systemd/system/docker.service mode=755"
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"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!