diff --git a/handlers/clean_cache.yml b/handlers/clean_cache.yml new file mode 100644 index 0000000..401a1df --- /dev/null +++ b/handlers/clean_cache.yml @@ -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" diff --git a/tasks/configure.yml b/tasks/configure.yml index 5467ea9..7283f6c 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -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 }}" diff --git a/tasks/install.yml b/tasks/install.yml index 3b21041..3e2c88c 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -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"