ensure-nodejs: refactor to use ensure-package-repositories

This patch refactors ensure-nodejs to use the new generic role
to allow it to be cross-platform in the future.

Change-Id: I859b6b3e33bc22ad4f99828e921ac2ed35a49252
This commit is contained in:
Mohammed Naser 2020-04-04 15:51:27 -04:00 committed by Andreas Jaeger
parent e4345c217e
commit 7ea6d11981
2 changed files with 10 additions and 17 deletions

View File

@ -15,23 +15,15 @@
dest: /etc/apt/preferences.d/00-nodesource.pref
become: yes
- name: Add nodesource repository key
apt_key:
url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
become: yes
- name: Add nodesource apt source repository
apt_repository:
repo: "deb-src https://deb.nodesource.com/node_{{ node_version }}.x {{ ansible_distribution_release }} main"
state: present
become: yes
- name: Add nodesource apt repository
apt_repository:
repo: "deb https://deb.nodesource.com/node_{{ node_version }}.x {{ ansible_distribution_release }} main"
state: present
update_cache: yes
become: yes
- name: Add all repositories
include_role:
name: ensure-package-repositories
vars:
repositories_keys:
- url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
repositories_list:
- repo: deb-src https://deb.nodesource.com/node_{{ node_version }}.x {{ ansible_distribution_release }} main
- repo: deb https://deb.nodesource.com/node_{{ node_version }}.x {{ ansible_distribution_release }} main
# Use template so that we can easily update this in the future to be able to
# use a mirror location.

View File

@ -3,6 +3,7 @@
description: Test the ensure-nodejs role
files:
- roles/ensure-nodejs/.*
- roles/ensure-package-repositories/.*
run: test-playbooks/simple-role-test.yaml
vars:
role_name: ensure-nodejs