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 |
|---|---|
Terms string / required | 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 |
|---|---|
api_http_method string | HTTP method used to query the API endpoint. If not given, the Choices:
|
api_key string / required | API key of the CloudStack API. If not given, the |
api_secret string / required | Secret key of the CloudStack API. If not set, the |
api_timeout integer | HTTP timeout in seconds. If not given, the Default: |
api_url string / required | URL of the CloudStack API e.g. https://cloud.example.com/client/api. If not given, the |
api_verify_ssl_cert string | Verify CA authority cert file. If not given, the |
query_params dictionary | The query parameters to search for in the form of key/value pairs. |
validate_certs boolean added in ngine_io.cloudstack 2.4.0 | 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 |
|---|---|
Return value dictionary | Response from the API Returned: on successful request |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/ngine_io/cloudstack/api_lookup.html