From 4dbe7a9c6e81805b69b5a89c6b14841ca94d2303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gildas=20Le=20Corguill=C3=A9?= Date: Mon, 10 Jun 2024 21:24:17 +0200 Subject: [PATCH] Fix nodejs repo registration for ubuntu Fix https://github.com/geerlingguy/ansible-role-nodejs/issues/160 --- tasks/setup-Debian.yml | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 1cb8413..06fa950 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -7,25 +7,17 @@ - gnupg2 state: present -- name: Download NodeSource's signing key. - # NodeSource's web server discriminates the User-Agent used by the deb822_repository module. - # https://github.com/nodesource/distributions/issues/1723 - ansible.builtin.get_url: - url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key - dest: /etc/apt/signing-key-nodesource-repo.asc - owner: root - group: root - mode: '0444' - register: node_signing_key +# Workaround to fix +# https://github.com/geerlingguy/ansible-role-nodejs/issues/160 +# Solution: https://kyle.pericak.com/nodejs-ansible.html +- name: "Add nodejs apt key" + apt_key: + url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key + state: present -- name: Add NodeSource repositories for Node.js. - ansible.builtin.deb822_repository: - name: nodesource_{{ nodejs_version }} - uris: "https://deb.nodesource.com/node_{{ nodejs_version }}" - types: deb - suites: nodistro - components: main - signed_by: "{{ node_signing_key.dest }}" +- name: "Add nodejs {{ nodejs_version }} ppa for apt repo" + apt_repository: + repo: "deb https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main" state: present register: node_repo