Switch neovim role over to winget

This commit is contained in:
Kenneth Benzie 2024-12-10 23:27:42 +00:00
parent d18a9550c9
commit 5210a451b2

View File

@ -1,9 +1,15 @@
---
- name: install winget packages
win_winget:
name:
- neovim.neovim
- equalsraf.neovim-qt
state: latest
- name: install chocolatey packages
- name: remove chocolatey package
win_chocolatey:
name: neovim
state: latest
state: absent
- set_fact:
vim_config_dir: '{{ansible_env.LOCALAPPDATA}}\nvim'
@ -14,39 +20,15 @@
dest: '{{vim_config_dir}}'
branch: main
# - TODO: neovim install pip packages
# win_pip:
# name: '{{neovim_pip_packages}}'
# state: latest
- name: create nvim start menu shortcut
win_shortcut:
src: '{{ansible_env.ChocolateyToolsLocation}}/neovim/nvim-win64/bin/nvim-qt.exe'
dest: '{{ansible_env.ProgramData}}/Microsoft/Windows/Start Menu/Programs/nvim-qt.lnk'
icon: '{{ansible_env.ChocolateyToolsLocation}}/neovim/nvim-win64/bin/nvim-qt.exe,0'
directory: '{{ansible_env.USERPROFILE}}'
- name: check for config repo tasks.yaml
win_stat:
path: '{{vim_config_dir}}/tasks.yaml'
register: config_repo_tasks
# TODO: this doesn't work for non localhost setups
# probably need to copy the tasks.yaml and plugins.yaml to the controller in a
# temporary directory then include them
- when: config_repo_tasks.stat.exists
fetch:
src: '{{vim_config_dir}}/tasks.yaml'
dest: vim_config_tasks.yaml
flat: true
changed_when: false
- when: config_repo_tasks.stat.exists
include_tasks: vim_config_tasks.yaml
- name: remove fetched tasks
file:
state: absent
path: vim_config_tasks.yaml
changed_when: false
delegate_to: localhost
# TODO: Create neovim-qt start menu shortcut
# Need a reliable way to get the path to nvim-qt which doesn't reply on
# where.exe or similar as it won't work on first install due to environment
# variable update. winget installs the equalsraf.neovim-qt package in
# {{ansible_env.ProgramFiles}}\neovim-qt {{neovim_qt_version}}\bin\nvim.qt.exe
# so if I can get the version out of winget that would be a start.
# - name: create nvim start menu shortcut
# win_shortcut:
# src: '{{neovim_qt_exe}}'
# dest: '{{ansible_env.ProgramData}}/Microsoft/Windows/Start Menu/Programs/nvim-qt.lnk'
# icon: '{{neovim_qt_exe}},0'
# directory: '{{ansible_env.USERPROFILE}}'