become: true
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
- - name: Install nodejs-dev dep for npm
- apt:
- name: nodejs-dev
- update_cache: yes
- state: fixed
- become: true
- when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
-
- - name: Install libnode-dev dep for npm
- apt:
- name: libnode-dev
- update_cache: yes
- state: fixed
- become: true
- when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
-
- name: Install supporting packages (Ubuntu 18.04)
apt:
name:
become: true
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
- - name: Install npm and addon packages
+ - name: Install nodejs and npm
+ block:
+ - name: 'Pull latest nodejs version'
+ command: 'curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - && sudo apt-get install -y nodejs'
+ become: yes
+ - name: 'Check nodejs version'
+ command: node --version
+ - name: 'Check npm version'
+ command: npm --version
+ when: ansible_distribution == 'Ubuntu'
+
+ - name: Install npm build tools
apt:
- name:
- - nodejs
- - npm
- - node-gyp
+ name: build-essential
update_cache: yes
state: fixed
become: true