fortinet.fortios.fortios_firewall_shaping_policy (2.3.6) — module

Configure shaping policies in Fortinet's FortiOS and FortiGate.

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

Authors: Link Zheng (@chillancezen), Jie Xue (@JieX19), Hongbin Lu (@fgtdev-hblu), Frank Shen (@frankshen01), Miguel Angel Munoz (@mamunozgonzalez), Nicolas Thomas (@thomnico)

preview | supported by community

Install collection

Install with ansible-galaxy collection install fortinet.fortios:==2.3.6


Add to requirements.yml

  collections:
    - name: fortinet.fortios
      version: 2.3.6

Description

This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify firewall feature and shaping_policy category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.0


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure shaping policies.
  fortinet.fortios.fortios_firewall_shaping_policy:
      vdom: "{{ vdom }}"
      state: "present"
      access_token: "<your_own_value>"
      firewall_shaping_policy:
          app_category:
              -
                  id: "4"
          app_group:
              -
                  name: "default_name_6 (source application.group.name)"
          application:
              -
                  id: "8"
          class_id: "0"
          comment: "Comments."
          cos: "<your_own_value>"
          cos_mask: "<your_own_value>"
          diffserv_forward: "enable"
          diffserv_reverse: "enable"
          diffservcode_forward: "<your_own_value>"
          diffservcode_rev: "<your_own_value>"
          dstaddr:
              -
                  name: "default_name_18 (source firewall.address.name firewall.addrgrp.name)"
          dstaddr6:
              -
                  name: "default_name_20 (source firewall.address6.name firewall.addrgrp6.name)"
          dstintf:
              -
                  name: "default_name_22 (source system.interface.name system.zone.name system.sdwan.zone.name)"
          groups:
              -
                  name: "default_name_24 (source user.group.name)"
          id: "25"
          internet_service: "enable"
          internet_service_custom:
              -
                  name: "default_name_28 (source firewall.internet-service-custom.name)"
          internet_service_custom_group:
              -
                  name: "default_name_30 (source firewall.internet-service-custom-group.name)"
          internet_service_group:
              -
                  name: "default_name_32 (source firewall.internet-service-group.name)"
          internet_service_id:
              -
                  id: "34 (source firewall.internet-service.id)"
          internet_service_name:
              -
                  name: "default_name_36 (source firewall.internet-service-name.name)"
          internet_service_src: "enable"
          internet_service_src_custom:
              -
                  name: "default_name_39 (source firewall.internet-service-custom.name)"
          internet_service_src_custom_group:
              -
                  name: "default_name_41 (source firewall.internet-service-custom-group.name)"
          internet_service_src_group:
              -
                  name: "default_name_43 (source firewall.internet-service-group.name)"
          internet_service_src_id:
              -
                  id: "45 (source firewall.internet-service.id)"
          internet_service_src_name:
              -
                  name: "default_name_47 (source firewall.internet-service-name.name)"
          ip_version: "4"
          name: "default_name_49"
          per_ip_shaper: "<your_own_value> (source firewall.shaper.per-ip-shaper.name)"
          schedule: "<your_own_value> (source firewall.schedule.onetime.name firewall.schedule.recurring.name firewall.schedule.group.name)"
          service:
              -
                  name: "default_name_53 (source firewall.service.custom.name firewall.service.group.name)"
          srcaddr:
              -
                  name: "default_name_55 (source firewall.address.name firewall.addrgrp.name)"
          srcaddr6:
              -
                  name: "default_name_57 (source firewall.address6.name firewall.addrgrp6.name)"
          srcintf:
              -
                  name: "default_name_59 (source system.interface.name system.zone.name system.sdwan.zone.name)"
          status: "enable"
          tos: "<your_own_value>"
          tos_mask: "<your_own_value>"
          tos_negate: "enable"
          traffic_shaper: "<your_own_value> (source firewall.shaper.traffic-shaper.name)"
          traffic_shaper_reverse: "<your_own_value> (source firewall.shaper.traffic-shaper.name)"
          traffic_type: "forwarding"
          url_category:
              -
                  id: "68"
          users:
              -
                  name: "default_name_70 (source user.local.name)"
          uuid: "<your_own_value>"

Inputs

    
self:
    description:
    - mkey of self identifier
    type: str

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.
    type: str

after:
    description:
    - mkey of target identifier
    type: str

state:
    choices:
    - present
    - absent
    description:
    - Indicates whether to create or remove the object.
    required: false
    type: str

action:
    choices:
    - move
    description:
    - the action indiactor to move an object in the list
    type: str

before:
    description:
    - mkey of target identifier
    type: str

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

member_path:
    description:
    - 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.
    type: str

access_token:
    description:
    - Token-based authentication. Generated from GUI of Fortigate.
    required: false
    type: str

member_state:
    choices:
    - present
    - absent
    description:
    - Add or delete a member under specified attribute path.
    - When member_state is specified, the state option is ignored.
    type: str

firewall_shaping_policy:
    default: null
    description:
    - Configure shaping policies.
    suboptions:
      app_category:
        description:
        - IDs of one or more application categories that this shaper applies application
          control traffic shaping to.
        elements: dict
        suboptions:
          id:
            description:
            - Category IDs. see <a href='#notes'>Notes</a>.
            required: true
            type: int
        type: list
      app_group:
        description:
        - One or more application group names.
        elements: dict
        suboptions:
          name:
            description:
            - Application group name. Source application.group.name.
            required: true
            type: str
        type: list
      application:
        description:
        - IDs of one or more applications that this shaper applies application control
          traffic shaping to.
        elements: dict
        suboptions:
          id:
            description:
            - Application IDs. see <a href='#notes'>Notes</a>.
            required: true
            type: int
        type: list
      class_id:
        description:
        - Traffic class ID. Source firewall.traffic-class.class-id.
        type: int
      comment:
        description:
        - Comments.
        type: str
      cos:
        description:
        - VLAN CoS bit pattern.
        type: str
      cos_mask:
        description:
        - VLAN CoS evaluated bits.
        type: str
      diffserv_forward:
        choices:
        - enable
        - disable
        description:
        - Enable to change packet"s DiffServ values to the specified diffservcode-forward
          value.
        type: str
      diffserv_reverse:
        choices:
        - enable
        - disable
        description:
        - Enable to change packet"s reverse (reply) DiffServ values to the specified diffservcode-rev
          value.
        type: str
      diffservcode_forward:
        description:
        - Change packet"s DiffServ to this value.
        type: str
      diffservcode_rev:
        description:
        - Change packet"s reverse (reply) DiffServ to this value.
        type: str
      dstaddr:
        description:
        - IPv4 destination address and address group names.
        elements: dict
        suboptions:
          name:
            description:
            - Address name. Source firewall.address.name firewall.addrgrp.name.
            required: true
            type: str
        type: list
      dstaddr6:
        description:
        - IPv6 destination address and address group names.
        elements: dict
        suboptions:
          name:
            description:
            - Address name. Source firewall.address6.name firewall.addrgrp6.name.
            required: true
            type: str
        type: list
      dstintf:
        description:
        - One or more outgoing (egress) interfaces.
        elements: dict
        suboptions:
          name:
            description:
            - Interface name. Source system.interface.name system.zone.name system.sdwan.zone.name.
            required: true
            type: str
        type: list
      groups:
        description:
        - Apply this traffic shaping policy to user groups that have authenticated with
          the FortiGate.
        elements: dict
        suboptions:
          name:
            description:
            - Group name. Source user.group.name.
            required: true
            type: str
        type: list
      id:
        description:
        - Shaping policy ID (0 - 4294967295). see <a href='#notes'>Notes</a>.
        required: true
        type: int
      internet_service:
        choices:
        - enable
        - disable
        description:
        - Enable/disable use of Internet Services for this policy. If enabled, destination
          address and service are not used.
        type: str
      internet_service_custom:
        description:
        - Custom Internet Service name.
        elements: dict
        suboptions:
          name:
            description:
            - Custom Internet Service name. Source firewall.internet-service-custom.name.
            required: true
            type: str
        type: list
      internet_service_custom_group:
        description:
        - Custom Internet Service group name.
        elements: dict
        suboptions:
          name:
            description:
            - Custom Internet Service group name. Source firewall.internet-service-custom-group.name.
            required: true
            type: str
        type: list
      internet_service_group:
        description:
        - Internet Service group name.
        elements: dict
        suboptions:
          name:
            description:
            - Internet Service group name. Source firewall.internet-service-group.name.
            required: true
            type: str
        type: list
      internet_service_id:
        description:
        - Internet Service ID.
        elements: dict
        suboptions:
          id:
            description:
            - Internet Service ID. see <a href='#notes'>Notes</a>. Source firewall.internet-service.id.
            required: true
            type: int
        type: list
      internet_service_name:
        description:
        - Internet Service ID.
        elements: dict
        suboptions:
          name:
            description:
            - Internet Service name. Source firewall.internet-service-name.name.
            required: true
            type: str
        type: list
      internet_service_src:
        choices:
        - enable
        - disable
        description:
        - Enable/disable use of Internet Services in source for this policy. If enabled,
          source address is not used.
        type: str
      internet_service_src_custom:
        description:
        - Custom Internet Service source name.
        elements: dict
        suboptions:
          name:
            description:
            - Custom Internet Service name. Source firewall.internet-service-custom.name.
            required: true
            type: str
        type: list
      internet_service_src_custom_group:
        description:
        - Custom Internet Service source group name.
        elements: dict
        suboptions:
          name:
            description:
            - Custom Internet Service group name. Source firewall.internet-service-custom-group.name.
            required: true
            type: str
        type: list
      internet_service_src_group:
        description:
        - Internet Service source group name.
        elements: dict
        suboptions:
          name:
            description:
            - Internet Service group name. Source firewall.internet-service-group.name.
            required: true
            type: str
        type: list
      internet_service_src_id:
        description:
        - Internet Service source ID.
        elements: dict
        suboptions:
          id:
            description:
            - Internet Service ID. see <a href='#notes'>Notes</a>. Source firewall.internet-service.id.
            required: true
            type: int
        type: list
      internet_service_src_name:
        description:
        - Internet Service source name.
        elements: dict
        suboptions:
          name:
            description:
            - Internet Service name. Source firewall.internet-service-name.name.
            required: true
            type: str
        type: list
      ip_version:
        choices:
        - '4'
        - '6'
        description:
        - Apply this traffic shaping policy to IPv4 or IPv6 traffic.
        type: str
      name:
        description:
        - Shaping policy name.
        type: str
      per_ip_shaper:
        description:
        - Per-IP traffic shaper to apply with this policy. Source firewall.shaper.per-ip-shaper.name.
        type: str
      schedule:
        description:
        - Schedule name. Source firewall.schedule.onetime.name firewall.schedule.recurring.name
          firewall.schedule.group.name.
        type: str
      service:
        description:
        - Service and service group names.
        elements: dict
        suboptions:
          name:
            description:
            - Service name. Source firewall.service.custom.name firewall.service.group.name.
            required: true
            type: str
        type: list
      srcaddr:
        description:
        - IPv4 source address and address group names.
        elements: dict
        suboptions:
          name:
            description:
            - Address name. Source firewall.address.name firewall.addrgrp.name.
            required: true
            type: str
        type: list
      srcaddr6:
        description:
        - IPv6 source address and address group names.
        elements: dict
        suboptions:
          name:
            description:
            - Address name. Source firewall.address6.name firewall.addrgrp6.name.
            required: true
            type: str
        type: list
      srcintf:
        description:
        - One or more incoming (ingress) interfaces.
        elements: dict
        suboptions:
          name:
            description:
            - Interface name. Source system.interface.name system.zone.name system.sdwan.zone.name.
            required: true
            type: str
        type: list
      status:
        choices:
        - enable
        - disable
        description:
        - Enable/disable this traffic shaping policy.
        type: str
      tos:
        description:
        - ToS (Type of Service) value used for comparison.
        type: str
      tos_mask:
        description:
        - Non-zero bit positions are used for comparison while zero bit positions are
          ignored.
        type: str
      tos_negate:
        choices:
        - enable
        - disable
        description:
        - Enable negated TOS match.
        type: str
      traffic_shaper:
        description:
        - Traffic shaper to apply to traffic forwarded by the firewall policy. Source
          firewall.shaper.traffic-shaper.name.
        type: str
      traffic_shaper_reverse:
        description:
        - Traffic shaper to apply to response traffic received by the firewall policy.
          Source firewall.shaper.traffic-shaper.name.
        type: str
      traffic_type:
        choices:
        - forwarding
        - local-in
        - local-out
        description:
        - Traffic type.
        type: str
      url_category:
        description:
        - IDs of one or more FortiGuard Web Filtering categories that this shaper applies
          traffic shaping to.
        elements: dict
        suboptions:
          id:
            description:
            - URL category ID. see <a href='#notes'>Notes</a>.
            required: true
            type: int
        type: list
      users:
        description:
        - Apply this traffic shaping policy to individual users that have authenticated
          with the FortiGate.
        elements: dict
        suboptions:
          name:
            description:
            - User name. Source user.local.name.
            required: true
            type: str
        type: list
      uuid:
        description:
        - Universally Unique Identifier (UUID; automatically assigned but can be manually
          reset).
        type: str
    type: dict

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