fortinet.fortimanager.fmgr_system_dhcp_server (2.4.0) — module

Configure DHCP servers.

| "added in version" 2.0.0 of fortinet.fortimanager"

Authors: Xinwei Du (@dux-fortinet), Xing Li (@lix-fortinet), Jie Xue (@JieX19), Link Zheng (@chillancezen), Frank Shen (@fshen01), Hongbin Lu (@fgtdev-hblu)

preview | supported by community

Install collection

Install with ansible-galaxy collection install fortinet.fortimanager:==2.4.0


Add to requirements.yml

  collections:
    - name: fortinet.fortimanager
      version: 2.4.0

Description

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.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Example playbook
  hosts: fortimanagers
  connection: httpapi
  vars:
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_httpapi_port: 443
  tasks:
    - name: Configure DHCP servers.
      fortinet.fortimanager.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]>
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gathering fortimanager facts
  hosts: fortimanagers
  gather_facts: false
  connection: httpapi
  vars:
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_httpapi_port: 443
  tasks:
    - name: Retrieve all the DHCP servers
      fortinet.fortimanager.fmgr_fact:
        facts:
          selector: "system_dhcp_server"
          params:
            adom: "ansible"
            server: "your_value"

Inputs

    
adom:
    description: The parameter (adom) in requested url.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    description: The directive to create, update or delete an object.
    required: true
    type: str

rc_failed:
    description: The rc codes list with which the conditions to fail will be overriden.
    elements: int
    type: list

enable_log:
    default: false
    description: Enable/Disable logging for task.
    type: bool

access_token:
    description: The token to access FortiManager without using username and password.
    type: str

rc_succeeded:
    description: The rc codes list with which the conditions to succeed will be overriden.
    elements: int
    type: list

proposed_method:
    choices:
    - update
    - set
    - add
    description: The overridden method for the underlying Json RPC request.
    type: str

bypass_validation:
    default: false
    description: Only set to True when module schema diffs with FortiManager API structure,
      module continues to execute without validating parameters.
    type: bool

system_dhcp_server:
    description: The top level parameters set.
    required: false
    suboptions:
      auto-configuration:
        choices:
        - disable
        - enable
        description: Deprecated, please rename it to auto_configuration. Enable/disable
          auto configuration.
        type: str
      auto-managed-status:
        choices:
        - disable
        - enable
        description: Deprecated, please rename it to auto_managed_status. Enable/disable
          use of this DHCP server once this interface has been a...
        type: str
      conflicted-ip-timeout:
        description: Deprecated, please rename it to conflicted_ip_timeout. Time in seconds
          to wait after a conflicted IP address is removed fr...
        type: int
      ddns-auth:
        choices:
        - disable
        - tsig
        description: Deprecated, please rename it to ddns_auth. DDNS authentication mode.
        type: str
      ddns-key:
        description: (list or str) Deprecated, please rename it to ddns_key. DDNS update
          key
        type: raw
      ddns-keyname:
        description: Deprecated, please rename it to ddns_keyname. DDNS update key name.
        type: str
      ddns-server-ip:
        description: Deprecated, please rename it to ddns_server_ip. DDNS server IP.
        type: str
      ddns-ttl:
        description: Deprecated, please rename it to ddns_ttl. TTL.
        type: int
      ddns-update:
        choices:
        - disable
        - enable
        description: Deprecated, please rename it to ddns_update. Enable/disable DDNS
          update for DHCP.
        type: str
      ddns-update-override:
        choices:
        - disable
        - enable
        description: Deprecated, please rename it to ddns_update_override. Enable/disable
          DDNS update override for DHCP.
        type: str
      ddns-zone:
        description: Deprecated, please rename it to ddns_zone. Zone of your domain name
        type: str
      default-gateway:
        description: Deprecated, please rename it to default_gateway. Default gateway
          IP address assigned by the DHCP server.
        type: str
      dhcp-settings-from-fortiipam:
        choices:
        - disable
        - enable
        description: Deprecated, please rename it to dhcp_settings_from_fortiipam. Enable/disable
          populating of DHCP server settings from Forti...
        type: str
      dns-server1:
        description: Deprecated, please rename it to dns_server1. DNS server 1.
        type: str
      dns-server2:
        description: Deprecated, please rename it to dns_server2. DNS server 2.
        type: str
      dns-server3:
        description: Deprecated, please rename it to dns_server3. DNS server 3.
        type: str
      dns-server4:
        description: Deprecated, please rename it to dns_server4. DNS server 4.
        type: str
      dns-service:
        choices:
        - default
        - specify
        - local
        description: Deprecated, please rename it to dns_service. Options for assigning
          DNS servers to DHCP clients.
        type: str
      domain:
        description: Domain name suffix for the IP addresses that the DHCP server assigns
          to clients.
        type: str
      exclude-range:
        description: Deprecated, please rename it to exclude_range. Exclude-Range.
        elements: dict
        suboptions:
          end-ip:
            description: Deprecated, please rename it to end_ip. End of IP range.
            type: str
          id:
            description: ID.
            type: int
          lease-time:
            description: Deprecated, please rename it to lease_time. Lease time in seconds,
              0 means default lease time.
            type: int
          start-ip:
            description: Deprecated, please rename it to start_ip. Start of IP range.
            type: str
          uci-match:
            choices:
            - disable
            - enable
            description: Deprecated, please rename it to uci_match. Enable/disable user
              class identifier
            type: str
          uci-string:
            description: (list) Deprecated, please rename it to uci_string.
            type: raw
          vci-match:
            choices:
            - disable
            - enable
            description: Deprecated, please rename it to vci_match. Enable/disable vendor
              class identifier
            type: str
          vci-string:
            description: (list) Deprecated, please rename it to vci_string.
            type: raw
        type: list
      filename:
        description: Name of the boot file on the TFTP server.
        type: str
      forticlient-on-net-status:
        choices:
        - disable
        - enable
        description: Deprecated, please rename it to forticlient_on_net_status. Enable/disable
          FortiClient-On-Net service for this DHCP server.
        type: str
      id:
        description: ID.
        required: true
        type: int
      interface:
        description: DHCP server can assign IP configurations to clients connected to
          this interface.
        type: str
      ip-mode:
        choices:
        - range
        - usrgrp
        description: Deprecated, please rename it to ip_mode. Method used to assign client
          IP.
        type: str
      ip-range:
        description: Deprecated, please rename it to ip_range. Ip-Range.
        elements: dict
        suboptions:
          end-ip:
            description: Deprecated, please rename it to end_ip. End of IP range.
            type: str
          id:
            description: ID.
            type: int
          lease-time:
            description: Deprecated, please rename it to lease_time. Lease time in seconds,
              0 means default lease time.
            type: int
          start-ip:
            description: Deprecated, please rename it to start_ip. Start of IP range.
            type: str
          uci-match:
            choices:
            - disable
            - enable
            description: Deprecated, please rename it to uci_match. Enable/disable user
              class identifier
            type: str
          uci-string:
            description: (list) Deprecated, please rename it to uci_string.
            type: raw
          vci-match:
            choices:
            - disable
            - enable
            description: Deprecated, please rename it to vci_match. Enable/disable vendor
              class identifier
            type: str
          vci-string:
            description: (list) Deprecated, please rename it to vci_string.
            type: raw
        type: list
      ipsec-lease-hold:
        description: Deprecated, please rename it to ipsec_lease_hold. DHCP over IPsec
          leases expire this many seconds after tunnel down
        type: int
      lease-time:
        description: Deprecated, please rename it to lease_time. Lease time in seconds,
          0 means unlimited.
        type: int
      mac-acl-default-action:
        choices:
        - assign
        - block
        description: Deprecated, please rename it to mac_acl_default_action. MAC access
          control default action
        type: str
      netmask:
        description: Netmask assigned by the DHCP server.
        type: str
      next-server:
        description: Deprecated, please rename it to next_server. IP address of a server
        type: str
      ntp-server1:
        description: Deprecated, please rename it to ntp_server1. NTP server 1.
        type: str
      ntp-server2:
        description: Deprecated, please rename it to ntp_server2. NTP server 2.
        type: str
      ntp-server3:
        description: Deprecated, please rename it to ntp_server3. NTP server 3.
        type: str
      ntp-service:
        choices:
        - default
        - specify
        - local
        description: Deprecated, please rename it to ntp_service. Options for assigning
          Network Time Protocol
        type: str
      options:
        description: Options.
        elements: dict
        suboptions:
          code:
            description: DHCP option code.
            type: int
          id:
            description: ID.
            type: int
          ip:
            description: (list) DHCP option IPs.
            type: raw
          type:
            choices:
            - hex
            - string
            - ip
            - fqdn
            description: DHCP option type.
            type: str
          uci-match:
            choices:
            - disable
            - enable
            description: Deprecated, please rename it to uci_match. Enable/disable user
              class identifier
            type: str
          uci-string:
            description: (list) Deprecated, please rename it to uci_string.
            type: raw
          value:
            description: DHCP option value.
            type: str
          vci-match:
            choices:
            - disable
            - enable
            description: Deprecated, please rename it to vci_match. Enable/disable vendor
              class identifier
            type: str
          vci-string:
            description: (list) Deprecated, please rename it to vci_string.
            type: raw
        type: list
      relay-agent:
        description: Deprecated, please rename it to relay_agent. Relay agent IP.
        type: str
      reserved-address:
        description: Deprecated, please rename it to reserved_address. Reserved-Address.
        elements: dict
        suboptions:
          action:
            choices:
            - assign
            - block
            - reserved
            description: Options for the DHCP server to configure the client with the
              reserved MAC address.
            type: str
          circuit-id:
            description: Deprecated, please rename it to circuit_id. Option 82 circuit-ID
              of the client that will get the reserved IP address.
            type: str
          circuit-id-type:
            choices:
            - hex
            - string
            description: Deprecated, please rename it to circuit_id_type. DHCP option
              type.
            type: str
          description:
            description: Description.
            type: str
          id:
            description: ID.
            type: int
          ip:
            description: IP address to be reserved for the MAC address.
            type: str
          mac:
            description: MAC address of the client that will get the reserved IP address.
            type: str
          remote-id:
            description: Deprecated, please rename it to remote_id. Option 82 remote-ID
              of the client that will get the reserved IP address.
            type: str
          remote-id-type:
            choices:
            - hex
            - string
            description: Deprecated, please rename it to remote_id_type. DHCP option type.
            type: str
          type:
            choices:
            - mac
            - option82
            description: DHCP reserved-address type.
            type: str
        type: list
      server-type:
        choices:
        - regular
        - ipsec
        description: Deprecated, please rename it to server_type. DHCP server can be a
          normal DHCP server or an IPsec DHCP server.
        type: str
      shared-subnet:
        choices:
        - disable
        - enable
        description: Deprecated, please rename it to shared_subnet. Enable/disable shared
          subnet.
        type: str
      status:
        choices:
        - disable
        - enable
        description: Enable/disable this DHCP configuration.
        type: str
      tftp-server:
        description: (list) Deprecated, please rename it to tftp_server. One or more hostnames
          or IP addresses of the TFTP servers in quotes se...
        type: raw
      timezone:
        choices:
        - '00'
        - '01'
        - '02'
        - '03'
        - '04'
        - '05'
        - '06'
        - '07'
        - 08
        - 09
        - '10'
        - '11'
        - '12'
        - '13'
        - '14'
        - '15'
        - '16'
        - '17'
        - '18'
        - '19'
        - '20'
        - '21'
        - '22'
        - '23'
        - '24'
        - '25'
        - '26'
        - '27'
        - '28'
        - '29'
        - '30'
        - '31'
        - '32'
        - '33'
        - '34'
        - '35'
        - '36'
        - '37'
        - '38'
        - '39'
        - '40'
        - '41'
        - '42'
        - '43'
        - '44'
        - '45'
        - '46'
        - '47'
        - '48'
        - '49'
        - '50'
        - '51'
        - '52'
        - '53'
        - '54'
        - '55'
        - '56'
        - '57'
        - '58'
        - '59'
        - '60'
        - '61'
        - '62'
        - '63'
        - '64'
        - '65'
        - '66'
        - '67'
        - '68'
        - '69'
        - '70'
        - '71'
        - '72'
        - '73'
        - '74'
        - '75'
        - '76'
        - '77'
        - '78'
        - '79'
        - '80'
        - '81'
        - '82'
        - '83'
        - '84'
        - '85'
        - '86'
        - '87'
        description: Select the time zone to be assigned to DHCP clients.
        type: str
      timezone-option:
        choices:
        - disable
        - default
        - specify
        description: Deprecated, please rename it to timezone_option. Options for the
          DHCP server to set the clients time zone.
        type: str
      vci-match:
        choices:
        - disable
        - enable
        description: Deprecated, please rename it to vci_match. Enable/disable vendor
          class identifier
        type: str
      vci-string:
        description: (list) Deprecated, please rename it to vci_string. One or more VCI
          strings in quotes separated by spaces.
        type: raw
      wifi-ac-service:
        choices:
        - specify
        - local
        description: Deprecated, please rename it to wifi_ac_service. Options for assigning
          WiFi Access Controllers to DHCP clients
        type: str
      wifi-ac1:
        description: Deprecated, please rename it to wifi_ac1. WiFi Access Controller
          1 IP address
        type: str
      wifi-ac2:
        description: Deprecated, please rename it to wifi_ac2. WiFi Access Controller
          2 IP address
        type: str
      wifi-ac3:
        description: Deprecated, please rename it to wifi_ac3. WiFi Access Controller
          3 IP address
        type: str
      wins-server1:
        description: Deprecated, please rename it to wins_server1. WINS server 1.
        type: str
      wins-server2:
        description: Deprecated, please rename it to wins_server2. WINS server 2.
        type: str
    type: dict

workspace_locking_adom:
    description: The adom to lock for FortiManager running in workspace mode, the value
      can be global and others including root.
    type: str

forticloud_access_token:
    description: Authenticate Ansible client with forticloud API access token.
    type: str

workspace_locking_timeout:
    default: 300
    description: The maximum time in seconds to wait for other user to release the workspace
      lock.
    type: int

Outputs

meta:
  contains:
    request_url:
      description: The full url requested.
      returned: always
      sample: /sys/login/user
      type: str
    response_code:
      description: The status of api request.
      returned: always
      sample: 0
      type: int
    response_data:
      description: The api response.
      returned: always
      type: list
    response_message:
      description: The descriptive message of the api response.
      returned: always
      sample: OK.
      type: str
    system_information:
      description: The information of the target system.
      returned: always
      type: dict
  description: The result of the request.
  returned: always
  type: dict
rc:
  description: The status the request.
  returned: always
  sample: 0
  type: int
version_check_warning:
  description: Warning if the parameters used in the playbook are not supported by
    the current FortiManager version.
  returned: complex
  type: list