ansible error

Hello,
I am trying to run my ansible playbook but am getting the following error running ansible


ansible-2.9.16-1.el8.noarch
ansible-doc-2.9.16-1.el8.noarch
ansible-freeipa-0.1.12-6.el8.noarch


The full traceback is:
Traceback (most recent call last):
File "/home/ameyer/.ansible/tmp/ansible-tmp-1611086687.8022811-260421839119082/AnsiballZ_firewalld.py", line 102, in <module>
_ansiballz_main()
File "/home/ameyer/.ansible/tmp/ansible-tmp-1611086687.8022811-260421839119082/AnsiballZ_firewalld.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/ameyer/.ansible/tmp/ansible-tmp-1611086687.8022811-260421839119082/AnsiballZ_firewalld.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.system.firewalld', init_globals=None, run_name='__main__', alter_sys=True)
File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/tmp/ansible_firewalld_payload_xaj8iemr/ansible_firewalld_payload.zip/ansible/modules/system/firewalld.py", line 871, in <module>
File "/tmp/ansible_firewalld_payload_xaj8iemr/ansible_firewalld_payload.zip/ansible/modules/system/firewalld.py", line 686, in main
ValueError: too many values to unpack (expected 2)
fatal: [10.150.10.6]: FAILED! => {
"changed": false,
"module_stderr": "Shared connection to 10.150.10.6 closed.\r\n",
"module_stdout": "Traceback (most recent call last):\r\n File \"/home/ameyer/.ansible/tmp/ansible-tmp-1611086687.8022811-260421839119082/AnsiballZ_firewalld.py\", line 102, in <module>\r\n _ansiballz_main()\r\n File \"/home/ameyer/.ansible/tmp/ansible-tmp-1611086687.8022811-260421839119082/AnsiballZ_firewalld.py\", line 94, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/home/ameyer/.ansible/tmp/ansible-tmp-1611086687.8022811-260421839119082/AnsiballZ_firewalld.py\", line 40, in invoke_module\r\n runpy.run_module(mod_name='ansible.modules.system.firewalld', init_globals=None, run_name='__main__', alter_sys=True)\r\n File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\r\n mod_name, mod_spec, pkg_name, script_name)\r\n File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\r\n exec(code, run_globals)\r\n File \"/tmp/ansible_firewalld_payload_xaj8iemr/ansible_firewalld_payload.zip/ansible/modules/system/firewalld.py\", line 871, in <module>\r\n File \"/tmp/ansible_firewalld_payload_xaj8iemr/ansible_firewalld_payload.zip/ansible/modules/system/firewalld.py\", line 686, in main\r\nValueError: too many values to unpack (expected 2)\r\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}

Here is the section this is referring too:

tasks file for setup_dhcpd

  • name: Update Firewall Rules dhcp01
    firewalld:
    port: “{{ ports_dhcpd01 }}”
    permanent: true
    state: enabled
    immediate: yes
    zone: public
    become: true

what does ports_dhcpd01 evaluate to?

That parameter is for ports or port ranges, but you try to use a single port with two different protocols.
That does not seem to be supported:

https://docs.ansible.com/ansible/latest/collections/ansible/posix/firewalld_module.html#parameter-port

You should either rearrange the data structure of your vars, or if that is not possible add some split/loop logic around the task.

I changed it to an item loop. Fixed.

Thank you!

Andrew Meyer
314-277-3307