From b2859ea8a302d8322856cafaa64594063322f2d3 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Thu, 4 Jul 2024 15:47:08 +0100 Subject: [PATCH] ansible: update NodeSource repository setup 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: https://github.com/nodesource/distributions/issues/1715 --- .../roles/jenkins-workspace/tasks/main.yml | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ansible/roles/jenkins-workspace/tasks/main.yml b/ansible/roles/jenkins-workspace/tasks/main.yml index 403486d46..ba1698672 100644 --- a/ansible/roles/jenkins-workspace/tasks/main.yml +++ b/ansible/roles/jenkins-workspace/tasks/main.yml @@ -109,10 +109,11 @@ 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" @@ -120,16 +121,27 @@ 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