NameError: global name 'fw offline' is not defined

I’m working on Ubuntu 18.04.4 LTS using ansible 2.5.1.

I’m trying to get this project to work as its exactly what I’m trying to do.

I’ve stumbled through and did some troubleshooting and I managed to get the pod created and the instances to run, however it’s still not functional. I’m getting an error when running the test.yml (plane Jane no changes) when it reaches the task [podman_container_systemd : ensure container’s exposed ports firewall state]

This is the traceback:

TASK [podman_container_systemd : ensure container’s exposed ports firewall state] ***************************************************
task path: /etc/ansible/roles/podman_container_systemd/tasks/main.yml:185
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/firewalld.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c ‘echo ~ && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /home/keith/.ansible/tmp/ansible-tmp-1594249242.13-25587175827255” && echo ansible-tmp-1594249242.13-25587175827255=“echo /home/keith/.ansible/tmp/ansible-tmp-1594249242.13-25587175827255” ) && sleep 0’
<127.0.0.1> PUT /home/keith/.ansible/tmp/ansible-local-15286mEGZvX/tmpgPhc5F TO /home/keith/.ansible/tmp/ansible-tmp-1594249242.13-25587175827255/firewalld.py
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /home/keith/.ansible/tmp/ansible-tmp-1594249242.13-25587175827255/ /home/keith/.ansible/tmp/ansible-tmp-1594249242.13-25587175827255/firewalld.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘/usr/bin/python /home/keith/.ansible/tmp/ansible-tmp-1594249242.13-25587175827255/firewalld.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /home/keith/.ansible/tmp/ansible-tmp-1594249242.13-25587175827255/ > /dev/null 2>&1 && sleep 0’
The full traceback is:
Traceback (most recent call last):
File “/tmp/ansible_XfqmOo/ansible_module_firewalld.py”, line 1017, in
main()
File “/tmp/ansible_XfqmOo/ansible_module_firewalld.py”, line 811, in main
if fw_offline:
NameError: global name ‘fw_offline’ is not defined

failed: [127.0.0.1] (item=80/tcp) => {
“changed”: false,
“item”: “80/tcp”,
“module_stderr”: “Traceback (most recent call last):\n File "/tmp/ansible_XfqmOo/ansible_module_firewalld.py", line 1017, in \n main()\n File "/tmp/ansible_XfqmOo/ansible_module_firewalld.py", line 811, in main\n if fw_offline:\nNameError: global name ‘fw_offline’ is not defined\n”,
“module_stdout”: “”,
“msg”: “MODULE FAILURE”,
“rc”: 1
}
to retry, use: --limit @/etc/ansible/roles/awx_pod/tests/test.retry

Thanks in advanced for any assistance!
Keith

That would be the first place to reach out for support.

I think this issue is already fixed in Ansible https://github.com/ansible/ansible/issues/38161. Please update.

I did actually. I’ve been troubleshooting for a week now, and I’ve made some progress, however this seems to be a bug with Ansible.

I saw this, however this issue was posed and fixed back in 2018. I’m using a current version of Ansible. I can dig into the python script however from the comments I’m not clear on what would need to be done?

I saw this, however this issue was posed and fixed back in 2018. I’m using a current version of Ansible. I can dig into the python script however from the comments I’m not clear on what would need to be done?

You said you were using Ansible 2.5.1, which is far from current. (It is, in fact, from 2018.) You should upgrade to a supported version of Ansible, preferably 2.9.x.

Sorry, that’s what I came up with on a quick google search. Also this is a fresh install… ugh

Updated to 2.9.10 (more trouble than it should have been). Then updating states that were deprecated “installed>present”, It now seems to be working!

Thanks Everyone, and sorry I’m such a newbie at this!