ngine_io.cloudstack.api lookup – Iteract with the Cloudstack API via lookup
Note
This lookup plugin is part of the ngine_io.cloudstack collection (version 3.0.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install ngine_io.cloudstack.
You need further requirements to be able to use this lookup plugin,
see Requirements for details.
To use it in a playbook, specify: ngine_io.cloudstack.api.
Synopsis
Returns GET requests from the Cloudstack API.
Requirements
The below requirements are needed on the local controller node that executes this lookup.
None
cs >= 0.9.0
python >= 2.6
Terms
Parameter |
Comments |
|---|---|
The endpoint to query, i.e. listUserData, listVirtualMachines, etc. |
Keyword parameters
This describes keyword parameters of the lookup. These are the values key1=value1, key2=value2 and so on in the following
examples: lookup('ngine_io.cloudstack.api', key1=value1, key2=value2, ...) and query('ngine_io.cloudstack.api', key1=value1, key2=value2, ...)
Parameter |
Comments |
|---|---|
HTTP method used to query the API endpoint. If not given, the Choices:
|
|
API key of the CloudStack API. If not given, the |
|
Secret key of the CloudStack API. If not set, the |
|
HTTP timeout in seconds. If not given, the Default: |
|
URL of the CloudStack API e.g. https://cloud.example.com/client/api. If not given, the |
|
Verify CA authority cert file. If not given, the |
|
The query parameters to search for in the form of key/value pairs. |
|
If If not given, the This should only be used on personally controlled sites using self-signed certificates. Choices:
|
Notes
Note
When keyword and positional parameters are used together, positional parameters must be listed before keyword parameters:
lookup('ngine_io.cloudstack.api', term1, term2, key1=value1, key2=value2)andquery('ngine_io.cloudstack.api', term1, term2, key1=value1, key2=value2)If the query is not filtered properly this can cause a performance impact.
A detailed guide about cloudstack modules can be found in the CloudStack Cloud Guide.
This module supports check mode.
Examples
- name: List all UserData from the API
set_fact:
controller_settings: "{{ lookup('ngine_io.cloudstack.api', 'listUserData', query_params={ 'listall': true }) }}"
- name: List all Virtual Machines from the API
set_fact:
virtual_machines: "{{ lookup('ngine_io.cloudstack.api', 'listVirtualMachines') }}"
- name: List specific Virtual Machines from the API
set_fact:
virtual_machines: "{{ lookup('ngine_io.cloudstack.api', 'listVirtualMachines', query_params={ 'name': 'myvmname' }) }}"
Return Value
Key |
Description |
|---|---|
Response from the API Returned: on successful request |