diff --git a/roles/install-nodejs/tasks/main.yaml b/roles/install-nodejs/tasks/main.yaml index 44b7dde7f..553099f0c 100644 --- a/roles/install-nodejs/tasks/main.yaml +++ b/roles/install-nodejs/tasks/main.yaml @@ -33,6 +33,17 @@ update_cache: yes become: yes +# Use template so that we can easily update this in the future to be able to +# use a mirror location. +- name: Pin NodeJS to nodesource apt repository + become: yes + template: + dest: /etc/apt/preferences.d/nodejs.pref + group: root + mode: 0644 + owner: root + src: nodejs.pref.j2 + - name: Install NodeJS from nodesource package: name: nodejs diff --git a/roles/install-nodejs/templates/nodejs.pref.j2 b/roles/install-nodejs/templates/nodejs.pref.j2 new file mode 100644 index 000000000..c83050692 --- /dev/null +++ b/roles/install-nodejs/templates/nodejs.pref.j2 @@ -0,0 +1,3 @@ +Package: nodejs +Pin: origin deb.nodesource.com +Pin-Priority: 900