public-health-ch/ansible/roles/geerlingguy.nodejs/tasks/setup-Debian.yml

33 lines
925 B
YAML
Raw Normal View History

2017-04-24 16:09:26 +00:00
---
2020-05-15 20:41:39 +00:00
- name: Ensure dependencies are present.
apt:
name:
- apt-transport-https
- gnupg2
state: present
2017-04-24 16:09:26 +00:00
- name: Add Nodesource apt key.
apt_key:
url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280
id: "68576280"
state: present
- name: Add NodeSource repositories for Node.js.
apt_repository:
repo: "{{ item }}"
state: present
with_items:
- "deb https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main"
- "deb-src https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main"
register: node_repo
- name: Update apt cache if repo was added.
apt: update_cache=yes
when: node_repo.changed
2020-05-15 20:41:39 +00:00
tags: ['skip_ansible_lint']
2017-04-24 16:09:26 +00:00
- name: Ensure Node.js and npm are installed.
2020-05-15 20:41:39 +00:00
apt:
name: "nodejs={{ nodejs_version|regex_replace('x', '') }}*"
state: present