fortinet.fortimanager.fmgr_system_dhcp_server – Configure DHCP servers.
Note
This plugin is part of the fortinet.fortimanager collection (version 2.1.4).
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.fortimanager
.
To use it in a playbook, specify: fortinet.fortimanager.fmgr_system_dhcp_server
.
New in version 2.10: of fortinet.fortimanager
Synopsis
This module is able to configure a FortiManager device.
Examples include all parameters and values which need to be adjusted to data sources before usage.
Parameters
Parameter |
Comments |
---|---|
the parameter (adom) in requested url |
|
only set to True when module schema diffs with FortiManager API structure, module continues to execute without validating parameters Choices:
|
|
Enable/Disable logging for task Choices:
|
|
The overridden method for the underlying Json RPC request Choices:
|
|
the rc codes list with which the conditions to fail will be overriden |
|
the rc codes list with which the conditions to succeed will be overriden |
|
the directive to create, update or delete an object Choices:
|
|
the top level parameters set |
|
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-Range. |
|
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. |
|
Method used to assign client IP. Choices:
|
|
Ip-Range. |
|
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:
|
|
Options. |
|
DHCP option code. |
|
ID. |
|
DHCP option IPs. |
|
DHCP option type. Choices:
|
|
DHCP option value. |
|
Reserved-Address. |
|
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. |
|
Select the time zone to be assigned to DHCP clients. Choices:
|
|
Options for the DHCP server to set the clients 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. |
|
Options for assigning WiFi Access Controllers to DHCP clients Choices:
|
|
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). |
|
WINS server 1. |
|
WINS server 2. |
|
the adom to lock for FortiManager running in workspace mode, the value can be global and others including root |
|
the maximum time in seconds to wait for other user to release the workspace lock Default: 300 |
Notes
Note
Running in workspace locking mode is supported in this FortiManager module, the top level parameters workspace_locking_adom and workspace_locking_timeout help do the work.
To create or update an object, use state present directive.
To delete an object, use state absent directive.
Normally, running one module can fail when a non-zero rc is returned. you can also override the conditions to fail or succeed with parameters rc_failed and rc_succeeded
Examples
- hosts: fortimanager00
collections:
- fortinet.fortimanager
connection: httpapi
vars:
ansible_httpapi_use_ssl: True
ansible_httpapi_validate_certs: False
ansible_httpapi_port: 443
tasks:
- name: Configure DHCP servers.
fmgr_system_dhcp_server:
bypass_validation: False
adom: ansible
state: present
system_dhcp_server:
auto-configuration: enable #<value in [disable, enable]>
default-gateway: '222.222.222.1'
filename: ansible-file
id: 1
interface: any
ip-mode: range #<value in [range, usrgrp]>
ip-range:
-
end-ip: 222.222.222.22
id: 1
start-ip: 222.222.222.2
netmask: 255.255.255.0
server-type: regular #<value in [regular, ipsec]>
status: disable #<value in [disable, enable]>
- name: gathering fortimanager facts
hosts: fortimanager00
gather_facts: no
connection: httpapi
collections:
- fortinet.fortimanager
vars:
ansible_httpapi_use_ssl: True
ansible_httpapi_validate_certs: False
ansible_httpapi_port: 443
tasks:
- name: retrieve all the DHCP servers
fmgr_fact:
facts:
selector: 'system_dhcp_server'
params:
adom: 'ansible'
server: ''
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The full url requested Returned: always Sample: “/sys/login/user” |
|
The status of api request Returned: always Sample: 0 |
|
The descriptive message of the api response Returned: always Sample: “OK.” |
Authors
Link Zheng (@chillancezen)
Jie Xue (@JieX19)
Frank Shen (@fshen01)
Hongbin Lu (@fgtdev-hblu)