ansible.builtin.fortios_dnsfilter_profile (v2.8.20) — module

Configure DNS domain filter profiles in Fortinet's FortiOS and FortiGate.

| "added in version" 2.8 of ansible.builtin"

Authors: Miguel Angel Munoz (@mamunozgonzalez), Nicolas Thomas (@thomnico)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.8.20

Description

This module is able to configure a FortiGate or FortiOS by allowing the user to configure dnsfilter feature and profile category. Examples includes all options and need to be adjusted to datasources before usage. Tested with FOS v6.0.2


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- hosts: localhost
  vars:
   host: "192.168.122.40"
   username: "admin"
   password: ""
   vdom: "root"
  tasks:
  - name: Configure DNS domain filter profiles.
    fortios_dnsfilter_profile:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      dnsfilter_profile:
        state: "present"
        block-action: "block"
        block-botnet: "disable"
        comment: "Comment."
        domain-filter:
            domain-filter-table: "7 (source dnsfilter.domain-filter.id)"
        external-ip-blocklist:
         -
            name: "default_name_9 (source system.external-resource.name)"
        ftgd-dns:
            filters:
             -
                action: "block"
                category: "13"
                id:  "14"
                log: "enable"
            options: "error-allow"
        log-all-domain: "enable"
        name: "default_name_18"
        redirect-portal: "<your_own_value>"
        safe-search: "disable"
        sdns-domain-log: "enable"
        sdns-ftgd-err-log: "enable"
        youtube-restrict: "strict"

Inputs

    
host:
    description:
    - FortiOS or FortiGate ip address.
    required: true

vdom:
    default: root
    description:
    - 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.

https:
    default: false
    description:
    - Indicates if the requests towards FortiGate must use HTTPS protocol
    type: bool

password:
    default: ''
    description:
    - FortiOS or FortiGate password.

username:
    description:
    - FortiOS or FortiGate username.
    required: true

dnsfilter_profile:
    default: null
    description:
    - Configure DNS domain filter profiles.
    suboptions:
      block-action:
        choices:
        - block
        - redirect
        description:
        - Action to take for blocked domains.
      block-botnet:
        choices:
        - disable
        - enable
        description:
        - Enable/disable blocking botnet C&C DNS lookups.
      comment:
        description:
        - Comment.
      domain-filter:
        description:
        - Domain filter settings.
        suboptions:
          domain-filter-table:
            description:
            - DNS domain filter table ID. Source dnsfilter.domain-filter.id.
      external-ip-blocklist:
        description:
        - One or more external IP block lists.
        suboptions:
          name:
            description:
            - External domain block list name. Source system.external-resource.name.
            required: true
      ftgd-dns:
        description:
        - FortiGuard DNS Filter settings.
        suboptions:
          filters:
            description:
            - FortiGuard DNS domain filters.
            suboptions:
              action:
                choices:
                - block
                - monitor
                description:
                - Action to take for DNS requests matching the category.
              category:
                description:
                - Category number.
              id:
                description:
                - ID number.
                required: true
              log:
                choices:
                - enable
                - disable
                description:
                - Enable/disable DNS filter logging for this DNS profile.
          options:
            choices:
            - error-allow
            - ftgd-disable
            description:
            - FortiGuard DNS filter options.
      log-all-domain:
        choices:
        - enable
        - disable
        description:
        - Enable/disable logging of all domains visited (detailed DNS logging).
      name:
        description:
        - Profile name.
        required: true
      redirect-portal:
        description:
        - IP address of the SDNS redirect portal.
      safe-search:
        choices:
        - disable
        - enable
        description:
        - Enable/disable Google, Bing, and YouTube safe search.
      sdns-domain-log:
        choices:
        - enable
        - disable
        description:
        - Enable/disable domain filtering and botnet domain logging.
      sdns-ftgd-err-log:
        choices:
        - enable
        - disable
        description:
        - Enable/disable FortiGuard SDNS rating error logging.
      state:
        choices:
        - present
        - absent
        description:
        - Indicates whether to create or remove the object
      youtube-restrict:
        choices:
        - strict
        - moderate
        description:
        - Set safe search for YouTube restriction level.

Outputs

build:
  description: Build number of the fortigate image
  returned: always
  sample: '1547'
  type: str
http_method:
  description: Last method used to provision the content into FortiGate
  returned: always
  sample: PUT
  type: str
http_status:
  description: Last result given by FortiGate on last operation applied
  returned: always
  sample: '200'
  type: str
mkey:
  description: Master key (id) used in the last call to FortiGate
  returned: success
  sample: id
  type: str
name:
  description: Name of the table used to fulfill the request
  returned: always
  sample: urlfilter
  type: str
path:
  description: Path of the table used to fulfill the request
  returned: always
  sample: webfilter
  type: str
revision:
  description: Internal revision number
  returned: always
  sample: 17.0.2.10658
  type: str
serial:
  description: Serial number of the unit
  returned: always
  sample: FGVMEVYYQT3AB5352
  type: str
status:
  description: Indication of the operation's result
  returned: always
  sample: success
  type: str
vdom:
  description: Virtual domain used
  returned: always
  sample: root
  type: str
version:
  description: Version of the FortiGate
  returned: always
  sample: v5.6.3
  type: str