使用lineinfile替换sed

pull/179/head
Antergone 2018-05-04 15:27:46 +08:00
parent c17a378efa
commit 193a376635
2 changed files with 8 additions and 4 deletions

View File

@ -147,5 +147,7 @@
- lb
tasks:
- name: 清理自动生成的PATH
shell: sed -i '/kubeasz/d' /etc/profile
ignore_errors: true
lineinfile:
dest: /etc/profile
state: absent
regexp: 'kubeasz'

View File

@ -7,8 +7,10 @@
- /etc/docker
- name: 写入环境变量$PATH
shell: "sed -i '/kubeasz/d' /etc/profile && \
echo export PATH={{ bin_dir }}:\\$PATH >> /etc/profile \\# generated by kubeasz"
lineinfile:
dest: /etc/profile
regexp: 'kubeasz'
line: 'export PATH={{ bin_dir }}:$PATH # generated by kubeasz'
- name: 下载证书工具 CFSSL和 kubectl
copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755