blob: cc04519d5ac8ba00c2ac7dc2c994cb1b672a434f [file] [log] [blame]
Adrià Vilanova Martínez16b9f462024-05-04 01:08:33 +02001- name: Update apt cache
2 apt:
3 update_cache: yes
4 become: yes
5
6- name: Install prereqs
7 package:
8 name: apt-transport-https
9 state: present
10 become: yes
11
12- name: Pin nodejs installs to nodesource
13 copy:
14 src: 00-nodesource.pref
15 dest: /etc/apt/preferences.d/00-nodesource.pref
16 mode: 0644
17 become: yes
18
19- name: Add all repositories
20 include_role:
21 name: ensure-package-repositories
22 vars:
23 repositories_keys:
24 - url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
25 repositories_list:
26 - repo: deb-src https://deb.nodesource.com/node_{{ node_version }}.x nodistro main
27 - repo: deb https://deb.nodesource.com/node_{{ node_version }}.x nodistro main
28
29# Use template so that we can easily update this in the future to be able to
30# use a mirror location.
31- name: Pin NodeJS to nodesource apt repository
32 become: yes
33 template:
34 dest: /etc/apt/preferences.d/nodejs.pref
35 group: root
36 mode: 0644
37 owner: root
38 src: nodejs.pref.j2
39
40- name: Install NodeJS from nodesource
41 package:
42 name: nodejs
43 state: latest
44 become: yes
45 tags:
46 # Ignore ANSIBLE0010: We really want latest version
47 - skip_ansible_lint
48
49- name: Output node version
50 command: node --version
51
52- name: Output npm version
53 command: npm --version