Skip to content

Commit

Permalink
ansible: update NodeSource repository setup (#3805)
Browse files Browse the repository at this point in the history
The old NodeSource repository stopped updating and the version of
Node.js installed from there is old (20.5.1). Update to use the
new repository, which will install Node.js 20.15.0 at the time of
this change.

Refs: nodesource/distributions#1715
  • Loading branch information
richardlau authored Jul 5, 2024
1 parent 2b9797d commit aa33990
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions ansible/roles/jenkins-workspace/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,39 @@
scope: file
value: 0

- name: Add nodesource signing key
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present

# Remove old NodeSource repository setup
- name: Get Ubuntu codename
ansible.builtin.command: "lsb_release -s -c"
changed_when: no
check_mode: no
register: release_codename

- name: Add nodesource 20 repo
- name: Remove nodesource 20 repo
apt_repository:
repo: deb https://deb.nodesource.com/node_20.x {{ release_codename.stdout }} main
state: present
state: absent

- name: Remove nodesource 16 repo
apt_repository:
repo: deb https://deb.nodesource.com/node_16.x {{ release_codename.stdout }} main
state: absent

- name: Remove old nodesource signing key
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: absent

# NodeSource distribution
- name: Add nodesource signing key
ansible.builtin.get_url:
dest: /etc/apt/keyrings/nodesource-repo.gpg.asc
url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key

- name: Add nodesource 20 repo
apt_repository:
repo: deb [arch=amd64 signed-by=/etc/apt/keyrings/nodesource-repo.gpg.asc] https://deb.nodesource.com/node_20.x nodistro main
state: present

- name: Install node
package:
name: nodejs
Expand Down

0 comments on commit aa33990

Please sign in to comment.