While running a playbook to enable multiple TCP & UDP ports on a remote m/c I am getting some syntax error which I can’t figure it out. The error says FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘item’ is undefined\n\nThe error appears to have been in ‘/etc/ansible/playbooks/enable_firewall_ports.yml’: line 13, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Enable TCP and UDP ports\n ^ here\n”}
That issue got fixed. Corrected the indentation. Now while running the playbook I am facing this error. Unable to pass multiple ports. Below is the error.
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