| --- |
| # nodejs tasks/Debian.yml |
| # |
| # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| - name: Copy Nodesource repo GPG key |
| ansible.builtin.copy: |
| src: nodesource-archive-keyring.gpg |
| dest: /usr/share/keyrings/nodesource-archive-keyring.gpg |
| owner: root |
| group: root |
| mode: 0644 |
| |
| - name: Add NodeSource apt repo |
| apt_repository: |
| repo: >- |
| deb [arch=amd64 signed-by=/usr/share/keyrings/nodesource-archive-keyring.gpg] |
| https://deb.nodesource.com/{{ nodejs_version }} {{ ansible_lsb['codename'] }} main |
| mode: "0600" |
| update_cache: true |
| |
| - name: Install Node.js |
| apt: |
| name: |
| - "nodejs" |
| state: "present" |
| update_cache: true |
| cache_valid_time: 3600 |
| |
| - name: Install global npm tools |
| community.general.npm: |
| global: true |
| state: "present" |
| name: "{{ item }}" |
| with_items: "{{ nodejs_npm_modules }}" |