role deploy: 增加是否容器化运行ansible脚本判断

pull/641/head
gjmzj 2019-06-30 20:11:42 +08:00
parent a6a97584b1
commit 846f81668e
1 changed files with 8 additions and 1 deletions

View File

@ -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 软链接