/
Network

Network

Use the nios_network module to create, update, or remove a network object from a NIOS Grid. It supports IPv4 as well as IPv6 networks.

The following table describes the parameters you can define in the nios_network module:

Parameter

Required/Optional

Description

Parameter

Required/Optional

Description

name/network

Required

Specifies the name of the network to add, update, or remove from NIOS.
The value must use CIDR notation.

network_view

Optional

Specifies the network view to associate the instance of the network object with.
If a value is not specified, the default network view configured in NIOS is used.

options

Optional

Specifies the set of DHCP options to be included as part of the configured network instance.
This parameter accepts a list of subparameters. When you configure subparameters, at least one of the name or num parameters must be specified:

  • name: The name of the DHCP option to configure. The standard options are router, router-templates, domain-name-servers, domain-name, broadcast-address, broadcast-address-offset, dhcp-lease-time, and dhcp6.name-servers.

  • num: The number of the DHCP options to configure.

  • value (required): The value of the DHCP option specified by the name subparameter.

  • use_option: Enables a subset of options when it is set to yes (see the NIOS API documentation). The default value is yes.

  • vendor_class: The name of the space with which this DHCP option is associated. The default value is DHCP.

container

Optional

Determines whether a network container must be created.
If you set this parameter to true, a network container will be created..

template

Optional

Specifies whether the network must be created according to the values specified in the selected template.

vlans

Optional

Specifies the set of VLANs that is included as part of the configured network instance. This parameter accepts a list of sub parameters of which, you must configure at least one of the name or id parameters:

  • name: The name of the VLAN object that you want to assign to the network instance.

  • id: The ID of the VLAN object.

  • parent: The name of the parent VLAN view or VLAN range of the VLAN object.

Note: This parameter is not supported for network container objects.

members

Optional

Assigns NIOS members to the network instance.
The parameter accepts a list of member names. Subparameter:
name: Specifies the name of the NIOS member that must be assigned to this network.
Note:

  • If you need to remove members assigned to a network, omit the members field from the configuration and run the playbook.

  • This parameter will be ignored if you set the container parameter to true.

use_logic_filter_rules

Optional

Specifies whether the logic filter must be used.
The default value is false. Set it to true if you want the rules defined in the logic_filter_rules parameter to be used.

logic_filter_rules

Optional

Defines the logic filters that must be applied on this instance of the network object.
Configure the following subparameters for each filter:

  • filter: The name of the logic filter that must be applied.

  • type: The type of the logic filter that must be applied. Valid values are MAC, NAC, and Option.

To use the defined logic filters, you must set the use_logic_filter_rules to true.

extattrs

Optional

Specifies extensible attributes for the network object.

state

Optional

Specifies the state of the network instance on the NIOS server.
Set one of the following values:

  • present (default): Configures the record.

  • absent: Removes the record.

comment

Optional

Describes the network object.

provider

Required

Defines the details of the connection:

  • host: The DNS host name or IP address to connect to the remote instance of NIOS.

  • username: The user name to use for authenticating the connection to the remote instance.

  • password: The password to use for authenticating the connection to the remote instance.

For information on additional fields you can define, see the list of subparameters in the NIOS Modules for Ansible Collections topic.

connection

Required

The nios_network module must be run locally.

Examples

name: Configure an IPv4 network
infoblox.nios_modules.nios_network:
  network: 192.0.2.0/24
  comment: this is a test comment
  state: present
  provider:
    host: <nios_hostname_or_hostip>
    username: <nios_username>
    password: <nios_password>
connection: local

 

name: Set dhcp options for a network ipv4
infoblox.nios_modules.nios_network:
  network: 192.0.2.0/24
  comment: this is a test comment
  options:
    - name: domain-name
    - value: ansible.com
  state: present
  provider:
    host: <nios_hostname_or_hostip>
    username: <nios_username>
    password: <nios_password>
connection: local

name: Configure an ipv6 network container
infoblox.nios_modules.nios_network:
  network: fe80::/64
  container: true
  comment: test network container
  options:
    - name: domain-name
    - value: ansible.com
  state: present
  provider:
    host: <nios_hostname_or_hostip>
    username: <nios_username>
    password: <nios_password>
connection: local

name: Create an ipv4 network with members assigned
infoblox.nios_modules.nios_network:
network: 192.0.2.0/24
comment: This is a test comment
members:
- name: member1.infoblox
- name: member2.infoblox
state: present
provider:
    host: <nios_hostname_or_hostip>
    username: <nios_username>
    password: <nios_password>
connection: local

name: Remove assigned members from an ipv4 network
infoblox.nios_modules.nios_network:
network: 192.0.2.0/24
comment: This is a test comment
state: present
provider:
    host: <nios_hostname_or_hostip>
    username: <nios_username>
    password: <nios_password>
connection: local

 

name: Set filters for a network ipv4
infoblox.nios_modules.nios_network:
network: 192.0.2.0/24
comment: this is a test comment
use_logic_filter_rules: true
logic_filter_rules:
- filter: PXE-UEFI
- type: Option
state: present
provider:
host: "{{ inventory_hostname_short }}"
username: admin
password: admin
connection: local

 

name: Configure an IPv4 network and assign vlans
infoblox.nios_modules.nios_network:
network: 192.0.2.0/24
comment: this is a test comment
vlans:
- name: ansiblevlan
parent: ansiblevlanview
id: 10
state: present
provider:
host: "{{ inventory_hostname_short }}"
username: admin
password: admin
connection: local

Related content