talas-group/04_INFRA_DEPLOIEMENT/Ansible/roles/nodejs/tasks/main.yml
senke 66471934af Initial commit: Talas Group project management & documentation
Knowledge base of ~80+ markdown files across 14 domains (00-13),
Logseq graph, hardware design files (KiCAD), infrastructure configs,
and talas-wiki static site.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 20:10:41 +02:00

49 lines
1.2 KiB
YAML

---
# file: roles/nodejs/tasks/main.yml
- name: "make sure /etc/apt/keyrings exists"
file:
path: "/etc/apt/keyrings"
state: directory
tags: nodejs
- name: "download modern signature key"
get_url:
url: "https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key"
dest: "/dev/shm/nodesource-repo.gpg.key"
changed_when: false
tags: nodejs
- name: "install modern signature key"
shell:
cmd: "cat /dev/shm/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg"
creates: "/etc/apt/keyrings/nodesource.gpg"
tags: nodejs
- name: "repository file"
copy:
content: "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_{{ nodejs_version }}.x nodistro main\n"
dest: "/etc/apt/sources.list.d/nodesource.list"
register: repo
tags: nodejs
- name: "refresh apt if repo was modified"
apt:
update_cache: yes
when: repo.changed
tags: nodejs
- name: "/etc/apt/preferences.d/"
template:
src: "{{ item }}"
dest: "/etc/apt/preferences.d/{{ item }}"
loop:
- 91_nodejs
- 92_nsolid
tags: nodejs
- name: "apt install nodejs (includes npm)"
apt:
name:
- nodejs
tags: nodejs