dotfiles: chezmoi migration

This commit is contained in:
dogeystamp 2024-08-13 20:25:08 -04:00
parent b198b90f3f
commit 84f728c991
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38

View File

@ -1,32 +1,20 @@
- name: Fetch dotfiles ---
git:
repo: "{{ dots_repo }}"
dest: "/srv/dots/"
register: dotfiles
- name: Remove existing dotfiles - name: Install dotfile manager
file: community.general.pacman:
path: "/home/{{ item }}/.bashrc" name:
state: absent - chezmoi
with_items: "{{ dotfile_users }}"
when: dotfiles.changed
- name: Copy dotfiles - name: Init dotfiles
copy: shell:
remote_src: yes cmd: "umask 007; chezmoi init {{ dots_repo }} --force --depth 1 --promptDefaults"
src: /srv/dots/ become: true
dest: "/home/{{ item }}/dots/" become_user: "{{ item }}"
owner: "{{ item }}"
group: "{{ item }}"
with_items: "{{ dotfile_users }}" with_items: "{{ dotfile_users }}"
when: dotfiles.changed
- name: Deploy dotfiles on login - name: Update dotfiles
template: shell:
src: templates/bash_profile.j2 cmd: "umask 007; chezmoi update --force"
dest: "/home/{{ item }}/.bash_profile" become: true
owner: "{{ item }}" become_user: "{{ item }}"
group: "{{ item }}"
force: yes
with_items: "{{ dotfile_users }}" with_items: "{{ dotfile_users }}"
when: dotfiles.changed