fortios_user_local – Configure local users in Fortinet’s FortiOS and FortiGate

New in version 2.9.

Synopsis

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

Requirements

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

  • fortiosapi>=0.9.8

Parameters

Parameter Choices/Defaults Comments
host
string
FortiOS or FortiGate IP address.
https
boolean
    Choices:
  • no
  • yes ←
Indicates if the requests towards FortiGate must use HTTPS protocol.
password
string
Default:
""
FortiOS or FortiGate password.
ssl_verify
boolean
    Choices:
  • no
  • yes ←
Ensures FortiGate certificate must be verified by a proper CA.
state
string / required
    Choices:
  • present
  • absent
Indicates whether to create or remove the object.
user_local
dictionary
Configure local users.
auth_concurrent_override
string
    Choices:
  • enable
  • disable
Enable/disable overriding the policy-auth-concurrent under config system global.
auth_concurrent_value
integer
Maximum number of concurrent logins permitted from the same user.
authtimeout
integer
Time in minutes before the authentication timeout for a user is reached.
email_to
string
Two-factor recipient's email address.
fortitoken
string
Two-factor recipient's FortiToken serial number. Source user.fortitoken.serial-number.
id
integer
User ID.
ldap_server
string
Name of LDAP server with which the user must authenticate. Source user.ldap.name.
name
string / required
User name.
passwd
string
User's password.
passwd_policy
string
Password policy to apply to this user, as defined in config user password-policy. Source user.password-policy.name.
passwd_time
string
Time of the last password update.
ppk_identity
string
IKEv2 Postquantum Preshared Key Identity.
ppk_secret
string
IKEv2 Postquantum Preshared Key (ASCII string or hexadecimal encoded with a leading 0x).
radius_server
string
Name of RADIUS server with which the user must authenticate. Source user.radius.name.
sms_custom_server
string
Two-factor recipient's SMS server. Source system.sms-server.name.
sms_phone
string
Two-factor recipient's mobile phone number.
sms_server
string
    Choices:
  • fortiguard
  • custom
Send SMS through FortiGuard or other external server.
status
string
    Choices:
  • enable
  • disable
Enable/disable allowing the local user to authenticate with the FortiGate unit.
two_factor
string
    Choices:
  • disable
  • fortitoken
  • email
  • sms
Enable/disable two-factor authentication.
type
string
    Choices:
  • password
  • radius
  • tacacs+
  • ldap
Authentication method.
workstation
string
Name of the remote user workstation, if you want to limit the user to authenticate only from a particular workstation.
username
string
FortiOS or FortiGate username.
vdom
string
Default:
"root"
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.

Notes

Note

  • Requires fortiosapi library developed by Fortinet

  • Run as a local_action in your playbook

Examples

- hosts: localhost
  vars:
   host: "192.168.122.40"
   username: "admin"
   password: ""
   vdom: "root"
   ssl_verify: "False"
  tasks:
  - name: Configure local users.
    fortios_user_local:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      https: "False"
      state: "present"
      user_local:
        auth_concurrent_override: "enable"
        auth_concurrent_value: "4"
        authtimeout: "5"
        email_to: "<your_own_value>"
        fortitoken: "<your_own_value> (source user.fortitoken.serial-number)"
        id:  "8"
        ldap_server: "<your_own_value> (source user.ldap.name)"
        name: "default_name_10"
        passwd: "<your_own_value>"
        passwd_policy: "<your_own_value> (source user.password-policy.name)"
        passwd_time: "<your_own_value>"
        ppk_identity: "<your_own_value>"
        ppk_secret: "<your_own_value>"
        radius_server: "<your_own_value> (source user.radius.name)"
        sms_custom_server: "<your_own_value> (source system.sms-server.name)"
        sms_phone: "<your_own_value>"
        sms_server: "fortiguard"
        status: "enable"
        two_factor: "disable"
        type: "password"
        workstation: "<your_own_value>"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
build
string
always
Build number of the fortigate image

Sample:
1547
http_method
string
always
Last method used to provision the content into FortiGate

Sample:
PUT
http_status
string
always
Last result given by FortiGate on last operation applied

Sample:
200
mkey
string
success
Master key (id) used in the last call to FortiGate

Sample:
id
name
string
always
Name of the table used to fulfill the request

Sample:
urlfilter
path
string
always
Path of the table used to fulfill the request

Sample:
webfilter
revision
string
always
Internal revision number

Sample:
17.0.2.10658
serial
string
always
Serial number of the unit

Sample:
FGVMEVYYQT3AB5352
status
string
always
Indication of the operation's result

Sample:
success
vdom
string
always
Virtual domain used

Sample:
root
version
string
always
Version of the FortiGate

Sample:
v5.6.3


Status

Authors

  • Miguel Angel Munoz (@mamunozgonzalez)

  • Nicolas Thomas (@thomnico)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.