Define rules in a format that matches the one JC produces

jc -yp ufw status

Produces YAML like this:

---
status: active
rules:
- action: ALLOW
  action_direction:
  index:
  network_protocol: ipv4
  to_interface: any
  to_transport: tcp
  to_service:
  to_ports:
  - 22
  to_ip: 0.0.0.0
  to_ip_prefix: 0
  comment:
  from_ip: 0.0.0.0
  from_ip_prefix: 0
  from_interface: any
  from_transport: any
  from_port_ranges:
  - start: 0
    end: 65535
  from_service:
- action: ALLOW
  action_direction:
  index:
  network_protocol: ipv4
  to_interface: any
  to_transport: udp
  to_service:
  to_port_ranges:
  - start: 60000
    end: 61000
  to_ip: 0.0.0.0
  to_ip_prefix: 0
  comment:
  from_ip: 0.0.0.0
  from_ip_prefix: 0
  from_interface: any
  from_transport: any
  from_port_ranges:
  - start: 0
    end: 65535
  from_service:
- action: ALLOW
  action_direction:
  index:
  network_protocol: ipv6
  to_interface: any
  to_transport: tcp
  to_service:
  to_ports:
  - 22
  to_ip: '::'
  to_ip_prefix: 0
  comment:
  from_ip: '::'
  from_ip_prefix: 0
  from_interface: any
  from_transport: any
  from_port_ranges:
  - start: 0
    end: 65535
  from_service:
- action: ALLOW
  action_direction:
  index:
  network_protocol: ipv6
  to_interface: any
  to_transport: udp
  to_service:
  to_port_ranges:
  - start: 60000
    end: 61000
  to_ip: '::'
  to_ip_prefix: 0
  comment:
  from_ip: '::'
  from_ip_prefix: 0
  from_interface: any
  from_transport: any
  from_port_ranges:
  - start: 0
    end: 65535
  from_service:

It would be good if this role accepted a dictionary in the same format to set the rules

Edited by Chris Croome