On Thursday, 20 December 2018 10:28:59 CET Prashant Jaiswal wrote:
> failed: [0.0.0.0] (item={u'protocol': u'tcp', u'port': [5301, 1302, 5903, 
> 5672, 5672]}) => {"changed": false, "item": {"port": [5301, 1302, 5903, 
> 5672, 5672], "protocol": "tcp"}, "msg": "ERROR: Exception caught: 
> org.fedoraproject.FirewallD1.Exception: INVALID_PORT: '[5301, 1302, 5903, 
> 5672, 5672]' is invalid port range Permanent and Non-Permanent(immediate) 
> operation"}

It says invalid port, no place in the documentation say that you can send a 
list in the port section.
Only individual port or range with a dash.


> My playbook look like this 
> ---
> - hosts: test
>   become : True
>   become_user : root
>   become_method : sudo
>   tasks:
>     - name: Start and enable firewalld
>       service:
>         name: firewalld
>         state: started
>         enabled: yes
> 
>     - name: Enable TCP and UDP ports
>       firewalld:
>         port: ' {{item.port}}/{{item.protocol}}'
>         immediate: true
>         permanent: true
>         state: enabled
>       with_items:
>           - { port: [ 5301, 1302, 5903, 5672, 5672 ], protocol: tcp }
> #          - { port: [ 25238,55692 ], protocol: udp }

The easiest is to just list them like so and use {{ item }} instead

with_items:
  - 5301/tcp
  - 1302/tcp
  - 25238(udp
  ...
  ...


-- 
Kai Stian Olstad


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2406130.QzENlDfaO8%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to