Ansible: Symlink dotfile tasks

Add a new tasks file for symlinking a directory. Doing it this way instead of
stat'ing the file and forking based on its type in symlink_dotfile.yml is more
efficient, I think?

Clean up file permissions: remove other permissions.

Add a variable to toggle skipping symlink errors.
This commit is contained in:
Eryn Wells 2025-01-31 16:34:42 -08:00
parent d022b579d2
commit 0839618327
2 changed files with 12 additions and 2 deletions

View file

@ -2,7 +2,8 @@
- name: "Symlink {{ dotfile_src }}"
ansible.builtin.file:
src: "{{ ansible_local.dotfiles.path }}/{{ dotfile_src }}"
dest: "~/.{{ dotfile_dest | default(dotfile_src) }}"
dest: "{{ dotfile_dest | default('~/.' + dotfile_src) }}"
owner: "{{ ansible_user_id }}"
mode: 0644
mode: 0640
state: link
ignore_errors: "{{ eryn_dotfiles_ignore_symlink_errors | default(false) }}"

View file

@ -0,0 +1,9 @@
---
- name: "Symlink {{ dotfile_src }}"
ansible.builtin.file:
src: "{{ ansible_local.dotfiles.path }}/{{ dotfile_src }}"
dest: "{{ dotfile_dest | default('~/.' + dotfile_src) }}"
owner: "{{ ansible_user_id }}"
mode: 0750
state: link
ignore_errors: "{{ eryn_dotfiles_ignore_symlink_errors | default(false) }}"