# firewalld module

**URL:** <https://forum.ansible.com/t/firewalld-module/37534>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [January 9, 2023, 2:29pm UTC](https://forum.ansible.com/t/firewalld-module/37534 "2023-01-09T14:29:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdidomenico](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@mdidomenico](https://forum.ansible.com/u/mdidomenico)\
**Post date:** [January 9, 2023, 2:29pm UTC](https://forum.ansible.com/t/firewalld-module/37534/1 "2023-01-09T14:29:31Z")

</div>

this probably a question for redhat, but i'm hoping someone already  
asked and answered this.

according to this blog post  
[https://www.redhat.com/en/blog/updates-using-ansible-rhel-86-and-90](https://www.redhat.com/en/blog/updates-using-ansible-rhel-86-and-90)  
redhat switched from ansible to ansible-core. which means to me that  
when i install ansible-core i get the updated version to ansible-core  
2.13, okay great.

but when i try to run a firewalld task in ansible i get

"msg": "Python Module not found: firewalld and its python module are  
required for this module, version 0.2.11 or newer required (0.3.9 or  
newer for offline operations)"

this is because there is no python 3.9 version of the firewalld  
modules only python 3.6. but ansible is installed with 3.9 and as i  
understood requires 3.9+.

however, when i set the python interpreter to 3.6 in ansible.cfg the  
firewalld tasks run fine.

so i guess i'm confused. what is the repercussion of setting  
python3.6 as the ansible interpreter vs python3.9, if there's none  
then what's forcing ansible to mandate 3.9 instead of just using the  
redhat default of 3.6? is there a reason i shouldn't just set py36 as  
the default interpreter on all my rhel8 hosts?

before i attempt to navigate redhat support, does anyone know off hand  
how/if redhat plans to rev the py3.6 modules to py3.9 in rhel8 for  
ansible? i see rhel9 already made the leap, but i can't goto rhel9

---

<div class="post-metadata">

**Author:** ![Richard\_Megginson](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/richard_megginson/32/4540_2.png) [@Richard\_Megginson](https://forum.ansible.com/u/Richard_Megginson)\
**Post date:** [January 9, 2023, 4:50pm UTC](https://forum.ansible.com/t/firewalld-module/37534/2 "2023-01-09T16:50:08Z")

</div>

Are you by any chance using `localhost` as the managed host? If so, see [https://access.redhat.com/solutions/6726561](https://access.redhat.com/solutions/6726561)

---

<div class="post-metadata">

**Author:** ![mdidomenico](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@mdidomenico](https://forum.ansible.com/u/mdidomenico)\
**Post date:** [January 9, 2023, 5:08pm UTC](https://forum.ansible.com/t/firewalld-module/37534/3 "2023-01-09T17:08:25Z")

</div>

yes, i am working on the localhost and have connection: local in the  
playbook. the error message doesn't match what i see, but the symptom  
is close

in my case ansible for the most part seems to be working okay, its  
just when ansible calls a system py module (firewalld in this case),  
it's missing from the /usr/lib/python3.9. it's almost like redhat  
missed a dependancy in the ansible chain

---

<div class="post-metadata">

**Author:** ![Richard\_Megginson](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/richard_megginson/32/4540_2.png) [@Richard\_Megginson](https://forum.ansible.com/u/Richard_Megginson)\
**Post date:** [January 9, 2023, 5:13pm UTC](https://forum.ansible.com/t/firewalld-module/37534/4 "2023-01-09T17:13:27Z")

</div>

> yes, i am working on the localhost and have connection: local in the  
> playbook. the error message doesn’t match what i see, but the symptom  
> is close

I’m pretty sure it is the same issue - the python39 module used by ansible is missing most of the usual system python 3.6 libraries, so you have to force ansible to use the system python 3.6 instead to run modules, using the instructions in the KB article.

> in my case ansible for the most part seems to be working okay, its  
> just when ansible calls a system py module (firewalld in this case),  
> it’s missing from the /usr/lib/python3.9. it’s almost like redhat  
> missed a dependancy in the ansible chain

No, it is deliberate - ansible runs with the python39 module - that is only supported to run ansible itself, not the myriad of modules and filters that might be used, so for localhost you need to use system python 3.6 libraries for firewall, storage, et. al. you must follow the instructions in [https://access.redhat.com/solutions/6726561](https://access.redhat.com/solutions/6726561)
