cancel
Showing results for 
Search instead for 
Did you mean: 
Hiero-nymus
Mission Specialist
Mission Specialist
  • 1,804 Views

Unable to configure firewall in lab chapter 4

Hi,

I configure the firewall task in the lab using the module : ansible.posix.firewalld and the following error appears:
ERROR! couldn't resolve module/action 'ansible.posix.firewalld'. This often indicates a misspelling, missing collection, or incorrect module path.
In the lab solution it uses the module : ansible.builtin.firewalld but as far as I know this module does not exist.
This command: ansible-doc ansible.builtin.firewalld return error too.
Can you please enlighten me on this subject?

Thank you and best regards

3 Replies
wbialy
Flight Engineer Flight Engineer
Flight Engineer
  • 1,799 Views

Hello

First thing, the firewalld module is ansible.posix collection so if there lab says ansible.builtin.firewalld that it’s an typo/error.


The collection (ansible.posix) is not included in ansible-core so if you’re using ansible-playbook and ansible-doc you need to install it first with ansible-galaxy
The module should though be present in the execution environment used by the ansible-navigator which is available in the lab env.


You might want to use “ansible-navigator doc” instead or install the posix collection on workstation machine

Hope that helps

 

Travis
Moderator
Moderator
  • 1,776 Views

@Hiero-nymus -

It's clear you are doing the RH294 course which is built on AAP 2.x. This means that Ansible has undergone a change in which all the modules and packages that were included are now in Ansible Content Collections. There are still a handful of built-in modules, but the rest have been moved into corresponding collections. The FirewallD module which used to be included is as the poster above stated now part of ansible.posix collection. This collection needs to be installed as part of an Execution Environment Image (EEI), needs to be installed locally and modified in the ansible.cfg file, or needs to be installed to the default location and using the ansible-playbook command so it can be picked up. 

However, as I've taught the course many times, you're directed to use the ansible-navigator command. The lab start commands generally setup your lab for you with default configurations that also help point to the RHEL8-Supported EEI. This should work for you as it has many of the required collections.

tmichett/RH294: Repository for RH294 Playbooks and Resources (github.com)

RH294/AAP2_Demo/with_config/ansible-navigator.yml at master · tmichett/RH294 (github.com)

I've provided my entire RH294 repository to you and specfically the ansible-navigator.yml configuration file which points to the EE that has the correct content collections and available as part of the lab environment.

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

The error you had above is generally an indication that the module isn't available in to Ansible and is generally an indication that the collection either needs installed or the name of the module and fully qualified collection name (FQCN) is spelled wrong. In the error message, I am not catching the mispelling, however it is possible it was spelled wrong on your system as I'm assuming you "retyped" the error when you came to RHLC and made this post. I would double-check the playbook spelling of the FQCN and module names. I would also make certain that you ran the lab start command as it will configure the Ansible Navigator for you.

This should give you an idea of where the problem is and how to fix it. Without seeing the playbook and the error, and the directory structure with your configuration files, it is hard to determine exactly where it is, but I can definitely state it is one of the things mentioned above.

  • Collection isn't installed so module not available (unlikely as it is definitely part of the EE that is configured in the course)
  • Lab Start wasn't run or didn't complete so the ansible-navigator.yml isn't setup and going to the correct collection
  • The module is spelled incorrectly in the playbook and the error message also had the typo in it, but when you made the post, your brain fixed it and you typed it correctly here (I've seen this happen multiple times when delivering this course).

You could also try to specify the EEI in the ansible-navigator command

ansible-navigator run Playbook_Name.yml -m stdout --eei utility.lab.example.com/ee-supported-rhel8:latest

 

Travis Michette, RHCA XIII
https://rhtapps.redhat.com/verify?certId=111-134-086
SENIOR TECHNICAL INSTRUCTOR / CERTIFIED INSTRUCTOR AND EXAMINER
Red Hat Certification + Training
Hiero-nymus
Mission Specialist
Mission Specialist
  • 1,705 Views

@Travis,

Thank you very much for your detailed and helpful reply. It's much more understanding for me now. The real problem was that I was using the command : ansible-playbook which is familiar to me.
I did the exercise again and as soon as I use the appropriate command : ansible-navigator, it works

Best regards, H

0 Kudos
Join the discussion
You must log in to join this conversation.