Fix: Node 19 reached EOL and repo not working 38/143338/3
authorKevin Sandi <ksandi@contractor.linuxfoundation.org>
Fri, 20 Feb 2026 19:18:48 +0000 (13:18 -0600)
committerKevin Sandi <ksandi@contractor.linuxfoundation.org>
Tue, 24 Feb 2026 08:18:51 +0000 (02:18 -0600)
Issue-ID: CIMAN-33
Signed-off-by: Kevin Sandi <ksandi@contractor.linuxfoundation.org>
Change-Id: Ia8180a5a1fedf54508da6c5ae2f717f89c876d66

packer/provision/local-docker.yaml

index 46b3d48..5a78af1 100644 (file)
             update_cache: true
             state: present
           become: true
-        - name: add nodejs apt key
-          apt_key:
-            url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
-            state: present
+
+        - name: Create APT keyrings directory
+          ansible.builtin.file:
+            path: /etc/apt/keyrings
+            state: directory
+            mode: "0755"
           become: true
-        - name: add nodejs repository
-          apt_repository:
-            repo: deb https://deb.nodesource.com/node_19.x {{ ansible_distribution_release }} main
+
+        - name: Download NodeSource GPG key
+          ansible.builtin.get_url:
+            url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
+            dest: /tmp/nodesource.asc
+            mode: "0644"
+
+        - name: Dearmor NodeSource GPG key
+          ansible.builtin.command:
+            cmd: gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg /tmp/nodesource.asc
+            creates: /etc/apt/keyrings/nodesource.gpg
+          become: true
+
+        - name: Remove temporary key file
+          ansible.builtin.file:
+            path: /tmp/nodesource.asc
+            state: absent
+
+        - name: Add NodeSource repository
+          ansible.builtin.apt_repository:
+            repo: "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main"
             state: present
-            update_cache: true
+            filename: nodesource
           become: true
-        - name: install nodejs
-          apt:
-            name:
-              - nodejs
+
+        - name: Update apt cache
+          ansible.builtin.apt:
+            update_cache: yes
+          become: true
+
+        - name: Install Node.js
+          ansible.builtin.apt:
+            name: nodejs
             state: present
           become: true
       when: ansible_distribution == 'Ubuntu'