Let's say you have the following playbook, which used the firewalld module.
--- - hosts: all gather_facts: false remote_user: root tasks: - name: allow SSH in firewalld firewalld: service: ssh state: enabled ...
And when using the ansible-playbook command, couldn't resolve module is returned.
~]$ ansible-playbook testing.yml ERROR! couldn't resolve module/action 'firewalld'. This often indicates a misspelling, missing collection, or incorrect module path. The error appears to be in '/home/jeremy.canfield/testing.yml': line 21, column 5, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: - name: allow SSH in firewalld ^ here
This implies that a collection that contains the firewalld module is not installed on your control node (your Ansible server). firewalld is in the ansible.posix collection. The ansible-galaxy install collection command can be used to install the collection. In this example, the ansible.posix collection is installed.
~]$ ansible-galaxy collection install ansible.posix Starting galaxy collection install process Process install dependency map Starting collection install process Installing 'ansible.posix:1.2.0' to '/home/john.doe/.ansible/collections/ansible_collections/ansible/posix' Downloading https://galaxy.ansible.com/download/ansible-posix-1.2.0.tar.gz to /home/john.doe/.ansible/tmp/ansible-local-15258q2alfwvq/tmpdesamf4k ansible.posix (1.2.0) was installed successfully