Loop over old neovim stow directories
This commit is contained in:
parent
b47d77b671
commit
928f9b2cfc
@ -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
|
||||||
|
19
roles/neovim/tasks/sudo-rmdir.yaml
Normal file
19
roles/neovim/tasks/sudo-rmdir.yaml
Normal 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}}'
|
Loading…
x
Reference in New Issue
Block a user