31 lines
913 B
YAML
31 lines
913 B
YAML
|
---
|
||
|
- name: Ensure dotfiles repository is cloned locally.
|
||
|
git:
|
||
|
repo: "{{ dotfiles_repo }}"
|
||
|
dest: "{{ dotfiles_repo_local_destination }}"
|
||
|
version: "{{ dotfiles_repo_version }}"
|
||
|
depth: 1
|
||
|
|
||
|
- name: Ensure all configured dotfiles are links.
|
||
|
command: "ls -F {{ dotfiles_home }}/{{ item }}"
|
||
|
register: existing_dotfile_info
|
||
|
failed_when: false
|
||
|
check_mode: false
|
||
|
changed_when: false
|
||
|
with_items: "{{ dotfiles_files }}"
|
||
|
|
||
|
- name: Remove existing dotfiles file if a replacement is being linked.
|
||
|
file:
|
||
|
path: "{{ dotfiles_home }}/{{ dotfiles_files[item.0] }}"
|
||
|
state: absent
|
||
|
when: "'@' not in item.1.stdout"
|
||
|
with_indexed_items: "{{ existing_dotfile_info.results }}"
|
||
|
|
||
|
- name: Link dotfiles into home folder.
|
||
|
file:
|
||
|
src: "{{ dotfiles_repo_local_destination }}/{{ item }}"
|
||
|
dest: "{{ dotfiles_home }}/{{ item }}"
|
||
|
state: link
|
||
|
mode: 0644
|
||
|
with_items: "{{ dotfiles_files }}"
|