Add nvm setup
This commit is contained in:
parent
fe9f6788c3
commit
8254bfee9f
4 changed files with 41 additions and 0 deletions
|
|
@ -28,6 +28,7 @@
|
||||||
- name: setup python versions
|
- name: setup python versions
|
||||||
include_tasks: 'tasks/python.yml'
|
include_tasks: 'tasks/python.yml'
|
||||||
loop: '{{ python_versions }}'
|
loop: '{{ python_versions }}'
|
||||||
|
- import_tasks: 'tasks/nvm.yml'
|
||||||
vars_files:
|
vars_files:
|
||||||
- 'vars/main.yml'
|
- 'vars/main.yml'
|
||||||
- 'vars/archlinux.yml'
|
- 'vars/archlinux.yml'
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,7 @@
|
||||||
neovim_installed_version: neovim_stats.stdout_lines[0] | regex_search('(v\d+\.\d+\.\d+)')
|
neovim_installed_version: neovim_stats.stdout_lines[0] | regex_search('(v\d+\.\d+\.\d+)')
|
||||||
when: neovim_stats.rc == 0
|
when: neovim_stats.rc == 0
|
||||||
|
|
||||||
|
# TODO: verify checksum
|
||||||
- name: download neovim {{ neovim.version }}
|
- name: download neovim {{ neovim.version }}
|
||||||
get_url:
|
get_url:
|
||||||
url: 'https://github.com/neovim/neovim/releases/download/{{ neovim.version }}/nvim-linux64.tar.gz'
|
url: 'https://github.com/neovim/neovim/releases/download/{{ neovim.version }}/nvim-linux64.tar.gz'
|
||||||
|
|
|
||||||
35
tasks/nvm.yml
Normal file
35
tasks/nvm.yml
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
- name: create nvm install directory
|
||||||
|
file:
|
||||||
|
path: '{{ nvm.install_dir }}'
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: register the current nvm version
|
||||||
|
shell: 'source {{ nvm.install_dir }}/nvm.sh && nvm --version'
|
||||||
|
register: nvm_stats
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: parse the current nvm version
|
||||||
|
set_fact:
|
||||||
|
nvm_installed_version: nvm_stats.stdout
|
||||||
|
when: nvm_stats.rc == 0
|
||||||
|
|
||||||
|
- name: download nvm {{ nvm.version }}
|
||||||
|
get_url:
|
||||||
|
url: 'https://raw.githubusercontent.com/nvm-sh/nvm/{{ nvm.version }}/install.sh'
|
||||||
|
dest: '/tmp/nvm-{{ nvm.version }}-install.sh'
|
||||||
|
when: nvm_stats.rc > 0 or nvm_installed_version != nvm.version
|
||||||
|
register: nvm_download
|
||||||
|
|
||||||
|
- name: install nvm {{ nvm.version }}
|
||||||
|
ansible.builtin.command: 'bash /tmp/nvm-{{ nvm.version }}-install.sh'
|
||||||
|
environment:
|
||||||
|
PROFILE: /dev/null
|
||||||
|
NVM_DIR: '{{ nvm.install_dir }}'
|
||||||
|
args:
|
||||||
|
creates: '{{ nvm.install_dir }}/nvm.sh'
|
||||||
|
|
||||||
|
- name: ensure nvm gets loaded
|
||||||
|
lineinfile:
|
||||||
|
path: '{{ ansible_env.HOME }}/.bashrc.override'
|
||||||
|
line: >
|
||||||
|
[ -s "{{ nvm.install_dir }}/nvm.sh" ] && \. "{{ nvm.install_dir }}/nvm.sh" # This loads nvm
|
||||||
|
|
@ -84,3 +84,7 @@ python_versions:
|
||||||
- { version: 3.8.14, path: 'python3.8', binary: 'python3.8' }
|
- { version: 3.8.14, path: 'python3.8', binary: 'python3.8' }
|
||||||
- { version: 3.7.14, path: 'python3.7', binary: 'python3.7' }
|
- { version: 3.7.14, path: 'python3.7', binary: 'python3.7' }
|
||||||
- { version: 3.6.15, path: 'python3.6', binary: 'python3.6' }
|
- { version: 3.6.15, path: 'python3.6', binary: 'python3.6' }
|
||||||
|
|
||||||
|
nvm:
|
||||||
|
install_dir: '{{ xdg_config_dir }}/nvm'
|
||||||
|
version: 'v0.40.0'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue