Skip to content

Commit aa33990

Browse files
authored
ansible: update NodeSource repository setup (#3805)
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
1 parent 2b9797d commit aa33990

File tree

1 file changed

+19
-7
lines changed
  • ansible/roles/jenkins-workspace/tasks

1 file changed

+19
-7
lines changed

ansible/roles/jenkins-workspace/tasks/main.yml

+19-7
Original file line numberDiff line numberDiff line change
@@ -109,27 +109,39 @@
109109
scope: file
110110
value: 0
111111

112-
- name: Add nodesource signing key
113-
apt_key:
114-
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
115-
state: present
116-
112+
# Remove old NodeSource repository setup
117113
- name: Get Ubuntu codename
118114
ansible.builtin.command: "lsb_release -s -c"
119115
changed_when: no
120116
check_mode: no
121117
register: release_codename
122118

123-
- name: Add nodesource 20 repo
119+
- name: Remove nodesource 20 repo
124120
apt_repository:
125121
repo: deb https://deb.nodesource.com/node_20.x {{ release_codename.stdout }} main
126-
state: present
122+
state: absent
127123

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

129+
- name: Remove old nodesource signing key
130+
apt_key:
131+
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
132+
state: absent
133+
134+
# NodeSource distribution
135+
- name: Add nodesource signing key
136+
ansible.builtin.get_url:
137+
dest: /etc/apt/keyrings/nodesource-repo.gpg.asc
138+
url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
139+
140+
- name: Add nodesource 20 repo
141+
apt_repository:
142+
repo: deb [arch=amd64 signed-by=/etc/apt/keyrings/nodesource-repo.gpg.asc] https://deb.nodesource.com/node_20.x nodistro main
143+
state: present
144+
133145
- name: Install node
134146
package:
135147
name: nodejs

0 commit comments

Comments
 (0)