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

View File

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