homeserver/roles/mgrote_user_setup/tasks/main.yml

130 lines
3.3 KiB
YAML
Raw Normal View History

---
- name: Ensure needed packages are installed
become: true
ansible.builtin.package:
name:
- acl
- git
- vim
- ripgrep
- tmux
- keychain
state: present
- name: Ensure dotfiles-repository is cloned # noqa latest[git]
become: true
2024-10-23 22:01:46 +02:00
become_user: "{{ item.user }}"
ansible.builtin.git:
repo: "{{ dotfiles_repo_url }}"
dest: "{{ item.home }}/dotfiles"
clone: true
force: true
update: true
loop: "{{ dotfiles }}"
notify: Vundle - PluginInstall
- name: Ensure dotfiles-repository has the correct permissions set
become: true
ansible.builtin.file:
path: "{{ item.home }}/dotfiles"
owner: "{{ item.user }}"
group: "{{ item.user }}"
loop: "{{ dotfiles }}"
notify: Vundle - PluginInstall
- name: Link .vimrc
become: true
ansible.builtin.file:
src: "{{ item.home }}/dotfiles/.vimrc"
dest: "{{ item.home }}/.vimrc"
state: link
follow: false # https://github.com/ansible/ansible/issues/73143
force: true
owner: "{{ item.user }}"
group: "{{ item.user }}"
loop: "{{ dotfiles }}"
- name: Link .tmux.conf
become: true
ansible.builtin.file:
src: "{{ item.home }}/dotfiles/.tmux.conf"
dest: "{{ item.home }}/.tmux.conf"
state: link
follow: false # https://github.com/ansible/ansible/issues/73143
force: true
owner: "{{ item.user }}"
group: "{{ item.user }}"
loop: "{{ dotfiles }}"
- name: Link .gitconfig
become: true
ansible.builtin.file:
src: "{{ item.home }}/dotfiles/.gitconfig"
dest: "{{ item.home }}/.gitconfig"
state: link
follow: false # https://github.com/ansible/ansible/issues/73143
force: true
owner: "{{ item.user }}"
group: "{{ item.user }}"
loop: "{{ dotfiles }}"
- name: Ensure needed vim dirs exist
become: true
ansible.builtin.file:
state: directory
path: "{{ item.home }}/.vim/"
owner: "{{ item.user }}"
group: "{{ item.user }}"
mode: '0755'
loop: "{{ dotfiles }}"
- name: Link vim spelldir
become: true
ansible.builtin.file:
src: "{{ item.home }}/dotfiles/vim/spell/"
dest: "{{ item.home }}/.vim/spell"
state: link
follow: false # https://github.com/ansible/ansible/issues/73143
force: true
owner: "{{ item.user }}"
group: "{{ item.user }}"
loop: "{{ dotfiles }}"
- name: add source .bash_extra to user .bashrc
become: true
ansible.builtin.lineinfile:
path: "{{ item.home }}/.bashrc"
line: "source {{ item.home }}/dotfiles/.bash_extra"
state: present
loop: "{{ dotfiles }}"
- name: Ensure needed vundle dirs exist
become: true
ansible.builtin.file:
state: directory
path: "{{ item.home }}/.vim/bundle/"
owner: "{{ item.user }}"
group: "{{ item.user }}"
mode: '0755'
loop: "{{ dotfiles }}"
- name: Ensure vundle-repository is cloned
2024-10-23 22:01:46 +02:00
become_user: "{{ item.user }}"
become: true
ansible.builtin.git:
repo: "{{ dotfiles_vim_vundle_repo_url }}"
dest: "{{ item.home }}/.vim/bundle/Vundle.vim"
depth: 1
version: master
loop: "{{ dotfiles }}"
notify: Vundle - PluginInstall
- name: Ensure vundle-repository has the correct permissions set
become: true
ansible.builtin.file:
path: "{{ item.home }}/.vim/bundle/Vundle.vim"
owner: "{{ item.user }}"
group: "{{ item.user }}"
loop: "{{ dotfiles }}"
notify: Vundle - PluginInstall