Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firewalld: port_forward expects a list but does not handle multiple parameters #608

Open
sents opened this issue Jan 27, 2025 · 0 comments

Comments

@sents
Copy link

sents commented Jan 27, 2025

SUMMARY

The port_forward parameter of the firewalld module expects a list of exactly one dictionary argument.
This is unintuitive and confusing behaviour. If the module supports just one argument it should take
dictionary options. If multiple port_forwards are supported taking a list of forwards would be fine.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible.posix.firewalld port_forward feature

ANSIBLE VERSION
ansible [core 2.18.1]
  config file = None
  configured module search path = ['/home/finnks/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /nix/store/977791id8h9flmq3c0dh3w1gzbbz11dk-python3.12-ansible-core-2.18.1/lib/python3.12/site-packages/ansible
  ansible collection location = /home/finnks/.ansible/collections:/usr/share/ansible/collections
  executable location = /nix/store/977791id8h9flmq3c0dh3w1gzbbz11dk-python3.12-ansible-core-2.18.1/bin/ansible
  python version = 3.12.8 (main, Dec  3 2024, 18:42:41) [GCC 14.2.1 20241116] (/nix/store/c9m6yd8fg1flz2j5r4bif1ib5j20a0cy-python3-3.12.8/bin/python3.12)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
ansible.posix                            2.0.0
STEPS TO REPRODUCE

Try to use the

- name: Set up port forwards
  ansible.posix.firewalld:
    zone: public
    permanent: true
    immediate: true
    state: enabled
    port_forward:
      port: "{{ item.from }}"
      toport: "{{ item.to }}"
      proto: "{{ item.proto }}"
  loop: "{{ mapped_ports }}"
EXPECTED RESULTS

The port_forward option of the firewalld module accepts a simple dictionary, or a list of dictionaries if multiple forwards are possible.

ACTUAL RESULTS

The modules accepts a list of a single dictionary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant