geerlingguy / ansible-role-nodejs

Ansible Role - Node.js
https://galaxy.ansible.com/geerlingguy/nodejs/
MIT License
411 stars 253 forks source link

Issue with ansible.builtin.deb822_repository #168

Open cherouvim opened 1 month ago

cherouvim commented 1 month ago

This:

- name: Add NodeSource repositories for Node.js.
  ansible.builtin.deb822_repository:
    name: nodesource_{{ nodejs_version }}
    uris: "https://deb.nodesource.com/node_{{ nodejs_version }}"
    types: deb
    suites: nodistro
    components: main
    signed_by: "{{ node_signing_key.dest }}"
    state: present
  register: node_repo

is giving me:

ERROR! couldn't resolve module/action 'ansible.builtin.deb822_repository'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/.../tasks/setup-Debian.yml': line 21, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:

- name: Add NodeSource repositories for Node.js.
  ^ here

Reproduce this in ansible 2.9 and 2.12

Changing that block to the older:

- name: Add NodeSource repositories for Node.js.
  apt_repository:
    repo: "{{ item }}"
    state: present
  with_items:
    - "deb https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main"
    - "deb-src https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main"
  register: node_repo

solves the issue for me.

mkondratev commented 1 month ago

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/deb822_repository_module.html

ansible-core >= 2.15