Tip

Check out the repository on GitHub

Rule Interface Group

STATE: unstable

TESTS: Playbook

API Docs: Core - Firewall

Service Docs: Interface Groups

Contribution

Thanks to @jiuka for developing this module!

Definition

Definition

Parameter

Type

Required

Default

Aliases

Comment

name

string

true

-

ifname

Name of the interface group. Only texts containing letters, digits and underscores with a maximum length of 15 characters are allowed and the name may not end with a digit.

members

list

false

-

ints, interfaces

Member interfaces - you must provide the network port as shown in ‘Interfaces - Assignments - Network port

gui_group

boolean

false

true

-

Grouping these members in the interfaces menu section

sequence

int

false

0

seq

Sequence used in sorting the groups

description

string

false

-

desc

Optional description

For basic parameters see: Basic

Examples

- hosts: localhost
  gather_facts: no
  module_defaults:
    group/ansibleguy.opnsense.all:
      firewall: 'opnsense.template.ansibleguy.net'
      api_credential_file: '/home/guy/.secret/opn.key'

    ansibleguy.opnsense.list:
      target: 'rule_interface_group'

  tasks:
    - name: Example
      ansibleguy.opnsense.rule_interface_group:
        name: Internal
        members: ['vtnet0', 'vtnet1']
        # gui_group: true
        # sequence: 0
        # description: 'Optional description'

    - name: Adding 1
      ansibleguy.opnsense.rule_interface_group:
        name: Internal
        members: ['vtnet0', 'vtnet1']

    # note: you can also use the module alias-name
    - name: Adding 2
      ansibleguy.opnsense.rule_if_group:
        name: DMZ
        members: ['vtnet3', 'vtnet4']

    - name: Listing
      ansibleguy.opnsense.list:
      #  target: 'rule_interface_group'
      register: existing_entries

    - name: Printing rules
      ansible.bultin.debug:
        var: existing_entries.data