Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
farisc0de committed Sep 28, 2024
1 parent ade8e39 commit a14cf18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ galaxy_info:
description: Node.js installation for Linux
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 2.10
min_ansible_version: "2.15"
platforms:
- name: Debian
versions:
Expand Down
28 changes: 9 additions & 19 deletions tasks/setup-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,24 @@
- 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 nodejs apt key"
ansible.builtin.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 ppa for node.js {{ nodejs_version }}"
ansible.builtin.apt_repository:
repo: "deb https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main"
state: present
register: node_repo

- name: Update apt cache if repo was added.
ansible.builtin.apt: update_cache=yes
when: node_repo is changed
tags: ['skip_ansible_lint']
tags: ["skip_ansible_lint"]

- name: Ensure Node.js and npm are installed.
ansible.builtin.apt:
name: "nodejs={{ nodejs_version | regex_replace('x', '') }}*"
state: present
allow_downgrades: true

0 comments on commit a14cf18

Please sign in to comment.