Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit c3029513 authored by Jean-François HOVINNE's avatar Jean-François HOVINNE
Browse files

Switch to dnf module (RHEL), remove Node.js 16.x support (fixes #17)

parent a3ad7115
No related branches found
No related tags found
1 merge request!17Switch to dnf module (RHEL), remove Node.js 16.x support (fixes #17)
......@@ -11,7 +11,7 @@ Requirements
Role Variables
--------------
- `nodejs_version`: Sets the Node.js version to install ("16.x", "18.x", "20.x", etc).
- `nodejs_version`: Sets the Node.js version to install ("18.x", "20.x", etc).
The default version is 20.x.
......
# Releases
## 2.1.0
- Node.js 16.x support removed.
## 2.0.0
- Node.js 20.x set as default version.
......
......@@ -9,7 +9,6 @@
vars:
nodejs_version: "{{ version }}"
loop:
- "16.x"
- "20.x"
- "18.x"
loop_control:
......
......@@ -3,10 +3,6 @@
ansible.builtin.set_fact:
nodejs_version_major: "{{ nodejs_version | regex_replace('.x', '') }}"
- name: Setup
ansible.builtin.include_tasks: setup-RedHat.yml
when: ansible_os_family == 'RedHat' and nodejs_version_major | int < 17
- name: Setup
ansible.builtin.include_tasks: setup-RedHat.yml
when: ansible_os_family == 'RedHat' and ansible_distribution != 'Amazon' and nodejs_version_major | int > 16
......
......@@ -8,41 +8,20 @@
rhel_distribution_major_version: "{{ ansible_distribution_major_version }}"
when: ansible_distribution_major_version | int >= 8
- name: Import NodeSource RPM key
ansible.builtin.rpm_key:
key: https://rpm.nodesource.com/gpgkey/nodesource.gpg.key
state: present
become: true
- name: Remove previous NodeSource repository file
- name: Remove previous NodeSource repository files
ansible.builtin.file:
path: "/etc/yum.repos.d/nodesource-{{ nodejs_version }}.repo"
path: "{{ item }}"
state: absent
loop:
- "/etc/yum.repos.d/nodesource-{{ nodejs_version }}.repo"
- "/etc/yum.repos.d/nodesource-nodejs-{{ nodejs_version }}.repo"
notify: Clean yum metadata
become: true
- name: Add Node.js repository file
ansible.builtin.template:
src: nodesource-nodejs.repo.j2
dest: "/etc/yum.repos.d/nodesource-nodejs-{{ nodejs_version }}.repo"
owner: root
group: root
mode: '0644'
notify: Clean yum metadata
become: true
- name: Ensure Node.js AppStream module is disabled (CentOS 8+)
ansible.builtin.command: yum module disable -y nodejs # noqa: command-instead-of-module
register: module_disable
changed_when: "'Nothing to do.' not in module_disable.stdout"
when: ansible_distribution_major_version | int >= 8
become: true
- name: Ensure Node.js and npm are installed
ansible.builtin.yum:
name: "nodejs-{{ nodejs_version | regex_replace('x', '') }}*"
ansible.builtin.dnf:
name: "@nodejs:{{ nodejs_version_major }}/common"
state: present
enablerepo: "nodesource-nodejs-{{ nodejs_version }}"
allow_downgrade: true
become: true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment