From 3e54d411293ef31eabfae8ac93af82c1c7032c6d Mon Sep 17 00:00:00 2001 From: Patrick Neff Date: Sun, 23 Jan 2022 20:20:46 +0100 Subject: [PATCH] add checks for zsh and antigen config folders --- tasks/users.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tasks/users.yml b/tasks/users.yml index 026ba81..a0cee72 100644 --- a/tasks/users.yml +++ b/tasks/users.yml @@ -71,12 +71,24 @@ key: "{{ item }}" with_items: "{{ user.ssh_keys | default([]) }}" + - name: "Check if .zsh folder exists" + stat: + path: "{{ user.home_dir | default('/home/' + user.username) }}/.zsh" + register: zsh_config_dir + - name: "Install antigen for '{{ user.username }}'." tags: users ansible.builtin.get_url: url: https://git.io/antigen dest: "{{ user.home_dir | default('/home/' + user.username) }}/.zsh/antigen.zsh" mode: 0600 + when: zsh_config_dir.stat.exists + register: zsh_antigen + + - name: "Check if .tmux folder exists" + stat: + path: "{{ user.home_dir | default('/home/' + user.username) }}/.tmux" + register: tmux_config_dir - name: "Install tpm for user '{{ user.username }}'." tags: users @@ -84,6 +96,8 @@ repo: "https://github.com/tmux-plugins/tpm" dest: "{{ user.home_dir | default('/home/' + user.username) }}/.tmux/plugins/tpm" version: v3.0.0 + when: tmux_config_dir.stat.exists + register: tmux_tpm - name: "Fix permissions for user '{{ user.username }}'" ansible.builtin.file: @@ -93,6 +107,7 @@ with_items: - "{{ user.home_dir | default('/home/' + user.username) }}/.tmux/plugins/tpm" - "{{ user.home_dir | default('/home/' + user.username) }}/.zsh" + when: tmux_tpm.changed == true or zsh_antigen.changed == true when: - user.state | default('present') == 'present'