Fortinet black logo

Administration Guide

Get a list of existing VMs for the FortiFlex configuration

Get a list of existing VMs for the FortiFlex configuration

Use the fortiflexvm_vms_list_info module to get a list of VMs associated with a specific configuration ID from the FortiFlex API using the provided credentials.

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 configuration for which to retrieve the list of VMs.

Example

The following is an example use of this module:

- name: Get list of VMs for a specific config ID
  hosts: localhost
  collections:
    - fortinet.fortiflexvm
  vars:
    username: "<your_own_value>"
    password: "<your_own_value>"
  tasks:
    - name: Get VMs list
      fortinet.fortiflexvm.fortiflexvm_vms_list_info:
        username: "{{ username }}"
        password: "{{ password }}"
        configId: 22
      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 associated with the specified configuration ID.

The vms list includes:

Parameter

Type Returned

Description

serialNumber

String

The serial number of the VM.

description

String

The description of the VM.

configId

Integer

The configuration ID of the VM.

startDate

String

The start date of the VM.

endDate

String

The end date of the VM.

status

String

The status of the VM; either "PENDING", "ACTIVE", "STOPPED", or "EXPIRED".

token

String

The token of the VM.

tokenStatus

String

The status of the VM; either "NOTUSED" or "USED".

Get a list of existing VMs for the FortiFlex configuration

Use the fortiflexvm_vms_list_info module to get a list of VMs associated with a specific configuration ID from the FortiFlex API using the provided credentials.

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 configuration for which to retrieve the list of VMs.

Example

The following is an example use of this module:

- name: Get list of VMs for a specific config ID
  hosts: localhost
  collections:
    - fortinet.fortiflexvm
  vars:
    username: "<your_own_value>"
    password: "<your_own_value>"
  tasks:
    - name: Get VMs list
      fortinet.fortiflexvm.fortiflexvm_vms_list_info:
        username: "{{ username }}"
        password: "{{ password }}"
        configId: 22
      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 associated with the specified configuration ID.

The vms list includes:

Parameter

Type Returned

Description

serialNumber

String

The serial number of the VM.

description

String

The description of the VM.

configId

Integer

The configuration ID of the VM.

startDate

String

The start date of the VM.

endDate

String

The end date of the VM.

status

String

The status of the VM; either "PENDING", "ACTIVE", "STOPPED", or "EXPIRED".

token

String

The token of the VM.

tokenStatus

String

The status of the VM; either "NOTUSED" or "USED".