From 193a376635091e6f74d50a35d94885c4f4a0ca24 Mon Sep 17 00:00:00 2001 From: Antergone Date: Fri, 4 May 2018 15:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8lineinfile=E6=9B=BF=E6=8D=A2s?= =?UTF-8?q?ed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 99.clean.yml | 6 ++++-- roles/prepare/tasks/main.yml | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/99.clean.yml b/99.clean.yml index 5ea330f2c..ea7cb5a35 100644 --- a/99.clean.yml +++ b/99.clean.yml @@ -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' diff --git a/roles/prepare/tasks/main.yml b/roles/prepare/tasks/main.yml index a557abc9d..8d787d107 100644 --- a/roles/prepare/tasks/main.yml +++ b/roles/prepare/tasks/main.yml @@ -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