mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 14:44:29 -04:00
fix os checking for npm install
This commit is contained in:
parent
a5cefb5464
commit
f29f72f383
2 changed files with 44 additions and 14 deletions
|
@ -8,23 +8,52 @@
|
||||||
- '{{LIB_DIR_NPM_BIN}}'
|
- '{{LIB_DIR_NPM_BIN}}'
|
||||||
- '{{LIB_DIR_BIN}}'
|
- '{{LIB_DIR_BIN}}'
|
||||||
|
|
||||||
- name: Install the gpg key for nodejs LTS
|
###################################################################################
|
||||||
apt_key:
|
|
||||||
url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
|
|
||||||
state: present
|
|
||||||
when: ansible_facts['os_family']|lower == 'debian'
|
|
||||||
|
|
||||||
- name: Install the nodejs LTS repos
|
- name: Ensure dependencies are present.
|
||||||
apt_repository:
|
|
||||||
repo: "deb https://deb.nodesource.com/node_22.x {{ ansible_facts['distribution_release'] }} main"
|
|
||||||
state: present
|
|
||||||
update_cache: yes
|
|
||||||
when: ansible_facts['os_family']|lower == 'debian'
|
when: ansible_facts['os_family']|lower == 'debian'
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- apt-transport-https
|
||||||
|
- python3-debian
|
||||||
|
- gnupg2
|
||||||
|
state: present
|
||||||
|
|
||||||
- name: "Install system packages: node"
|
- name: Download NodeSource's signing key.
|
||||||
ansible.builtin.package:
|
# NodeSource's web server discriminates the User-Agent used by the deb822_repository module.
|
||||||
name: "{{ (ansible_facts['os_family']|lower == 'debian') | ternary('nodejs', 'node') }}"
|
# https://github.com/nodesource/distributions/issues/1723
|
||||||
state: "present"
|
when: ansible_facts['os_family']|lower == 'debian'
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
|
||||||
|
dest: /etc/apt/signing-key-nodesource-repo.asc
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0444'
|
||||||
|
register: node_signing_key
|
||||||
|
|
||||||
|
- name: Add NodeSource repositories for Node.js.
|
||||||
|
when: ansible_facts['os_family']|lower == 'debian'
|
||||||
|
ansible.builtin.deb822_repository:
|
||||||
|
name: nodesource_{{ TARGET_NODE_VERSION }}
|
||||||
|
uris: "https://deb.nodesource.com/node_{{ TARGET_NODE_VERSION }}.x"
|
||||||
|
types: deb
|
||||||
|
suites: nodistro
|
||||||
|
components: main
|
||||||
|
signed_by: "{{ node_signing_key.dest }}"
|
||||||
|
state: present
|
||||||
|
register: node_repo
|
||||||
|
|
||||||
|
- name: Update apt cache if repo was added.
|
||||||
|
when: ansible_facts['os_family']|lower == 'debian'
|
||||||
|
ansible.builtin.apt: update_cache=yes
|
||||||
|
when: node_repo is changed
|
||||||
|
tags: ['skip_ansible_lint']
|
||||||
|
|
||||||
|
- name: Ensure Node.js and npm are installed.
|
||||||
|
when: ansible_facts['os_family']|lower == 'debian'
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: "nodejs={{ TARGET_NODE_VERSION | regex_replace('x', '') }}*"
|
||||||
|
state: present
|
||||||
|
|
||||||
- name: "Install system packages: npm"
|
- name: "Install system packages: npm"
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
|
|
|
@ -5,5 +5,6 @@ LIB_DIR_BIN: '{{LIB_DIR}}/bin'
|
||||||
LIB_DIR_NPM: '{{LIB_DIR}}/npm'
|
LIB_DIR_NPM: '{{LIB_DIR}}/npm'
|
||||||
LIB_DIR_NPM_BIN: '{{LIB_DIR_NPM}}/node_modules/.bin'
|
LIB_DIR_NPM_BIN: '{{LIB_DIR_NPM}}/node_modules/.bin'
|
||||||
|
|
||||||
|
TARGET_NODE_VERSION: '22'
|
||||||
MIN_NODE_VERSION: '20.0.0'
|
MIN_NODE_VERSION: '20.0.0'
|
||||||
MIN_NPM_VERSION: '10.0.0'
|
MIN_NPM_VERSION: '10.0.0'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue