This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
homeserver-ansible/roles/dotfiles/tasks/main.yml

39 lines
819 B
YAML

- name: Fetch dotfiles
git:
repo: "{{ dots_repo }}"
dest: "/srv/dots/"
register: dotfiles
- name: Create list of users to configure
set_fact:
users:
- "{{ ansible_user }}"
- "{{ username }}"
- name: Remove existing dotfiles
file:
path: "/home/{{ item }}/.bashrc"
state: absent
with_items: "{{ users }}"
when: dotfiles.changed
- name: Copy dotfiles
copy:
remote_src: yes
src: /srv/dots/
dest: "/home/{{ item }}/dots/"
owner: "{{ item }}"
group: "{{ item }}"
with_items: "{{ users }}"
when: dotfiles.changed
- name: Deploy dotfiles on login
template:
src: templates/bash_profile.j2
dest: "/home/{{ item }}/.bash_profile"
owner: "{{ item }}"
group: "{{ item }}"
force: yes
with_items: "{{ users }}"
when: dotfiles.changed