fortinet.fortios.fortios_system_dhcp_server – Configure DHCP servers in Fortinet’s FortiOS and FortiGate.
Note
This plugin is part of the fortinet.fortios collection (version 2.1.3).
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 fortinet.fortios
.
To use it in a playbook, specify: fortinet.fortios.fortios_system_dhcp_server
.
New in version 2.10: of fortinet.fortios
Synopsis
This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system_dhcp feature and server category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.0
Requirements
The below requirements are needed on the host that executes this module.
ansible>=2.9.0
Parameters
Parameter |
Comments |
---|---|
Token-based authentication. Generated from GUI of Fortigate. |
|
Enable/Disable logging for task. Choices:
|
|
Member attribute path to operate on. Delimited by a slash character if there are more than one attribute. Parameter marked with member_path is legitimate for doing member operation. |
|
Add or delete a member under specified attribute path. When member_state is specified, the state option is ignored. Choices:
|
|
Indicates whether to create or remove the object. Choices:
|
|
Configure DHCP servers. |
|
Enable/disable auto configuration. Choices:
|
|
Enable/disable use of this DHCP server once this interface has been assigned an IP address from FortiIPAM. Choices:
|
|
Time in seconds to wait after a conflicted IP address is removed from the DHCP range before it can be reused. |
|
DDNS authentication mode. Choices:
|
|
DDNS update key (base 64 encoding). |
|
DDNS update key name. |
|
DDNS server IP. |
|
TTL. |
|
Enable/disable DDNS update for DHCP. Choices:
|
|
Enable/disable DDNS update override for DHCP. Choices:
|
|
Zone of your domain name (ex. DDNS.com). |
|
Default gateway IP address assigned by the DHCP server. |
|
Enable/disable populating of DHCP server settings from FortiIPAM. Choices:
|
|
DNS server 1. |
|
DNS server 2. |
|
DNS server 3. |
|
DNS server 4. |
|
Options for assigning DNS servers to DHCP clients. Choices:
|
|
Domain name suffix for the IP addresses that the DHCP server assigns to clients. |
|
Exclude one or more ranges of IP addresses from being assigned to clients. |
|
End of IP range. |
|
ID. |
|
Start of IP range. |
|
Name of the boot file on the TFTP server. |
|
Enable/disable FortiClient-On-Net service for this DHCP server. Choices:
|
|
ID. |
|
DHCP server can assign IP configurations to clients connected to this interface. Source system.interface.name. |
|
Method used to assign client IP. Choices:
|
|
DHCP IP range configuration. |
|
End of IP range. |
|
ID. |
|
Start of IP range. |
|
DHCP over IPsec leases expire this many seconds after tunnel down (0 to disable forced-expiry). |
|
Lease time in seconds, 0 means unlimited. |
|
MAC access control default action (allow or block assigning IP settings). Choices:
|
|
Netmask assigned by the DHCP server. |
|
IP address of a server (for example, a TFTP sever) that DHCP clients can download a boot file from. |
|
NTP server 1. |
|
NTP server 2. |
|
NTP server 3. |
|
Options for assigning Network Time Protocol (NTP) servers to DHCP clients. Choices:
|
|
DHCP options. |
|
DHCP option code. |
|
ID. |
|
DHCP option IPs. |
|
DHCP option type. Choices:
|
|
DHCP option value. |
|
Options for the DHCP server to assign IP settings to specific MAC addresses. |
|
Options for the DHCP server to configure the client with the reserved MAC address. Choices:
|
|
Option 82 circuit-ID of the client that will get the reserved IP address. |
|
DHCP option type. Choices:
|
|
Description. |
|
ID. |
|
IP address to be reserved for the MAC address. |
|
MAC address of the client that will get the reserved IP address. |
|
Option 82 remote-ID of the client that will get the reserved IP address. |
|
DHCP option type. Choices:
|
|
DHCP reserved-address type. Choices:
|
|
DHCP server can be a normal DHCP server or an IPsec DHCP server. Choices:
|
|
Enable/disable this DHCP configuration. Choices:
|
|
One or more hostnames or IP addresses of the TFTP servers in quotes separated by spaces. |
|
TFTP server. |
|
Select the time zone to be assigned to DHCP clients. Choices:
|
|
Options for the DHCP server to set the client”s time zone. Choices:
|
|
Enable/disable vendor class identifier (VCI) matching. When enabled only DHCP requests with a matching VCI are served. Choices:
|
|
One or more VCI strings in quotes separated by spaces. |
|
VCI strings. |
|
WiFi Access Controller 1 IP address (DHCP option 138, RFC 5417). |
|
WiFi Access Controller 2 IP address (DHCP option 138, RFC 5417). |
|
WiFi Access Controller 3 IP address (DHCP option 138, RFC 5417). |
|
Options for assigning WiFi Access Controllers to DHCP clients Choices:
|
|
WINS server 1. |
|
WINS server 2. |
|
Virtual domain, among those defined previously. A vdom is a virtual instance of the FortiGate that can be configured and used as a different unit. Default: “root” |
Examples
- collections:
- fortinet.fortios
connection: httpapi
hosts: fortigate01
vars:
ansible_httpapi_port: 443
ansible_httpapi_use_ssl: true
ansible_httpapi_validate_certs: false
vdom: root
tasks:
- name: fortios_system_dhcp_server
fortios_system_dhcp_server:
vdom: root
state: present
system_dhcp_server:
auto_configuration: enable
auto_managed_status: enable
conflicted_ip_timeout: 1800
ddns_auth: disable
ddns_server_ip: 0.0.0.0
ddns_ttl: 300
ddns_update: disable
ddns_update_override: disable
default_gateway: 0.0.0.0
dhcp_settings_from_fortiipam: disable
dns_server1: 0.0.0.0
dns_server2: 0.0.0.0
dns_server3: 0.0.0.0
dns_server4: 0.0.0.0
dns_service: default
forticlient_on_net_status: enable
id: 1
interface: port2
ip_mode: range
ip_range:
- end_ip: 1.1.1.22
id: 1
start_ip: 1.1.1.1
ipsec_lease_hold: 60
lease_time: 604800
mac_acl_default_action: assign
netmask: 255.255.255.0
next_server: 0.0.0.0
ntp_server1: 192.168.52.22
ntp_server2: 0.0.0.0
ntp_server3: 0.0.0.0
ntp_service: specify
server_type: regular
status: disable
timezone: '00'
timezone_option: disable
vci_match: disable
wifi_ac1: 0.0.0.0
wifi_ac2: 0.0.0.0
wifi_ac3: 0.0.0.0
wifi_ac_service: specify
wins_server1: 0.0.0.0
wins_server2: 0.0.0.0
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Build number of the fortigate image Returned: always Sample: “1547” |
|
Last method used to provision the content into FortiGate Returned: always Sample: “PUT” |
|
Last result given by FortiGate on last operation applied Returned: always Sample: “200” |
|
Master key (id) used in the last call to FortiGate Returned: success Sample: “id” |
|
Name of the table used to fulfill the request Returned: always Sample: “urlfilter” |
|
Path of the table used to fulfill the request Returned: always Sample: “webfilter” |
|
Internal revision number Returned: always Sample: “17.0.2.10658” |
|
Serial number of the unit Returned: always Sample: “FGVMEVYYQT3AB5352” |
|
Indication of the operation’s result Returned: always Sample: “success” |
|
Virtual domain used Returned: always Sample: “root” |
|
Version of the FortiGate Returned: always Sample: “v5.6.3” |
Authors
Link Zheng (@chillancezen)
Jie Xue (@JieX19)
Hongbin Lu (@fgtdev-hblu)
Frank Shen (@frankshen01)
Miguel Angel Munoz (@mamunozgonzalez)
Nicolas Thomas (@thomnico)