theforeman.foreman.subnet – Manage Subnets

Note

This plugin is part of the theforeman.foreman collection (version 2.1.2).

To install it use: ansible-galaxy collection install theforeman.foreman.

To use it in a playbook, specify: theforeman.foreman.subnet.

New in version 1.0.0: of theforeman.foreman

Synopsis

  • Create, update, and delete Subnets

Requirements

The below requirements are needed on the host that executes this module.

  • ipaddress

  • requests

Parameters

Parameter Choices/Defaults Comments
bmc_proxy
string
added in 2.1.0 of theforeman.foreman
BMC Smart proxy for this subnet
boot_mode
string
    Choices:
  • DHCP ←
  • Static
Boot mode used by hosts in this subnet
cidr
integer
CIDR prefix length; Required if network_type=IPv4 and no mask provided
description
string
Description of the subnet
dhcp_proxy
string
DHCP Smart proxy for this subnet
discovery_proxy
string
Discovery Smart proxy for this subnet
This option is only available if the discovery plugin is installed.
dns_primary
string
Primary DNS server for this subnet
dns_proxy
string
Reverse DNS Smart proxy for this subnet
dns_secondary
string
Secondary DNS server for this subnet
domains
list / elements=string
List of DNS domains the subnet should assigned to
externalipam_group
string
added in 1.5.0 of theforeman.foreman
External IPAM group for this subnet.
Only relevant if ipam=External IPAM.
externalipam_proxy
string
External IPAM proxy for this subnet.
Only relevant if ipam=External IPAM.
from_ip
string
First IP address of the host IP allocation pool
gateway
string
Subnet gateway IP address
httpboot_proxy
string
HTTP Boot Smart proxy for this subnet
ipam
string
    Choices:
  • DHCP ←
  • Internal DB
  • Random DB
  • EUI-64
  • External IPAM
  • None
IPAM mode for this subnet
locations
list / elements=string
List of locations the entity should be assigned to
mask
string
Subnet netmask. Required if network_type=IPv4 and no cidr prefix length provided
mtu
integer
MTU
name
string / required
Subnet name
network
string / required
Subnet IP address
network_type
string
    Choices:
  • IPv4 ←
  • IPv6
Subnet type
organizations
list / elements=string
List of organizations the entity should be assigned to
parameters
list / elements=dictionary
Subnet specific host parameters
name
string / required
Name of the parameter
parameter_type
string
    Choices:
  • string ←
  • boolean
  • integer
  • real
  • array
  • hash
  • yaml
  • json
Type of the parameter
value
raw / required
Value of the parameter
password
string / required
Password of the user accessing the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_PASSWORD will be used instead.
remote_execution_proxies
list / elements=string
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.
server_url
string / required
URL of the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_SERVER_URL will be used instead.
state
string
    Choices:
  • present ←
  • absent
State of the entity
template_proxy
string
Template Smart proxy for this subnet
tftp_proxy
string
TFTP Smart proxy for this subnet
to_ip
string
Last IP address of the host IP allocation pool
updated_name
string
New subnet name. When this parameter is set, the module will not be idempotent.
username
string / required
Username accessing the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_USERNAME will be used instead.
validate_certs
boolean
    Choices:
  • no
  • yes ←
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 FOREMAN_VALIDATE_CERTS will be used instead.
vlanid
integer
VLAN ID

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 Returned Description
entity
dictionary
success
Final state of the affected entities grouped by their type.

 
subnets
list / elements=dictionary
success
List of subnets.



Authors

  • Baptiste Agasse (@bagasse)