Fortinet white logo
Fortinet white logo

Administration Guide

Create VMs based on a FortiFlex configuration

Create VMs based on a FortiFlex configuration

Use the fortiflexvm_entitlements_vms_create module to create one or more VMs based on a FortiFlex configuration.

Parameters

The following parameters are included:

Parameter

Type

Description

username

String (Optional)

The username to authenticate. If not declared, the code will read the environment variable FLEXVM_ACCESS_USERNAME.

password

String (Optional)

The password to authenticate. If not declared, the code will read the environment variable FLEXVM_ACCESS_PASSWORD.

configId

Integer

The ID of the FortiFlex configuration.

count

Integer (Optional)

The number of VMs to be created. The default value is 1.

description

String (Optional)

The description of the VMs.

endDate

String (Optional)

The VM end date. It cannot be before today's date or after the program's end date. Any format that satisfies ISO 8601 is accepted but the recommended format is "YYYY-MM-DDThh:mm:ss". If the value is not set, the program's end date will be used automatically.

folderPath

String (Optional)

The folder path of the VMs.

Example

The following is an example use of this module:

- name: Create VMs
  hosts: localhost
  collections:
    - fortinet.fortiflexvm
  vars:
    username: "<your_own_value>"
    password: "<your_own_value>"
  tasks:
    - name: Create Virtual Machines.
      fortinet.fortiflexvm.fortiflexvm_entitlements_vm_create:
        username: "{{ username }}"
        password: "{{ password }}"
        configId: 42
        count: 1 # If you set it as 0, FortiFlexvm ansible collection will not create any vm.
        description: "Create through Ansible" # Optional.
        endDate: "2023-11-11T00:00:00" # Optional. If not set, it will use the program end date automatically.
        folderPath: "My Assets" # Optional. If not set, new VM will be in "My Assets"
      register: result

    - name: Display response
      debug:
        var: result.entitlements

Return values

The following parameters are returned:

Parameter

Type Returned

Description

entitlements

List

The list of virtual machine entitlements and their details.

The entitlements list includes:

Parameter

Type Returned

Description

configId

Integer

The ID of the VM configuration.

description

String

The description of the VM.

endDate

String

The end date of the VM's validity.

serialNumber

String

The serial number of the VM.

startDate

String

The start date of the VM's validity.

status

String

The status of the VM.

token

String

The token assigned to the VM.

tokenStatus

String

The status of the token assigned to the VM.

Create VMs based on a FortiFlex configuration

Create VMs based on a FortiFlex configuration

Use the fortiflexvm_entitlements_vms_create module to create one or more VMs based on a FortiFlex configuration.

Parameters

The following parameters are included:

Parameter

Type

Description

username

String (Optional)

The username to authenticate. If not declared, the code will read the environment variable FLEXVM_ACCESS_USERNAME.

password

String (Optional)

The password to authenticate. If not declared, the code will read the environment variable FLEXVM_ACCESS_PASSWORD.

configId

Integer

The ID of the FortiFlex configuration.

count

Integer (Optional)

The number of VMs to be created. The default value is 1.

description

String (Optional)

The description of the VMs.

endDate

String (Optional)

The VM end date. It cannot be before today's date or after the program's end date. Any format that satisfies ISO 8601 is accepted but the recommended format is "YYYY-MM-DDThh:mm:ss". If the value is not set, the program's end date will be used automatically.

folderPath

String (Optional)

The folder path of the VMs.

Example

The following is an example use of this module:

- name: Create VMs
  hosts: localhost
  collections:
    - fortinet.fortiflexvm
  vars:
    username: "<your_own_value>"
    password: "<your_own_value>"
  tasks:
    - name: Create Virtual Machines.
      fortinet.fortiflexvm.fortiflexvm_entitlements_vm_create:
        username: "{{ username }}"
        password: "{{ password }}"
        configId: 42
        count: 1 # If you set it as 0, FortiFlexvm ansible collection will not create any vm.
        description: "Create through Ansible" # Optional.
        endDate: "2023-11-11T00:00:00" # Optional. If not set, it will use the program end date automatically.
        folderPath: "My Assets" # Optional. If not set, new VM will be in "My Assets"
      register: result

    - name: Display response
      debug:
        var: result.entitlements

Return values

The following parameters are returned:

Parameter

Type Returned

Description

entitlements

List

The list of virtual machine entitlements and their details.

The entitlements list includes:

Parameter

Type Returned

Description

configId

Integer

The ID of the VM configuration.

description

String

The description of the VM.

endDate

String

The end date of the VM's validity.

serialNumber

String

The serial number of the VM.

startDate

String

The start date of the VM's validity.

status

String

The status of the VM.

token

String

The token assigned to the VM.

tokenStatus

String

The status of the token assigned to the VM.