Files
configs/playbooks/roles/software_nvim/tasks/main.yml
2024-10-09 21:25:58 +02:00

90 lines
1.8 KiB
YAML

---
- name: Install dependencies
tags:
- install
become: "{{ install_with_root }}"
ansible.builtin.package:
name:
- neovim
- git
- name: Setup config dirctories
tags:
- nvim
- config
become: "{{ use_become }}"
ansible.builtin.file:
mode: "{{ item.mode }}"
path: "{{ home }}/{{ item.path }}"
owner: "{{ username }}"
state: directory
with_community.general.filetree:
- ../files
loop_control:
label: "{{ item.path }}"
when: item.state == 'directory'
- name: Copy config
tags:
- nvim
- config
become: "{{ use_become }}"
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path }}"
mode: "{{ item.mode }}"
owner: "{{ username }}"
with_community.general.filetree:
- ../files
loop_control:
label: "{{ item.path }}"
when: item.state == 'file'
- name: Configure neovim
tags:
- config
- nvim
become: true
become_user: "{{ username }}"
ansible.builtin.git:
repo: https://github.com/morten-olsen/nvim
dest: "{{ home }}/Projects/private/nvim"
accept_newhostkey: true
clone: true
update: true
force: true
- name: Ensure dir
tags:
- config
- nvim
become: "{{ use_become }}"
ansible.builtin.file:
path: "{{ home }}/.config"
owner: "{{ username }}"
state: directory
mode: "0755"
- name: Setup nvim link
tags:
- config
- nvim
become: "{{ use_become }}"
ansible.builtin.file:
src: "{{ home }}/Projects/private/nvim"
dest: "{{ home }}/.config/nvim"
owner: "{{ username }}"
state: link
- name: Prepare neovim
tags:
- config
- nvim
become: true
become_user: "{{ username }}"
register: nviminstall
changed_when: nviminstall.stdout != ''
ansible.builtin.shell: nvim --headless +q
args:
executable: /bin/bash