---
title: "Network"
canonical: "https://docs.infoblox.com/space/niosmodulesansible/45875394/Network"
format: markdown
---
<span style="color: #000000">Use the </span>`nios_network`<span style="color: #000000"> module to create, update, or remove a network object from a NIOS Grid. It supports IPv4 as well as IPv6 networks.</span>

<span style="color: #000000">The following table describes the parameters you can define in the </span>`nios_network`<span style="color: #000000"> module:</span>

| <span style="color: #000000">**Parameter**</span> | <span style="color: #000000">**Required/Optional**</span> | <span style="color: #000000">**Description**</span> |
| --- | --- | --- |
| `name/network` | <span style="color: #000000">Required</span> | <span style="color: #000000">Specifies the name of the network to add, update, or remove from NIOS.</span>  
<span style="color: #000000">The value must use CIDR notation.</span> |
| `network_view` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies the network view to associate the instance of the network object with.</span>  
<span style="color: #000000">If a value is not specified, the default network view configured in NIOS is used.</span> |
| `options` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies the set of DHCP options to be included as part of the configured network instance.</span>  
<span style="color: #000000">This parameter accepts a list of subparameters. When you configure subparameters, at least one of the </span>`name`<span style="color: #000000"> or </span>`num`<span style="color: #000000"> parameters must be specified:</span><br>- `name`<span style="color: #000000">: The name of the DHCP option to configure. The standard options are </span>`router`<span style="color: #000000">, </span>`router-templates`<span style="color: #000000">, </span>`domain-name-servers`<span style="color: #000000">, </span>`domain-name`<span style="color: #000000">, </span>`broadcast-address`<span style="color: #000000">, </span>`broadcast-address-offset`<span style="color: #000000">, </span>`dhcp-lease-time`<span style="color: #000000">, and </span>`dhcp6.name-servers`<span style="color: #000000">.</span>
- `num`<span style="color: #000000">: The number of the DHCP options to configure.</span>
- `value`<span style="color: #000000"> (required): The value of the DHCP option specified by the </span>`name`<span style="color: #000000"> subparameter.</span>
- `use_option`<span style="color: #000000">: Enables a subset of options when it is set to </span>`yes`<span style="color: #000000"> (see the NIOS API documentation). The default value is </span>`yes`<span style="color: #000000">.</span>
- `vendor_class`<span style="color: #000000">: The name of the space with which this DHCP option is associated. The default value is </span>`DHCP`<span style="color: #000000">.</span> |
| `container` | <span style="color: #000000">Optional</span> | 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:<br>- `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.<br>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:<br>- 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:<br>- `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`.<br>To use the defined logic filters, you must set the `use_logic_filter_rules` to `true`. |
| `extattrs` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies extensible attributes for the network object.</span> |
| `state` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies the state of the network instance on the NIOS server.</span>  
<span style="color: #000000">Set one of the following values:</span><br>- `present`<span style="color: #000000"> (default): Configures the record.</span>
- `absent`<span style="color: #000000">: Removes the record.</span> |
| `comment` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Describes the network object.</span> |
| `provider` | <span style="color: #000000">Required</span> | <span style="color: #000000">Defines the details of the connection:</span><br>- `host`<span style="color: #000000">: The DNS host name or IP address to connect to the remote instance of NIOS.</span>
- `username`<span style="color: #000000">: The user name to use for authenticating the connection to the remote instance.</span>
- `password`<span style="color: #000000">: The password to use for authenticating the connection to the remote instance.</span><br><span style="color: #000000">For information on additional fields you can define, see </span><span style="color: #172b4d">the list of subparameters in the </span><span style="color: #172b4d">*[NIOS Modules for Ansible Collections](https://infoblox-docs.atlassian.net/wiki/spaces/niosmodulesansible/pages/44525470)*</span><span style="color: #172b4d"> topic.</span> |
| `connection` | <span style="color: #000000">Required</span> | <span style="color: #000000">The </span>`nios_network`<span style="color: #000000"> module must be run locally.</span> |

## <span style="color: #000000">Examples</span>

`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`