diff --git a/roles/deploy/tasks/main.yml b/roles/deploy/tasks/main.yml index d6865d9..edeb00a 100644 --- a/roles/deploy/tasks/main.yml +++ b/roles/deploy/tasks/main.yml @@ -103,13 +103,19 @@ - name: 本地创建 easzctl 工具的软连接 file: src={{ base_dir }}/tools/easzctl dest=/usr/bin/easzctl state=link -# ---------- +# ansible 控制端一些易用性配置 +# 注册变量以判断是否容器化运行ansible控制端,如果容器化运行那么进程数小于20 +- name: 注册变量以判断是否容器化运行ansible控制端 + shell: "ps aux|wc -l" + register: procs + - name: ansible 控制端写入环境变量$PATH lineinfile: dest: ~/.bashrc state: present regexp: 'kubeasz' line: 'export PATH={{ base_dir }}/bin/:$PATH # generated by kubeasz' + when: "procs.stdout|int > 20" ignore_errors: true - name: ansible 控制端添加 kubectl 自动补全 @@ -118,6 +124,7 @@ state: present regexp: 'kubectl completion' line: 'source <(kubectl completion bash)' + when: "procs.stdout|int > 20" ignore_errors: true - name: ansible 控制端创建 kubectl 软链接