diff options
| author | Ahmed Abdelhalim <[email protected]> | 2025-11-09 01:43:24 +0100 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2025-11-09 01:47:01 +0100 |
| commit | de990dbbb6d0b852b73046e1f8c8875ae0849403 (patch) | |
| tree | 9396a5471430a6288a27342b2e92bc0e79a4bc12 /roles/vim | |
| parent | aa8d8855e0a153245f2ad0832ebeea80af57cbfb (diff) | |
Add vim role w/testing
Diffstat (limited to 'roles/vim')
| -rw-r--r-- | roles/vim/meta/argument_specs.yml | 10 | ||||
| -rw-r--r-- | roles/vim/meta/main.yml | 19 | ||||
| -rw-r--r-- | roles/vim/tasks/main.yml | 32 |
3 files changed, 61 insertions, 0 deletions
diff --git a/roles/vim/meta/argument_specs.yml b/roles/vim/meta/argument_specs.yml new file mode 100644 index 00000000..71533908 --- /dev/null +++ b/roles/vim/meta/argument_specs.yml @@ -0,0 +1,10 @@ +--- +argument_specs: + main: + short_description: "Install and configure vim" + description: "Install and configure vim" + options: + vimrc_repo_url: + type: "str" + description: "The vimrc git repo URL" + required: true diff --git a/roles/vim/meta/main.yml b/roles/vim/meta/main.yml new file mode 100644 index 00000000..50f6e28c --- /dev/null +++ b/roles/vim/meta/main.yml @@ -0,0 +1,19 @@ +--- +dependencies: + - role: "git" +galaxy_info: + author: "a14m" + description: "Install and configure vim" + company: "kartoffeln.work GmbH." + license: "MIT" + min_ansible_version: "2.18" + platforms: + - name: "ArchLinux" + versions: + - "all" + - name: "Ubuntu" + versions: + - "noble" + - name: "Debian" + versions: + - "bookworm" diff --git a/roles/vim/tasks/main.yml b/roles/vim/tasks/main.yml new file mode 100644 index 00000000..a0859f5c --- /dev/null +++ b/roles/vim/tasks/main.yml @@ -0,0 +1,32 @@ +--- +- name: "Ensure vim is installed" + become: true + ansible.builtin.package: + name: "vim" + state: "present" + +- name: "Clone vimrc git repo" + ansible.builtin.git: + repo: "{{ vimrc_repo_url }}" + dest: "{{ ansible_env.HOME }}/.vim" + clone: true + update: false + single_branch: true + version: main + +- name: "Ensure .vimrc is linked" + ansible.builtin.file: + src: "{{ ansible_env.HOME }}/.vim/.vimrc" + dest: "{{ ansible_env.HOME }}/.vimrc" + state: "link" + +# NOTE: based on https://stackoverflow.com/a/33734425/1769515 +- name: "Setup vim plugins" + ansible.builtin.command: + cmd: vim -E -s -u ~/.vimrc +PlugInstall +qall + creates: "{{ ansible_env.HOME }}/.vim/bundle/" + environment: + TERM: dumb + # We don't care much if vim failed to install all plugins + # this can be manually fixed later when needed + failed_when: false |
