Knowledge Base

Browse our knowledge base for free solutions to common problems

Ansible Error: Listing playbook hosts failed: exit status 4 ERROR! couldn't resolve module/action 'ansible.posix.firewalld'.

Created On: 14 September 2022
Written by: Ben

When the error appears this usually means that the module you are attempting to use is missing from the system. The easiest way to resolve the issue is to install the module using ansible-galaxy.

In this case you can install using the following command:

ansible-galaxy collection install <missing_package_name>

In my case the missing package which provides ansible.posix.firewalld functionality is called ansible.posix so my command will be:

ansible-galaxy collection install ansible.posix

It's important to note that when running the above command the default install location will be the directory which you run it in. For example if the command is run inside of the /root/ folder then this is where the build will be placed.

As I am using Ansible Semaphore I was required to install the module/action in the shared folder so that the application has access to it when I run Playbooks from the web interface. To allow this my final command was:

ansible-galaxy collection install ansible.posix -p /usr/share/ansible/collections

Thats it! I deploy my playbook again and this time the posix module was available and I was able to fully complete my deployment.

ICTU LTD is a company registered England and Wales (Company No. 09344913) 15 Queen Square, Leeds, West Yorkshire, England, LS2 8AJ
Copyright © 2024 ICTU LTD, All Rights Reserved.
exit