From 16b7760ae4886147f81ae48c9aa6afc1f37b132c Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 31 May 2022 21:25:04 +0200 Subject: [PATCH] zsh and root check for file confilct --- tasks/main.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index dbaedf4..ee4da0b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -23,14 +23,21 @@ - name: test if user bash rc exist stat: - path: /home/{{user.name}}/.bashrc + path: "{{ item }}" register: links + with_items: + - /home/{{user.name}}/.bashrc + - /home/{{user.name}}/.zshrc + - /root/.bashrc + become: true - name: delete bashrc if needed file: - path: "{{ links.stat.path }}" + path: "{{ item.stat.path }}" state: absent - when: links.stat.islnk is defined and not links.stat.islnk + when: item.stat.islnk is defined and not item.stat.islnk + with_items: "{{links.results }}" + become: true - name: apply stow config shell: stow * @@ -43,4 +50,4 @@ args: chdir: /home/{{user.name}}/conf2 when: config_download.changed == true - become: yes + become: true