-
-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: migrate to NodeSource's new repository
The old repository is no longer updated. The new "nodistro" suite should now be used instead[0]. NodeSource's repository server currently restricts User-Agents, downloading the signing key was necessary in an extra step[1]. The Debian setup was tested successfully with Node.js version "18.x" and "20.x". The RedHat setup, however, was not tested as I do not have any RedHat-based systems laying around. [0] https://github.com/nodesource/distributions/wiki/How-to-migrate-to-the-new-repository [1] nodesource/distributions#1723
- Loading branch information
Showing
2 changed files
with
19 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,39 @@ | ||
--- | ||
- name: Ensure dependencies are present. | ||
apt: | ||
ansible.builtin.apt: | ||
name: | ||
- apt-transport-https | ||
- 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 | ||
|
||
- name: Add NodeSource repositories for Node.js. | ||
deb822_repository: | ||
ansible.builtin.deb822_repository: | ||
name: nodesource_{{ nodejs_version }} | ||
uris: "https://deb.nodesource.com/node_{{ nodejs_version }}" | ||
types: | ||
- deb | ||
- deb-src | ||
suites: "{{ ansible_distribution_release }}" | ||
types: deb | ||
suites: nodistro | ||
components: main | ||
signed_by: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280 | ||
signed_by: "{{ node_signing_key.dest }}" | ||
state: present | ||
register: node_repo | ||
|
||
- name: Update apt cache if repo was added. | ||
apt: update_cache=yes | ||
ansible.builtin.apt: update_cache=yes | ||
when: node_repo is changed | ||
tags: ['skip_ansible_lint'] | ||
|
||
- name: Ensure Node.js and npm are installed. | ||
apt: | ||
ansible.builtin.apt: | ||
name: "nodejs={{ nodejs_version | regex_replace('x', '') }}*" | ||
state: present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters