Remove nvm bash installation

This commit is contained in:
Sonny Bakker 2024-08-16 09:02:42 +02:00
parent 8254bfee9f
commit aef5ca8138
2 changed files with 9 additions and 34 deletions

View file

@ -1,35 +1,14 @@
- name: create nvm install directory
- set_fact:
install_dir: '{{ xdg_config_dir }}/nvm'
- name: remove manually installed nvm install directory
file:
path: '{{ nvm.install_dir }}'
state: directory
path: 'install_dir'
state: absent
- 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
- name: remove nvm entry from bashrc
lineinfile:
path: '{{ ansible_env.HOME }}/.bashrc.override'
line: >
[ -s "{{ nvm.install_dir }}/nvm.sh" ] && \. "{{ nvm.install_dir }}/nvm.sh" # This loads nvm
[ -s "{{ install_dir }}/nvm.sh" ] && \. "{{ install_dir }}/nvm.sh" # This loads nvm
state: absent

View file

@ -84,7 +84,3 @@ python_versions:
- { version: 3.8.14, path: 'python3.8', binary: 'python3.8' }
- { version: 3.7.14, path: 'python3.7', binary: 'python3.7' }
- { version: 3.6.15, path: 'python3.6', binary: 'python3.6' }
nvm:
install_dir: '{{ xdg_config_dir }}/nvm'
version: 'v0.40.0'