add checks for zsh and antigen config folders

This commit is contained in:
Patrick Neff 2022-01-23 20:20:46 +01:00
parent 4aa6a08a95
commit 3e54d41129
1 changed files with 15 additions and 0 deletions

View File

@ -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'