drmofu.fortimanager.fmgr_system_dhcp_server (2.2.2) — module

Configure DHCP servers.

| "added in version" 2.0.0 of drmofu.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 drmofu.fortimanager:==2.2.2


Add to requirements.yml

  collections:
    - name: drmofu.fortimanager
      version: 2.2.2

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: 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: 'your_value'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
 - 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]>

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
    required: false
    type: list

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

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

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

proposed_method:
    choices:
    - update
    - set
    - add
    description: The overridden method for the underlying Json RPC request.
    required: false
    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.
    required: false
    type: bool

system_dhcp_server:
    description: the top level parameters set
    required: false
    suboptions:
      auto-configuration:
        choices:
        - disable
        - enable
        description: Enable/disable auto configuration.
        type: str
      auto-managed-status:
        choices:
        - disable
        - enable
        description: Enable/disable use of this DHCP server once this interface has been
          assigned an IP address from FortiIPAM.
        type: str
      conflicted-ip-timeout:
        description: Time in seconds to wait after a conflicted IP address is removed
          from the DHCP range before it can be reused.
        type: int
      ddns-auth:
        choices:
        - disable
        - tsig
        description: DDNS authentication mode.
        type: str
      ddns-key:
        description: DDNS update key
        type: str
      ddns-keyname:
        description: DDNS update key name.
        type: str
      ddns-server-ip:
        description: DDNS server IP.
        type: str
      ddns-ttl:
        description: TTL.
        type: int
      ddns-update:
        choices:
        - disable
        - enable
        description: Enable/disable DDNS update for DHCP.
        type: str
      ddns-update-override:
        choices:
        - disable
        - enable
        description: Enable/disable DDNS update override for DHCP.
        type: str
      ddns-zone:
        description: Zone of your domain name
        type: str
      default-gateway:
        description: Default gateway IP address assigned by the DHCP server.
        type: str
      dhcp-settings-from-fortiipam:
        choices:
        - disable
        - enable
        description: Enable/disable populating of DHCP server settings from FortiIPAM.
        type: str
      dns-server1:
        description: DNS server 1.
        type: str
      dns-server2:
        description: DNS server 2.
        type: str
      dns-server3:
        description: DNS server 3.
        type: str
      dns-server4:
        description: DNS server 4.
        type: str
      dns-service:
        choices:
        - default
        - specify
        - local
        description: 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: Exclude-Range.
        elements: dict
        suboptions:
          end-ip:
            description: End of IP range.
            type: str
          id:
            description: ID.
            type: int
          lease-time:
            description: Lease time in seconds, 0 means default lease time.
            type: int
          start-ip:
            description: Start of IP range.
            type: str
          uci-match:
            choices:
            - disable
            - enable
            description: Enable/disable user class identifier
            type: str
          uci-string:
            description: description
            type: str
          vci-match:
            choices:
            - disable
            - enable
            description: Enable/disable vendor class identifier
            type: str
          vci-string:
            description: description
            type: str
        type: list
      filename:
        description: Name of the boot file on the TFTP server.
        type: str
      forticlient-on-net-status:
        choices:
        - disable
        - enable
        description: Enable/disable FortiClient-On-Net service for this DHCP server.
        type: str
      id:
        description: ID.
        type: int
      interface:
        description: DHCP server can assign IP configurations to clients connected to
          this interface.
        type: str
      ip-mode:
        choices:
        - range
        - usrgrp
        description: Method used to assign client IP.
        type: str
      ip-range:
        description: Ip-Range.
        elements: dict
        suboptions:
          end-ip:
            description: End of IP range.
            type: str
          id:
            description: ID.
            type: int
          lease-time:
            description: Lease time in seconds, 0 means default lease time.
            type: int
          start-ip:
            description: Start of IP range.
            type: str
          uci-match:
            choices:
            - disable
            - enable
            description: Enable/disable user class identifier
            type: str
          uci-string:
            description: description
            type: str
          vci-match:
            choices:
            - disable
            - enable
            description: Enable/disable vendor class identifier
            type: str
          vci-string:
            description: description
            type: str
        type: list
      ipsec-lease-hold:
        description: DHCP over IPsec leases expire this many seconds after tunnel down
        type: int
      lease-time:
        description: Lease time in seconds, 0 means unlimited.
        type: int
      mac-acl-default-action:
        choices:
        - assign
        - block
        description: MAC access control default action
        type: str
      netmask:
        description: Netmask assigned by the DHCP server.
        type: str
      next-server:
        description: IP address of a server
        type: str
      ntp-server1:
        description: NTP server 1.
        type: str
      ntp-server2:
        description: NTP server 2.
        type: str
      ntp-server3:
        description: NTP server 3.
        type: str
      ntp-service:
        choices:
        - default
        - specify
        - local
        description: 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: DHCP option IPs.
            type: str
          type:
            choices:
            - hex
            - string
            - ip
            - fqdn
            description: DHCP option type.
            type: str
          uci-match:
            choices:
            - disable
            - enable
            description: Enable/disable user class identifier
            type: str
          uci-string:
            description: description
            type: str
          value:
            description: DHCP option value.
            type: str
          vci-match:
            choices:
            - disable
            - enable
            description: Enable/disable vendor class identifier
            type: str
          vci-string:
            description: description
            type: str
        type: list
      relay-agent:
        description: Relay agent IP.
        type: str
      reserved-address:
        description: 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: Option 82 circuit-ID of the client that will get the reserved
              IP address.
            type: str
          circuit-id-type:
            choices:
            - hex
            - string
            description: 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: Option 82 remote-ID of the client that will get the reserved
              IP address.
            type: str
          remote-id-type:
            choices:
            - hex
            - string
            description: DHCP option type.
            type: str
          type:
            choices:
            - mac
            - option82
            description: DHCP reserved-address type.
            type: str
        type: list
      server-type:
        choices:
        - regular
        - ipsec
        description: DHCP server can be a normal DHCP server or an IPsec DHCP server.
        type: str
      shared-subnet:
        choices:
        - disable
        - enable
        description: Enable/disable shared subnet.
        type: str
      status:
        choices:
        - disable
        - enable
        description: Enable/disable this DHCP configuration.
        type: str
      tftp-server:
        description: One or more hostnames or IP addresses of the TFTP servers in quotes
          separated by spaces.
        type: str
      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: Options for the DHCP server to set the clients time zone.
        type: str
      vci-match:
        choices:
        - disable
        - enable
        description: Enable/disable vendor class identifier
        type: str
      vci-string:
        description: One or more VCI strings in quotes separated by spaces.
        type: str
      wifi-ac-service:
        choices:
        - specify
        - local
        description: Options for assigning WiFi Access Controllers to DHCP clients
        type: str
      wifi-ac1:
        description: WiFi Access Controller 1 IP address
        type: str
      wifi-ac2:
        description: WiFi Access Controller 2 IP address
        type: str
      wifi-ac3:
        description: WiFi Access Controller 3 IP address
        type: str
      wins-server1:
        description: WINS server 1.
        type: str
      wins-server2:
        description: 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.
    required: false
    type: str

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

workspace_locking_timeout:
    default: 300
    description: The maximum time in seconds to wait for other user to release the workspace
      lock.
    required: false
    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