2016-11-07 14:00:57 +01:00
|
|
|
---
|
2018-02-01 12:00:41 +01:00
|
|
|
|
2023-03-19 11:44:53 +01:00
|
|
|
- name: APT https transport is enabled (Debian <10)
|
|
|
|
ansible.builtin.apt:
|
2016-11-07 14:00:57 +01:00
|
|
|
name: apt-transport-https
|
2017-01-12 17:37:48 +01:00
|
|
|
state: present
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
|
|
|
- system
|
|
|
|
- packages
|
2021-05-06 10:42:12 +02:00
|
|
|
- nodejs
|
2023-03-19 11:44:53 +01:00
|
|
|
when: ansible_distribution_major_version is version('10', '<')
|
2021-05-03 14:23:13 +02:00
|
|
|
|
|
|
|
- name: NodeJS GPG key is installed
|
2023-03-19 11:44:53 +01:00
|
|
|
ansible.builtin.copy:
|
2021-05-03 14:23:13 +02:00
|
|
|
src: nodesource.asc
|
2022-11-02 23:15:17 +01:00
|
|
|
dest: "{{ apt_keyring_dir }}/nodesource.asc"
|
2021-05-26 13:47:34 +02:00
|
|
|
mode: "0644"
|
|
|
|
owner: root
|
|
|
|
group: root
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
|
|
|
- system
|
|
|
|
- packages
|
|
|
|
- nodejs
|
|
|
|
|
2023-03-19 11:44:53 +01:00
|
|
|
- name: Add NodeJS repository (Debian <12)
|
|
|
|
ansible.builtin.apt_repository:
|
2022-11-02 23:17:08 +01:00
|
|
|
repo: "deb [signed-by={{ apt_keyring_dir }}/nodesource.asc] https://deb.nodesource.com/{{ nodejs_apt_version }} {{ ansible_distribution_release }} main"
|
2017-12-13 15:41:45 +01:00
|
|
|
filename: nodesource
|
2017-05-03 17:15:52 +02:00
|
|
|
update_cache: yes
|
2016-11-07 14:00:57 +01:00
|
|
|
state: present
|
|
|
|
tags:
|
|
|
|
- system
|
|
|
|
- packages
|
|
|
|
- nodejs
|
2023-03-19 11:44:53 +01:00
|
|
|
when: ansible_distribution_major_version is version('12', '<')
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2023-03-19 11:44:53 +01:00
|
|
|
- name: Add NodeJS repository (Debian >=12)
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: nodesource.sources.j2
|
|
|
|
dest: /etc/apt/sources.list.d/nodesource.sources
|
|
|
|
state: present
|
|
|
|
register: nodesource_sources
|
2022-12-02 15:17:42 +01:00
|
|
|
tags:
|
|
|
|
- system
|
|
|
|
- packages
|
|
|
|
- nodejs
|
2023-03-19 11:44:53 +01:00
|
|
|
when: ansible_distribution_major_version is version('12', '>=')
|
|
|
|
|
|
|
|
- name: Update APT cache
|
|
|
|
ansible.builtin.apt:
|
|
|
|
update_cache: yes
|
|
|
|
when: nodesource_sources is changed
|
2022-12-02 15:17:42 +01:00
|
|
|
|
2018-04-06 09:19:36 +02:00
|
|
|
- name: NodeJS is installed
|
2023-03-19 11:44:53 +01:00
|
|
|
ansible.builtin.apt:
|
2016-11-07 14:00:57 +01:00
|
|
|
name: nodejs
|
2017-01-12 17:37:48 +01:00
|
|
|
state: present
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
|
|
|
- packages
|
|
|
|
- nodejs
|
2018-04-04 10:15:51 +02:00
|
|
|
|
2023-03-19 11:44:53 +01:00
|
|
|
- ansible.builtin.import_tasks: yarn.yml
|
2021-05-09 23:06:42 +02:00
|
|
|
when: nodejs_install_yarn | bool
|