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

View File

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