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

43 lines
1.6 KiB
YAML
Raw Normal View History

2017-04-24 16:09:26 +00:00
---
2020-05-15 20:41:39 +00:00
- name: Set up the Nodesource RPM directory.
2017-04-24 16:09:26 +00:00
set_fact:
nodejs_rhel_rpm_dir: "pub_{{ nodejs_version }}"
- name: Import Nodesource RPM key (CentOS < 7).
rpm_key:
key: http://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL
state: present
when: ansible_distribution_major_version|int < 7
2020-05-15 20:41:39 +00:00
- name: Import Nodesource RPM key (CentOS 7+).
2017-04-24 16:09:26 +00:00
rpm_key:
key: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL
state: present
when: ansible_distribution_major_version|int >= 7
- name: Add Nodesource repositories for Node.js (CentOS < 7).
yum:
name: "http://rpm.nodesource.com/{{ nodejs_rhel_rpm_dir }}/el/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/nodesource-release-el{{ ansible_distribution_major_version }}-1.noarch.rpm"
state: present
when: ansible_distribution_major_version|int < 7
- name: Add Nodesource repositories for Node.js (CentOS 7+).
yum:
name: "https://rpm.nodesource.com/{{ nodejs_rhel_rpm_dir }}/el/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/nodesource-release-el{{ ansible_distribution_major_version }}-1.noarch.rpm"
state: present
when: ansible_distribution_major_version|int >= 7
2020-05-15 20:41:39 +00:00
- name: Ensure Node.js AppStream module is disabled (CentOS 8+).
command: yum module disable -y nodejs
args:
warn: false
register: module_disable
changed_when: "'Nothing to do.' not in module_disable.stdout"
when: ansible_distribution_major_version|int >= 8
2017-04-24 16:09:26 +00:00
- name: Ensure Node.js and npm are installed.
2020-05-15 20:41:39 +00:00
yum:
name: "nodejs-{{ nodejs_version|regex_replace('x', '') }}*"
state: present
enablerepo: nodesource