theforeman.foreman.subnet module – Manage Subnets
Note
This module is part of the theforeman.foreman collection (version 3.11.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install theforeman.foreman
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: theforeman.foreman.subnet
.
New in theforeman.foreman 1.0.0
Synopsis
Create, update, and delete Subnets
Requirements
The below requirements are needed on the host that executes this module.
ipaddress
requests
Parameters
Parameter |
Comments |
---|---|
BMC Smart proxy for this subnet |
|
Boot mode used by hosts in this subnet Choices:
|
|
CIDR prefix length; Required if network_type=IPv4 and no mask provided |
|
Description of the subnet |
|
DHCP Smart proxy for this subnet |
|
Discovery Smart proxy for this subnet This option is only available if the discovery plugin is installed. |
|
Primary DNS server for this subnet |
|
Reverse DNS Smart proxy for this subnet |
|
Secondary DNS server for this subnet |
|
List of DNS domains the subnet should assigned to |
|
External IPAM group for this subnet. Only relevant if ipam=External IPAM. |
|
External IPAM proxy for this subnet. Only relevant if ipam=External IPAM. |
|
First IP address of the host IP allocation pool |
|
Subnet gateway IP address |
|
HTTP Boot Smart proxy for this subnet |
|
IPAM mode for this subnet Choices:
|
|
List of locations the entity should be assigned to |
|
Subnet netmask. Required if network_type=IPv4 and no cidr prefix length provided |
|
MTU |
|
Subnet name |
|
Subnet IP address |
|
Subnet type Choices:
|
|
List of organizations the entity should be assigned to |
|
Subnet specific host parameters |
|
Name of the parameter |
|
Type of the parameter Choices:
|
|
Value of the parameter |
|
Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
|
Remote execution Smart proxies for this subnet This option is only available if the remote_execution plugin is installed. This will always report changed=true when used with remote_execution < 4.1.0, due to a bug in the plugin. |
|
URL of the Foreman server. If the value is not specified in the task, the value of environment variable |
|
State of the entity Choices:
|
|
Template Smart proxy for this subnet |
|
TFTP Smart proxy for this subnet |
|
Last IP address of the host IP allocation pool |
|
New subnet name. When this parameter is set, the module will not be idempotent. |
|
Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
|
Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable Choices:
|
|
VLAN ID |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in check_mode and return changed status prediction without modifying the entity |
|
Support: full |
Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode |
Examples
- name: My subnet
theforeman.foreman.subnet:
name: "My subnet"
description: "My description"
network: "192.168.0.0"
mask: "255.255.255.192"
gateway: "192.168.0.1"
from_ip: "192.168.0.2"
to_ip: "192.168.0.42"
boot_mode: "Static"
dhcp_proxy: "smart-proxy1.foo.example.com"
tftp_proxy: "smart-proxy1.foo.example.com"
dns_proxy: "smart-proxy2.foo.example.com"
template_proxy: "smart-proxy2.foo.example.com"
vlanid: 452
mtu: 9000
domains:
- "foo.example.com"
- "bar.example.com"
organizations:
- "Example Org"
locations:
- "Toulouse"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Final state of the affected entities grouped by their type. Returned: success |
|
List of subnets. Returned: success |