From 3299c3beed73fbea9241d017c64571903faea08b Mon Sep 17 00:00:00 2001 From: gjmzj Date: Wed, 12 Jun 2019 16:03:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20docker=E8=BF=90=E8=A1=8Ckubeasz=E6=97=B6?= =?UTF-8?q?=E5=88=A4=E6=96=ADansible=E6=8E=A7=E5=88=B6=E7=AB=AF=E4=B8=8Ede?= =?UTF-8?q?ploy=E8=8A=82=E7=82=B9=E5=88=86=E7=A6=BB=E7=9A=84=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/deploy/tasks/main.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/roles/deploy/tasks/main.yml b/roles/deploy/tasks/main.yml index 69a46fa..034a603 100644 --- a/roles/deploy/tasks/main.yml +++ b/roles/deploy/tasks/main.yml @@ -117,6 +117,11 @@ - name: 移动 kube-proxy.kubeconfig shell: "mv /root/kube-proxy.kubeconfig /etc/kubernetes/" +# 检查deploy节点是否有 kubeasz 代码,有的话说明deploy节点就是ansible控制节点 +- name: 获取当前节点是否有 kubeasz 相关代码 + shell: 'ls /etc/ansible/README.md || echo "NotFound"' + register: kubeasz_files + # --- 以下为兼容ansible执行节点与deploy节点分离情况------- - block: - name: 在 ansible 执行节点创建 .kube 目录 @@ -143,4 +148,6 @@ - id_rsa.pub - known_hosts run_once: true - when: "ansible_env['SSH_CLIENT'].split(' ')[0] != inventory_hostname" + when: + - "'NotFound' in kubeasz_files.stdout" + - "ansible_env['SSH_CLIENT'].split(' ')[0] != inventory_hostname"