This repository has been archived on 2024-10-22. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
npm/tasks/main.yml
2021-02-01 21:36:00 +01:00

56 lines
1.5 KiB
YAML

- name: load OS specific vars
include_vars: '{{ item }}'
with_first_found:
- files:
- '{{ ansible_distribution|lower }}-{{ ansible_distribution_release|lower }}.yml'
- '{{ ansible_distribution|lower }}.yml'
- '{{ ansible_os_family|lower }}.yml'
paths:
- '{{ role_path }}/vars'
- name: update apt cache
become: true
apt:
update_cache: true
when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu'
- name: update pacman cache
become: true
pacman:
update_cache: true
when: ansible_facts['os_family'] == 'Archlinux'
- name: install needed tools
become: true
package:
name: '{{ npm_pre_packages }}'
state: present
- name: add nodesource apt key
become: true
apt_key:
url: '{{ node_gpg_key }}'
state: present
when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu'
- name: add nodesource source
become: true
template:
src: 'nodesource.list.j2'
dest: '/etc/apt/sources.list.d/nodesource.list'
mode: '0600'
when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu'
- name: create apt pinning file
become: true
template:
src: 'nodesource.j2'
dest: '/etc/apt/preferences.d/nodesource'
mode: '0644'
when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu'
- name: install front-end packages
become: true
package:
name: '{{ npm_packages }}'
state: present