🔨 Clean on update

This commit is contained in:
SebClem 2022-12-29 16:07:16 +01:00
parent 30f0986742
commit 0faa91e672
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50
3 changed files with 40 additions and 27 deletions

12
handlers/clean_cache.yml Normal file
View File

@ -0,0 +1,12 @@
---
- name: Clean cache
ansible.builtin.file:
state: absent
path: "~{{ user.username }}/.cache/antidote/"
listen: "clean antidote"
- name: Remove .zsh_plugins.zsh
ansible.builtin.file:
state: absent
path: "~{{ user.username }}/.zsh_plugins.zsh"
listen: "clean antidote"

View File

@ -1,7 +1,7 @@
---
- name: set default shell for users
become: yes
user:
- name: Set default shell for users
become: true
ansible.builtin.user:
name: "{{ user.username }}"
shell: /bin/zsh
when: user.antidote_plugins is defined
@ -10,10 +10,10 @@
loop_var: user
label: "{{ user.username }}"
- name: write .antidoterc for users
become: yes
- name: Write .antidoterc for users
become: true
become_user: "{{ user.username }}"
template:
ansible.builtin.template:
src: antidoterc.j2
dest: "~{{ user.username }}/.antidoterc"
mode: "u=rw,go=r"
@ -23,10 +23,10 @@
loop_var: user
label: "{{ user.username }}"
- name: write .zsh_plugins.txt for users
become: yes
- name: Write .zsh_plugins.txt for users
become: true
become_user: "{{ user.username }}"
template:
ansible.builtin.template:
src: zsh_plugins.txt.j2
dest: "~{{ user.username }}/.zsh_plugins.txt"
mode: "u=rw,go=r"
@ -35,15 +35,16 @@
loop_control:
loop_var: user
label: "{{ user.username }}"
notify: "clean antidote"
- name: add .antidoterc to .zshrc
become: yes
- name: Add .antidoterc to .zshrc
become: true
become_user: "{{ user.username }}"
lineinfile:
ansible.builtin.lineinfile:
path: "~/.zshrc"
line: "source ~/.antidoterc"
insertbefore: "source ~/.ansible_zshrc"
create: yes
create: true
mode: "u=rw,go=r"
when: user.antidote_plugins is defined
loop: "{{ antidote_users }}"

View File

@ -1,7 +1,7 @@
---
- name: install dependencies
become: yes
package:
- name: Install dependencies
become: true
ansible.builtin.package:
name:
- git
- zsh
@ -9,22 +9,22 @@
- gzip
state: present
- name: create download directory
file:
- name: Create download directory
ansible.builtin.file:
path: "{{ antidote_download_dir }}"
state: directory
mode: "u=rwx,go=rx"
- name: download Antidote
get_url:
- name: Download Antidote
ansible.builtin.get_url:
url: "{{ antidote_mirror }}/{{ antidote_filename }}"
dest: "{{ antidote_download_dir }}/{{ antidote_local_filename }}"
mode: "u=rw,go=r"
- name: create install directory
become: yes
- name: Create install directory
become: true
become_user: "{{ username }}"
file:
ansible.builtin.file:
path: "~{{ username }}/.antidote"
state: directory
mode: "u=rwx,go=rx"
@ -32,11 +32,11 @@
loop_control:
loop_var: username
- name: install Antidote
become: yes
unarchive:
- name: Install Antidote
become: true
ansible.builtin.unarchive:
src: "{{ antidote_download_dir }}/{{ antidote_local_filename }}"
remote_src: yes
remote_src: true
dest: "~{{ username }}/.antidote"
extra_opts:
- "--strip-components=1"