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: win_chocolatey:
name: neovim name: neovim
state: latest state: absent
- set_fact: - set_fact:
vim_config_dir: '{{ansible_env.LOCALAPPDATA}}\nvim' vim_config_dir: '{{ansible_env.LOCALAPPDATA}}\nvim'
@ -14,39 +20,15 @@
dest: '{{vim_config_dir}}' dest: '{{vim_config_dir}}'
branch: main branch: main
# - TODO: neovim install pip packages # TODO: Create neovim-qt start menu shortcut
# win_pip: # Need a reliable way to get the path to nvim-qt which doesn't reply on
# name: '{{neovim_pip_packages}}' # where.exe or similar as it won't work on first install due to environment
# state: latest # variable update. winget installs the equalsraf.neovim-qt package in
# {{ansible_env.ProgramFiles}}\neovim-qt {{neovim_qt_version}}\bin\nvim.qt.exe
- name: create nvim start menu shortcut # so if I can get the version out of winget that would be a start.
win_shortcut: # - name: create nvim start menu shortcut
src: '{{ansible_env.ChocolateyToolsLocation}}/neovim/nvim-win64/bin/nvim-qt.exe' # win_shortcut:
dest: '{{ansible_env.ProgramData}}/Microsoft/Windows/Start Menu/Programs/nvim-qt.lnk' # src: '{{neovim_qt_exe}}'
icon: '{{ansible_env.ChocolateyToolsLocation}}/neovim/nvim-win64/bin/nvim-qt.exe,0' # dest: '{{ansible_env.ProgramData}}/Microsoft/Windows/Start Menu/Programs/nvim-qt.lnk'
directory: '{{ansible_env.USERPROFILE}}' # icon: '{{neovim_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