2021-06-06 22:01:20 +02:00
|
|
|
---
|
|
|
|
- name: install acl package
|
|
|
|
become: yes
|
|
|
|
ansible.builtin.package:
|
|
|
|
name: acl
|
|
|
|
state: present
|
|
|
|
|
2021-07-01 17:37:02 +02:00
|
|
|
- name: check if repo exists
|
|
|
|
stat:
|
|
|
|
path: "{{ dotfiles_repo_path }}"
|
|
|
|
register: repo_exists
|
|
|
|
|
2022-04-14 12:29:00 +02:00
|
|
|
- name: set safe directory
|
|
|
|
become: true
|
|
|
|
ansible.builtin.shell:
|
|
|
|
cmd: git config --global --add safe.directory "{{ dotfiles_repo_path }}"
|
|
|
|
changed_when: false
|
|
|
|
|
2021-07-01 15:26:45 +02:00
|
|
|
- name: stash changes
|
|
|
|
ansible.builtin.shell: git stash
|
|
|
|
args:
|
|
|
|
chdir: "{{ dotfiles_repo_path }}"
|
|
|
|
changed_when: false
|
2021-07-01 17:37:02 +02:00
|
|
|
when: repo_exists.stat.exists == true
|
2021-07-01 15:26:45 +02:00
|
|
|
|
2021-06-06 22:01:20 +02:00
|
|
|
- name: Ensure dotfiles repository is cloned locally.
|
|
|
|
git:
|
|
|
|
repo: "{{ dotfiles_repo_url }}"
|
|
|
|
dest: "{{ dotfiles_repo_path }}"
|
|
|
|
depth: 1
|
2021-07-20 10:27:33 +02:00
|
|
|
version: "{{ dotfiles_repo_branch }}"
|
2021-06-07 17:47:50 +02:00
|
|
|
register: git_clone
|
2021-06-06 22:01:20 +02:00
|
|
|
|
|
|
|
- name: set owner recursive for repo
|
|
|
|
file:
|
|
|
|
path: "{{ dotfiles_repo_path }}"
|
|
|
|
owner: "{{ dotfiles_owner }}"
|
|
|
|
group: "{{ dotfiles_owner }}"
|
|
|
|
recurse: yes
|
2021-06-07 17:47:50 +02:00
|
|
|
when: (git_clone.changed == true)
|
2021-06-06 22:01:20 +02:00
|
|
|
|
|
|
|
- name: Ensure needed dirs exist.
|
|
|
|
file:
|
|
|
|
path: "{{ item.path }}"
|
|
|
|
state: directory
|
|
|
|
with_items: "{{ dotfiles_dirs }}"
|
|
|
|
|
2022-04-14 12:29:00 +02:00
|
|
|
- name: Link dotfiles into home folder
|
2021-06-06 22:01:20 +02:00
|
|
|
file:
|
|
|
|
src: "{{ item.repo_path }}"
|
|
|
|
dest: "{{ item.local_path }}"
|
|
|
|
state: link
|
|
|
|
force: yes
|
|
|
|
owner: "{{ dotfiles_owner }}"
|
|
|
|
group: "{{ dotfiles_owner }}"
|
|
|
|
with_items: "{{ dotfiles_files }}"
|
2021-06-24 07:25:32 +02:00
|
|
|
|
2021-08-20 23:01:05 +02:00
|
|
|
- name: add .bash_extra to .bashrc
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /home/{{ dotfiles_owner }}/.bashrc
|
|
|
|
line: "source {{ dotfiles_repo_path }}/.bash_extra"
|
|
|
|
state: present
|