diff --git a/roles/neovim/tasks/Debian.yaml b/roles/neovim/tasks/Debian.yaml index fc47090..de22b24 100644 --- a/roles/neovim/tasks/Debian.yaml +++ b/roles/neovim/tasks/Debian.yaml @@ -10,26 +10,12 @@ state: absent - 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 - stat: - 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}}' +- include_tasks: sudo-rmdir.yaml + with_items: '{{old_package_dirs}}' - name: install gnu stow for managing tar.gz package become: true diff --git a/roles/neovim/tasks/sudo-rmdir.yaml b/roles/neovim/tasks/sudo-rmdir.yaml new file mode 100644 index 0000000..05572a6 --- /dev/null +++ b/roles/neovim/tasks/sudo-rmdir.yaml @@ -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}}'