Skip to content

Commit

Permalink
使用lineinfile替换sed
Browse files Browse the repository at this point in the history
  • Loading branch information
antergone committed May 4, 2018
1 parent c17a378 commit 193a376
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions 99.clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
6 changes: 4 additions & 2 deletions roles/prepare/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 193a376

Please sign in to comment.