fortios_system_admin – Configure admin users in Fortinet’s FortiOS and FortiGate.

New in version 2.8.

Synopsis

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

Requirements

The below requirements are needed on the host that executes this module.

  • ansible>=2.9.0

Parameters

  • access_token - Token-based authentication. Generated from GUI of Fortigate. type: str required: False
  • vdom - 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 default: root
  • state - Indicates whether to create or remove the object. This attribute was present already in previous version in a deeper level. It has been moved out to this outer level. type: str required: False choices: present, absent
  • system_admin - Configure admin users. type: dict
    • state - B(Deprecated) type: str required: False choices: present, absent
    • accprofile - Access profile for this administrator. Access profiles control administrator access to FortiGate features. Source system.accprofile.name. type: str
    • accprofile_override - Enable to use the name of an access profile provided by the remote authentication server to control the FortiGate features that this administrator can access. type: str choices: enable, disable
    • allow_remove_admin_session - Enable/disable allow admin session to be removed by privileged admin users. type: str choices: enable, disable
    • comments - Comment. type: str
    • email_to - This administrator"s email address. type: str
    • force_password_change - Enable/disable force password change on next login. type: str choices: enable, disable
    • fortitoken - This administrator"s FortiToken serial number. type: str
    • guest_auth - Enable/disable guest authentication. type: str choices: disable, enable
    • guest_lang - Guest management portal language. Source system.custom-language.name. type: str
    • guest_usergroups - Select guest user groups. type: list
      • name - Select guest user groups. type: str required: True
    • gui_dashboard - GUI dashboards. type: list
      • columns - Number of columns. type: int
      • id - Dashboard ID. type: int required: True
      • layout_type - Layout type. type: str choices: responsive, fixed
      • name - Dashboard name. type: str
      • scope - Dashboard scope. type: str choices: global, vdom
      • widget - Dashboard widgets. type: list
        • fabric_device - Fabric device to monitor. type: str
        • filters - FortiView filters. type: list
          • id - FortiView Filter ID. type: int required: True
          • key - Filter key. type: str
          • value - Filter value. type: str
        • height - Height. type: int
        • id - Widget ID. type: int required: True
        • industry - Security Audit Rating industry. type: str choices: default, custom
        • interface - Interface to monitor. Source system.interface.name. type: str
        • region - Security Audit Rating region. type: str choices: default, custom
        • report_by - Field to aggregate the data by. type: str choices: source, destination, country, intfpair, srcintf, dstintf, policy, wificlient, shaper, endpoint-vulnerability, endpoint-device, application, cloud-app, cloud-user, web-domain, web-category, web-search-phrase, threat, system, unauth, admin, vpn
        • sort_by - Field to sort the data by. type: str
        • timeframe - Timeframe period of reported data. type: str choices: realtime, 5min, hour, day, week
        • title - Widget title. type: str
        • type - Widget type. type: str choices: sysinfo, licinfo, vminfo, forticloud, cpu-usage, memory-usage, disk-usage, log-rate, sessions, session-rate, tr-history, analytics, usb-modem, admins, security-fabric, security-fabric-ranking, ha-status, vulnerability-summary, host-scan-summary, fortiview, botnet-activity, fortimail
        • visualization - Visualization to use. type: str choices: table, bubble, country, chord
        • width - Width. type: int
        • x_pos - X position. type: int
        • y_pos - Y position. type: int
    • gui_global_menu_favorites - Favorite GUI menu IDs for the global VDOM. type: list
      • id - Select menu ID. type: str required: True
    • gui_vdom_menu_favorites - Favorite GUI menu IDs for VDOMs. type: list
      • id - Select menu ID. type: str required: True
    • hidden - Admin user hidden attribute. type: int
    • history0 - history0 type: str
    • history1 - history1 type: str
    • ip6_trusthost1 - Any IPv6 address from which the administrator can connect to the FortiGate unit. Default allows access from any IPv6 address. type: str
    • ip6_trusthost10 - Any IPv6 address from which the administrator can connect to the FortiGate unit. Default allows access from any IPv6 address. type: str
    • ip6_trusthost2 - Any IPv6 address from which the administrator can connect to the FortiGate unit. Default allows access from any IPv6 address. type: str
    • ip6_trusthost3 - Any IPv6 address from which the administrator can connect to the FortiGate unit. Default allows access from any IPv6 address. type: str
    • ip6_trusthost4 - Any IPv6 address from which the administrator can connect to the FortiGate unit. Default allows access from any IPv6 address. type: str
    • ip6_trusthost5 - Any IPv6 address from which the administrator can connect to the FortiGate unit. Default allows access from any IPv6 address. type: str
    • ip6_trusthost6 - Any IPv6 address from which the administrator can connect to the FortiGate unit. Default allows access from any IPv6 address. type: str
    • ip6_trusthost7 - Any IPv6 address from which the administrator can connect to the FortiGate unit. Default allows access from any IPv6 address. type: str
    • ip6_trusthost8 - Any IPv6 address from which the administrator can connect to the FortiGate unit. Default allows access from any IPv6 address. type: str
    • ip6_trusthost9 - Any IPv6 address from which the administrator can connect to the FortiGate unit. Default allows access from any IPv6 address. type: str
    • login_time - Record user login time. type: list
      • last_failed_login - Last failed login time. type: str
      • last_login - Last successful login time. type: str
      • usr_name - User name. type: str
    • name - User name. type: str required: True
    • password - Admin user password. type: str
    • password_expire - Password expire time. type: str
    • peer_auth - Set to enable peer certificate authentication (for HTTPS admin access). type: str choices: enable, disable
    • peer_group - Name of peer group defined under config user group which has PKI members. Used for peer certificate authentication (for HTTPS admin access). type: str
    • radius_vdom_override - Enable to use the names of VDOMs provided by the remote authentication server to control the VDOMs that this administrator can access. type: str choices: enable, disable
    • remote_auth - Enable/disable authentication using a remote RADIUS, LDAP, or TACACS+ server. type: str choices: enable, disable
    • remote_group - User group name used for remote auth. type: str
    • schedule - Firewall schedule used to restrict when the administrator can log in. No schedule means no restrictions. type: str
    • sms_custom_server - Custom SMS server to send SMS messages to. Source system.sms-server.name. type: str
    • sms_phone - Phone number on which the administrator receives SMS messages. type: str
    • sms_server - Send SMS messages using the FortiGuard SMS server or a custom server. type: str choices: fortiguard, custom
    • ssh_certificate - Select the certificate to be used by the FortiGate for authentication with an SSH client. Source certificate.local.name. type: str
    • ssh_public_key1 - Public key of an SSH client. The client is authenticated without being asked for credentials. Create the public-private key pair in the SSH client application. type: str
    • ssh_public_key2 - Public key of an SSH client. The client is authenticated without being asked for credentials. Create the public-private key pair in the SSH client application. type: str
    • ssh_public_key3 - Public key of an SSH client. The client is authenticated without being asked for credentials. Create the public-private key pair in the SSH client application. type: str
    • trusthost1 - Any IPv4 address or subnet address and netmask from which the administrator can connect to the FortiGate unit. Default allows access from any IPv4 address. type: str
    • trusthost10 - Any IPv4 address or subnet address and netmask from which the administrator can connect to the FortiGate unit. Default allows access from any IPv4 address. type: str
    • trusthost2 - Any IPv4 address or subnet address and netmask from which the administrator can connect to the FortiGate unit. Default allows access from any IPv4 address. type: str
    • trusthost3 - Any IPv4 address or subnet address and netmask from which the administrator can connect to the FortiGate unit. Default allows access from any IPv4 address. type: str
    • trusthost4 - Any IPv4 address or subnet address and netmask from which the administrator can connect to the FortiGate unit. Default allows access from any IPv4 address. type: str
    • trusthost5 - Any IPv4 address or subnet address and netmask from which the administrator can connect to the FortiGate unit. Default allows access from any IPv4 address. type: str
    • trusthost6 - Any IPv4 address or subnet address and netmask from which the administrator can connect to the FortiGate unit. Default allows access from any IPv4 address. type: str
    • trusthost7 - Any IPv4 address or subnet address and netmask from which the administrator can connect to the FortiGate unit. Default allows access from any IPv4 address. type: str
    • trusthost8 - Any IPv4 address or subnet address and netmask from which the administrator can connect to the FortiGate unit. Default allows access from any IPv4 address. type: str
    • trusthost9 - Any IPv4 address or subnet address and netmask from which the administrator can connect to the FortiGate unit. Default allows access from any IPv4 address. type: str
    • two_factor - Enable/disable two-factor authentication. type: str choices: disable, fortitoken, email, sms
    • vdom - Virtual domain(s) that the administrator can access. type: list
      • name - Virtual domain name. Source system.vdom.name. type: str required: True
    • wildcard - Enable/disable wildcard RADIUS authentication. type: str choices: enable, disable

Notes

Note

  • Legacy fortiosapi has been deprecated, httpapi is the preferred way to run playbooks

Examples

- hosts: fortigates
  collections:
    - fortinet.fortios
  connection: httpapi
  vars:
   vdom: "root"
   ansible_httpapi_use_ssl: yes
   ansible_httpapi_validate_certs: no
   ansible_httpapi_port: 443
  tasks:
  - name: Configure admin users.
    fortios_system_admin:
      vdom:  "{{ vdom }}"
      state: "present"
      access_token: "<your_own_value>"
      system_admin:
        accprofile: "<your_own_value> (source system.accprofile.name)"
        accprofile_override: "enable"
        allow_remove_admin_session: "enable"
        comments: "<your_own_value>"
        email_to: "<your_own_value>"
        force_password_change: "enable"
        fortitoken: "<your_own_value>"
        guest_auth: "disable"
        guest_lang: "<your_own_value> (source system.custom-language.name)"
        guest_usergroups:
         -
            name: "default_name_13"
        gui_dashboard:
         -
            columns: "15"
            id:  "16"
            layout_type: "responsive"
            name: "default_name_18"
            scope: "global"
            widget:
             -
                fabric_device: "<your_own_value>"
                filters:
                 -
                    id:  "23"
                    key: "<your_own_value>"
                    value: "<your_own_value>"
                height: "26"
                id:  "27"
                industry: "default"
                interface: "<your_own_value> (source system.interface.name)"
                region: "default"
                report_by: "source"
                sort_by: "<your_own_value>"
                timeframe: "realtime"
                title: "<your_own_value>"
                type: "sysinfo"
                visualization: "table"
                width: "37"
                x_pos: "38"
                y_pos: "39"
        gui_global_menu_favorites:
         -
            id:  "41"
        gui_vdom_menu_favorites:
         -
            id:  "43"
        hidden: "44"
        history0: "<your_own_value>"
        history1: "<your_own_value>"
        ip6_trusthost1: "<your_own_value>"
        ip6_trusthost10: "<your_own_value>"
        ip6_trusthost2: "<your_own_value>"
        ip6_trusthost3: "<your_own_value>"
        ip6_trusthost4: "<your_own_value>"
        ip6_trusthost5: "<your_own_value>"
        ip6_trusthost6: "<your_own_value>"
        ip6_trusthost7: "<your_own_value>"
        ip6_trusthost8: "<your_own_value>"
        ip6_trusthost9: "<your_own_value>"
        login_time:
         -
            last_failed_login: "<your_own_value>"
            last_login: "<your_own_value>"
            usr_name: "<your_own_value>"
        name: "default_name_61"
        password: "<your_own_value>"
        password_expire: "<your_own_value>"
        peer_auth: "enable"
        peer_group: "<your_own_value>"
        radius_vdom_override: "enable"
        remote_auth: "enable"
        remote_group: "<your_own_value>"
        schedule: "<your_own_value>"
        sms_custom_server: "<your_own_value> (source system.sms-server.name)"
        sms_phone: "<your_own_value>"
        sms_server: "fortiguard"
        ssh_certificate: "<your_own_value> (source certificate.local.name)"
        ssh_public_key1: "<your_own_value>"
        ssh_public_key2: "<your_own_value>"
        ssh_public_key3: "<your_own_value>"
        trusthost1: "<your_own_value>"
        trusthost10: "<your_own_value>"
        trusthost2: "<your_own_value>"
        trusthost3: "<your_own_value>"
        trusthost4: "<your_own_value>"
        trusthost5: "<your_own_value>"
        trusthost6: "<your_own_value>"
        trusthost7: "<your_own_value>"
        trusthost8: "<your_own_value>"
        trusthost9: "<your_own_value>"
        two_factor: "disable"
        vdom:
         -
            name: "default_name_89 (source system.vdom.name)"
        wildcard: "enable"

Return Values

Common return values are documented: https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values, the following are the fields unique to this module:

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

Status

  • This module is not guaranteed to have a backwards compatible interface.

Authors

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

Hint

If you notice any issues in this documentation, you can create a pull request to improve it.