Fortinet black logo

Administration Guide

Create VMs based on a FortiFlex configuration

Create VMs based on a FortiFlex configuration

Use the fortiflexvm_vms_create module to create one or more VMs based on a FortiFlex configuration. To modify a VM, see Update an existing VM.

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 decription 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".

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_vms_create:
        username: "{{ username }}"
        password: "{{ password }}"
        configId: 42
        count: 1
        description: "Create through Ansible"
        endDate: "2023-11-11T00:00:00"
        folderPath: "My Assets"
      register: result

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

Return values

The following parameters are returned:

Parameter

Type Returned

Description

vms

List

The list of virtual machines and their details.

The vms list includes:

Parameter

Type Returned

Description

configId

Integer

The configuration ID of the VM.

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

Use the fortiflexvm_vms_create module to create one or more VMs based on a FortiFlex configuration. To modify a VM, see Update an existing VM.

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 decription 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".

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_vms_create:
        username: "{{ username }}"
        password: "{{ password }}"
        configId: 42
        count: 1
        description: "Create through Ansible"
        endDate: "2023-11-11T00:00:00"
        folderPath: "My Assets"
      register: result

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

Return values

The following parameters are returned:

Parameter

Type Returned

Description

vms

List

The list of virtual machines and their details.

The vms list includes:

Parameter

Type Returned

Description

configId

Integer

The configuration ID of the VM.

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.