summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-11-10 11:44:08 +0100
committerAhmed Abdelhalim <[email protected]>2025-11-10 11:44:08 +0100
commit60f92a26d2a8bc706ad8a1b9afe2453ea528b355 (patch)
tree31062c053b31e600998cf375c5cceac871068c89
parent72f14a15b69d771a61c28f281940a6f0a7f56f5a (diff)
Refactor vimrc to accept custom setup script
-rw-r--r--group_vars/all.ymlbin3766 -> 3895 bytes
-rw-r--r--group_vars/all.yml.example3
-rw-r--r--roles/dotfiles/tasks/main.yml4
-rw-r--r--roles/vim/meta/argument_specs.yml4
-rw-r--r--roles/vim/tasks/main.yml14
5 files changed, 15 insertions, 10 deletions
diff --git a/group_vars/all.yml b/group_vars/all.yml
index 05b241ca..6f9d46b3 100644
--- a/group_vars/all.yml
+++ b/group_vars/all.yml
Binary files differ
diff --git a/group_vars/all.yml.example b/group_vars/all.yml.example
index 9571040d..c2b93828 100644
--- a/group_vars/all.yml.example
+++ b/group_vars/all.yml.example
@@ -50,6 +50,9 @@ dotfiles_setup_script: |
password_store_repo_url: "[email protected]:a14m/.pass"
vimrc_repo_url: "[email protected]:~a14m/.vim"
+vimrc_setup_script: |
+ # NOTE: based on https://stackoverflow.com/a/33734425/1769515
+ vim -E -s -u ~/.vimrc +PlugInstall +qall
wireguard_autostart_connection: "wg-vpn0"
wireguard_connections:
diff --git a/roles/dotfiles/tasks/main.yml b/roles/dotfiles/tasks/main.yml
index 51b2e817..d962dbbe 100644
--- a/roles/dotfiles/tasks/main.yml
+++ b/roles/dotfiles/tasks/main.yml
@@ -6,10 +6,10 @@
clone: true
update: false
single_branch: true
- version: main
+ version: "main"
- name: "Setup dotfiles"
ansible.builtin.shell:
cmd: "{{ dotfiles_setup_script }}"
- executable: /bin/bash
+ executable: "/bin/bash"
creates: "{{ ansible_env.HOME }}/.bash_profile"
diff --git a/roles/vim/meta/argument_specs.yml b/roles/vim/meta/argument_specs.yml
index 71533908..b69b745d 100644
--- a/roles/vim/meta/argument_specs.yml
+++ b/roles/vim/meta/argument_specs.yml
@@ -8,3 +8,7 @@ argument_specs:
type: "str"
description: "The vimrc git repo URL"
required: true
+ vimrc_setup_script:
+ type: "str"
+ description: "The vimrc setup script"
+ required: true
diff --git a/roles/vim/tasks/main.yml b/roles/vim/tasks/main.yml
index a0859f5c..03059eec 100644
--- a/roles/vim/tasks/main.yml
+++ b/roles/vim/tasks/main.yml
@@ -12,7 +12,7 @@
clone: true
update: false
single_branch: true
- version: main
+ version: "main"
- name: "Ensure .vimrc is linked"
ansible.builtin.file:
@@ -20,13 +20,11 @@
dest: "{{ ansible_env.HOME }}/.vimrc"
state: "link"
-# NOTE: based on https://stackoverflow.com/a/33734425/1769515
+# We don't care much if vim failed to install all plugins
+# this can be manually fixed later when needed
- name: "Setup vim plugins"
- ansible.builtin.command:
- cmd: vim -E -s -u ~/.vimrc +PlugInstall +qall
+ ansible.builtin.shell:
+ cmd: "{{ vimrc_setup_script }}"
+ executable: "/bin/bash"
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