Loop over old neovim stow directories

This commit is contained in:
Kenneth Benzie 2025-07-01 12:56:14 +01:00
parent b47d77b671
commit 928f9b2cfc
2 changed files with 24 additions and 19 deletions

View File

@ -10,26 +10,12 @@
state: absent state: absent
- set_fact: - set_fact:
old_package_dir: '/usr/local/lib/nvim/nvim-linux-x86_64' old_package_dirs:
- /usr/local/lib/nvim/nvim-linux-x86_64
- /usr/local/stow/nvim/nvim-linux64
- name: check if old package directory exists - include_tasks: sudo-rmdir.yaml
stat: with_items: '{{old_package_dirs}}'
path: '{{old_package_dir}}'
register: old_package
- name: uninstall package from old directory
when: old_package.stat.exists
become: true
command:
cmd: 'stow --delete --target /usr/local .'
chdir: '{{old_package_dir}}'
- name: remove old package directory
when: old_package.stat.exists
become: true
file:
state: absent
path: '{{old_package_dir}}'
- name: install gnu stow for managing tar.gz package - name: install gnu stow for managing tar.gz package
become: true become: true

View File

@ -0,0 +1,19 @@
---
- name: check if {{item}} exists
stat:
path: '{{item}}'
register: old_package
- name: uninstall package from {{item}}
when: old_package.stat.exists
become: true
command:
cmd: 'stow --delete --target /usr/local .'
chdir: '{{item}}'
- name: remove {{item}}
when: old_package.stat.exists
become: true
file:
state: absent
path: '{{item}}'