fmgd_vpn_certificate_local – Local keys and certificates.

Added in version 1.0.0.

Synopsis

  • This module is able to configure a FortiManager device.

  • Examples include all parameters and values need to be adjusted to data sources before usage.

  • Tested with FortiManager v7.x.

Requirements

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

  • ansible-core>=2.16.0

FortiManager Version Compatibility

Supported Version Ranges: v7.2.6 -> v7.2.12, v7.4.3 -> latest

Parameters

  • access_token -The token to access FortiManager without using username and password. type: str required: false
  • bypass_validation - Only set to True when module schema diffs with FortiManager API structure, module continues to execute without validating parameters. type: bool required: false default: False
  • enable_log - Enable/Disable logging for task. type: bool required: false default: False
  • forticloud_access_token - Access token of forticloud managed API users, this option is available with FortiManager later than 6.4.0. type: str required: false
  • proposed_method - The overridden method for the underlying Json RPC request. type: str required: false choices: set, update, add
  • rc_succeeded - The rc codes list with which the conditions to succeed will be overriden. type: list required: false
  • rc_failed - The rc codes list with which the conditions to fail will be overriden. type: list required: false
  • state - The directive to create, update or delete an object type: str required: true choices: present, absent
  • workspace_locking_adom - Acquire the workspace lock if FortiManager is running in workspace mode. type: str required: false choices: global, custom adom including root
  • workspace_locking_timeout - The maximum time in seconds to wait for other users to release workspace lock. type: integer required: false default: 300
  • device - The parameter in requested url type: str required: true
  • vdom - The parameter in requested url type: str required: true
  • vpn_certificate_local - Local keys and certificates. type: dict
    • acme_ca_url (Alias name: acme-ca-url) The url for the acme ca server (lets encrypt is the default provider). type: str more...
    • acme_domain (Alias name: acme-domain) A valid domain that resolves to this fortigate unit. type: str more...
    • acme_email (Alias name: acme-email) Contact email address that is required by some cas like letsencrypt. type: str more...
    • acme_renew_window (Alias name: acme-renew-window) Beginning of the renewal window (in days before certificate expiration, 30 by default). type: int more...
    • acme_rsa_key_size (Alias name: acme-rsa-key-size) Length of the rsa private key of the generated cert (minimum 2048 bits). type: int more...
    • auto_regenerate_days (Alias name: auto-regenerate-days) Number of days to wait before expiry of an updated local certificate is requested (0 = disabled). type: int more...
    • auto_regenerate_days_warning (Alias name: auto-regenerate-days-warning) Number of days to wait before an expiry warning message is generated (0 = disabled). type: int more...
    • ca_identifier (Alias name: ca-identifier) Ca identifier of the ca server for signing via scep. type: str more...
    • certificate Pem format certificate. type: str more...
    • cmp_path (Alias name: cmp-path) Path location inside cmp server. type: str more...
    • cmp_regeneration_method (Alias name: cmp-regeneration-method) Cmp auto-regeneration method. type: str choices: [keyupate, renewal] more...
    • cmp_server (Alias name: cmp-server) Address and port for cmp server (format = address:port). type: str more...
    • cmp_server_cert (Alias name: cmp-server-cert) Cmp server certificate. type: list more...
    • comments Comment. type: str more...
    • csr Certificate signing request. type: str more...
    • enroll_protocol (Alias name: enroll-protocol) Certificate enrollment protocol. type: str choices: [none, scep, cmpv2, acme2, est] more...
    • est_ca_id (Alias name: est-ca-id) Ca identifier of the ca server for signing via est. type: str more...
    • est_client_cert (Alias name: est-client-cert) Certificate used to authenticate this fortigate to est server. type: list more...
    • est_http_password (Alias name: est-http-password) Http authentication password for signing via est. type: str more...
    • est_http_username (Alias name: est-http-username) Http authentication username for signing via est. type: str more...
    • est_server (Alias name: est-server) Address and port for est server (e. type: str more...
    • est_server_cert (Alias name: est-server-cert) Est servers certificate must be verifiable by this certificate to be authenticated. type: list more...
    • est_srp_password (Alias name: est-srp-password) Est srp authentication password. type: str more...
    • est_srp_username (Alias name: est-srp-username) Est srp authentication username. type: str more...
    • ike_localid (Alias name: ike-localid) Local id the fortigate uses for authentication as a vpn client. type: str more...
    • ike_localid_type (Alias name: ike-localid-type) Ike local id type. type: str choices: [fqdn, asn1dn] more...
    • last_updated (Alias name: last-updated) Time at which certificate was last updated. type: int more...
    • name Name. type: str more...
    • name_encoding (Alias name: name-encoding) Name encoding method for auto-regeneration. type: str choices: [printable, utf8] more...
    • password Password as a pem file. type: list more...
    • private_key (Alias name: private-key) Pem format key encrypted with a password. type: str more...
    • private_key_retain (Alias name: private-key-retain) Enable/disable retention of private key during scep renewal (default = disable). type: str choices: [disable, enable] more...
    • range Either a global or vdom ip address range for the certificate. type: str choices: [global, vdom] more...
    • scep_password (Alias name: scep-password) Scep server challenge password for auto-regeneration. type: list more...
    • scep_url (Alias name: scep-url) Scep server url. type: str more...
    • source Certificate source type. type: str choices: [factory, user, bundle, fortiguard] more...
    • source_ip (Alias name: source-ip) Source ip address for communications to the scep server. type: str more...
    • state State. type: str more...
    • tmp_cert_file (Alias name: tmp-cert-file) Temporary certificate file. type: str more...
    • est_regeneration_method (Alias name: est-regeneration-method) Est behavioral options during re-enrollment. type: str choices: [create-new-key, use-existing-key] more...
    • acme_eab_key_hmac (Alias name: acme-eab-key-hmac) External account binding hmac key (url-encoded base64). type: list more...
    • acme_eab_key_id (Alias name: acme-eab-key-id) External account binding key id (optional setting). type: str more...
    • hsm_keytype (Alias name: hsm-keytype) Hsm keytype. type: str choices: [rsa, ec] more...
    • hsm_slot (Alias name: hsm-slot) Hsm slot. type: str more...
    • hsm_vendor (Alias name: hsm-vendor) Hsm vendor. type: str choices: [safenet, primus] more...
    • nethsm_slot (Alias name: nethsm-slot) Nethsm slot. type: str more...
    • type Type. type: str choices: [normal, hsm] more...

Notes

Note

  • Running in workspace locking mode is supported in this FortiManager module, the top level parameters workspace_locking_adom and workspace_locking_timeout help do the work.

  • To create or update an object, use state: present directive.

  • To delete an object, use state: absent directive

  • Normally, running one module can fail when a non-zero rc is returned. you can also override the conditions to fail or succeed with parameters rc_failed and rc_succeeded

Examples

- name: Example playbook (generated based on argument schema)
  hosts: fortimanagers
  connection: httpapi
  gather_facts: false
  vars:
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_httpapi_port: 443
  tasks:
    - name: Local keys and certificates.
      fortinet.fmgdevice.fmgd_vpn_certificate_local:
        # bypass_validation: false
        # workspace_locking_adom: <global or your adom name>
        # workspace_locking_timeout: 300
        # rc_succeeded: [0, -2, -3, ...]
        # rc_failed: [-2, -3, ...]
        device: <your own value>
        vdom: <your own value>
        state: present # <value in [present, absent]>
        vpn_certificate_local:
          name: "your value" # Required variable, string
          # acme_ca_url: <string>
          # acme_domain: <string>
          # acme_email: <string>
          # acme_renew_window: <integer>
          # acme_rsa_key_size: <integer>
          # auto_regenerate_days: <integer>
          # auto_regenerate_days_warning: <integer>
          # ca_identifier: <string>
          # certificate: <string>
          # cmp_path: <string>
          # cmp_regeneration_method: <value in [keyupate, renewal]>
          # cmp_server: <string>
          # cmp_server_cert: <list or string>
          # comments: <string>
          # csr: <string>
          # enroll_protocol: <value in [none, scep, cmpv2, ...]>
          # est_ca_id: <string>
          # est_client_cert: <list or string>
          # est_http_password: <string>
          # est_http_username: <string>
          # est_server: <string>
          # est_server_cert: <list or string>
          # est_srp_password: <string>
          # est_srp_username: <string>
          # ike_localid: <string>
          # ike_localid_type: <value in [fqdn, asn1dn]>
          # last_updated: <integer>
          # name_encoding: <value in [printable, utf8]>
          # password: <list or string>
          # private_key: <string>
          # private_key_retain: <value in [disable, enable]>
          # range: <value in [global, vdom]>
          # scep_password: <list or string>
          # scep_url: <string>
          # source: <value in [factory, user, bundle, ...]>
          # source_ip: <string>
          # state: <string>
          # tmp_cert_file: <string>
          # est_regeneration_method: <value in [create-new-key, use-existing-key]>
          # acme_eab_key_hmac: <list or string>
          # acme_eab_key_id: <string>
          # hsm_keytype: <value in [rsa, ec]>
          # hsm_slot: <string>
          # hsm_vendor: <value in [safenet, primus]>
          # nethsm_slot: <string>
          # type: <value in [normal, hsm]>

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:

  • meta - The result of the request.returned: always type: dict
    • request_url - The full url requested. returned: always type: str sample: /sys/login/user
    • response_code - The status of api request. returned: always type: int sample: 0
    • response_data - The data body of the api response. returned: optional type: list or dict
    • response_message - The descriptive message of the api response. returned: always type: str sample: OK
    • system_information - The information of the target system. returned: always type: dict
  • rc - The status the request. returned: always type: int sample: 0
  • version_check_warning - Warning if the parameters used in the playbook are not supported by the current FortiManager version. returned: if at least one parameter not supported by the current FortiManager version type: list

Status

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

Authors

  • Xinwei Du (@dux-fortinet)

  • Xing Li (@lix-fortinet)

  • Jie Xue (@JieX19)

  • Link Zheng (@chillancezen)

  • Frank Shen (@fshen01)

  • Hongbin Lu (@fgtdev-hblu)