Install node.js dependency for coc.nvim

This commit is contained in:
Kenneth Benzie 2022-02-19 14:37:07 +00:00
parent db5ebc701d
commit d66ff687d4
2 changed files with 38 additions and 0 deletions

28
nodejs-linux.yaml Normal file
View File

@ -0,0 +1,28 @@
---
- name: nodejs get json containing latest version
uri:
url: https://nodejs.org/dist/index.json
register: latest
- name: nodejs create directory for downloaded package
file:
state: directory
dest: ~/.local/src
- name: nodejs download latest package
get_url:
url: 'https://nodejs.org/dist/{{latest.json[0].version}}/node-{{latest.json[0].version}}-linux-x64.tar.gz'
dest: ~/.local/src/node.tar.gz
- name: nodejs extract downloaded package
unarchive:
src: ~/.local/src/node.tar.gz
dest: ~/.local/src
remote_src: true
- name: nodejs create symlink links
file:
state: link
src: '~/.local/src/node-{{latest.json[0].version}}-linux-x64/bin/{{item}}'
dest: '~/.local/bin/{{item}}'
with_items: [corepack, node, npm, npx]

View File

@ -15,6 +15,16 @@
state: latest
extra_args: --user
- name: (neo)vim install node.js Linux
when: ansible_system == "Linux"
include_tasks: nodejs-linux.yaml
- name: (neo)vim install node.js macOS
when: ansible_os_family == "Darwin"
homebrew: name=node state=latest
- name: (neo)vim install node.js Windows
when: ansible_os_family == "Windows"
win_chocolatey: name=nodejs state=latest
- name: (neo)vim install apt packages
when: ansible_distribution == 'Ubuntu' and
ansible_distribution_release == '20.04'