Skip to content

Commit

Permalink
ansible: update NodeSource repository setup
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 committed Jul 4, 2024
1 parent 12487a2 commit b2859ea
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 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
# Remove old NodeSource repository setup
- name: Remove old nodesource signing key
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present
state: absent

- 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

# 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 b2859ea

Please sign in to comment.