---
- name: Test forward port
  hosts: all
  become: true

  tasks:
    - name: Clean slate
      include_role:
        name: linux-system-roles.firewall
      vars:
        firewall:
          previous: replaced

    # Tests string and dict form types

    - name: Test forward_port and undo (string)
      include_role:
        name: linux-system-roles.firewall
      vars:
        firewall:
          - forward_port: 40/tcp;8080;0.0.0.0
            state: enabled
          - forward_port: 40/tcp;8080;0.0.0.0
            state: disabled

    - name: Test forward_port (dict) and undo
      include_role:
        name: linux-system-roles.firewall
      vars:
        firewall:
          - forward_port:
              port: 40
              proto: tcp
              toport: 8080
              toaddr: 0.0.0.0
            state: enabled
          - forward_port:
              - port: 40
                proto: tcp
                toport: 8080
                toaddr: 0.0.0.0
            state: disabled
