ngine_io.cloudstack.cs_instance_info module – Gathering information from the API of instances from Apache CloudStack based clouds.
Note
This module is part of the ngine_io.cloudstack collection (version 2.2.4).
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
.
To use it in a playbook, specify: ngine_io.cloudstack.cs_instance_info
.
New in version 0.1.0: of ngine_io.cloudstack
Requirements
The below requirements are needed on the host that executes this module.
python >= 2.6
cs >= 0.9.0
Parameters
Parameter |
Comments |
---|---|
Account the instance is related to. |
|
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: 10 |
|
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 |
|
Domain the instance is related to. |
|
Filter by host name. |
|
Name or display name of the instance. If not specified, all instances are returned |
|
Project the instance is related to. |
Notes
Note
A detailed guide about cloudstack modules can be found in the CloudStack Cloud Guide.
This module supports check mode.
Examples
- name: Gather instance information
ngine_io.cloudstack.cs_instance_info:
name: web-vm-1
register: vm
- name: Show the returned results of the registered variable
debug:
msg: "{{ vm }}"
- name: Gather information from all instances
ngine_io.cloudstack.cs_instance_info:
register: vms
- name: Show information on all instances
debug:
msg: "{{ vms }}"
- name: Gather information from all instances on a host
ngine_io.cloudstack.cs_instance_info:
host: host01.example.com
register: vms
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
A list of matching instances. Returned: success |
|
Account the instance is related to. Returned: success Sample: “example account” |
|
Affinity groups the instance is in. Returned: success Sample: “[ \”webservers\” ]” |
|
Date of the instance was created. Returned: success Sample: “2014-12-01T14:57:57+0100” |
|
Default IP address of the instance. Returned: success Sample: “10.23.37.42” |
|
Display name of the instance. Returned: success Sample: “web-01” |
|
Domain the instance is related to. Returned: success Sample: “example domain” |
|
Group name of the instance is related. Returned: success Sample: “web” |
|
Host the instance is running on. Returned: success and instance is running Sample: “host01.example.com” |
|
Hypervisor related to this instance. Returned: success Sample: “KVM” |
|
UUID of the instance. Returned: success Sample: “04589590-ac63-4ffc-93f5-b698b8ac38b6” |
|
Internal name of the instance (ROOT admin only). Returned: success Sample: “i-44-3992-VM” |
|
Name of ISO the instance was deployed with. Returned: success Sample: “Debian-8-64bit” |
|
Name of the instance. Returned: success Sample: “web-01” |
|
List of dictionaries of the instance nics. Returned: success |
|
The broadcast uri of the nic. Returned: success Sample: “vlan://2250” |
|
The gateway of the nic. Returned: success Sample: “10.1.2.1” |
|
The ID of the nic. Returned: success Sample: “5dc74fa3-2ec3-48a0-9e0d-6f43365336a9” |
|
The ip address of the nic. Returned: success Sample: “10.1.2.3” |
|
True if nic is default, false otherwise. Returned: success Sample: true |
|
The isolation uri of the nic. Returned: success Sample: “vlan://2250” |
|
The mac address of the nic. Returned: success Sample: “06:a2:03:00:08:12” |
|
The netmask of the nic. Returned: success Sample: “255.255.255.0” |
|
The ID of the corresponding network. Returned: success Sample: “432ce27b-c2bb-4e12-a88c-a919cd3a3017” |
|
The name of the corresponding network. Returned: success Sample: “network1” |
|
The traffic type of the nic. Returned: success Sample: “Guest” |
|
The type of the network. Returned: success Sample: “Shared” |
|
The password of the instance if exists. Returned: success Sample: “Ge2oe7Do” |
|
True if password setting is enabled. Returned: success Sample: true |
|
Name of project the instance is related to. Returned: success Sample: “Production” |
|
Public IP address with instance via static NAT rule. Returned: success Sample: “1.2.3.4” |
|
Security groups the instance is in. Returned: success Sample: “[ \”default\” ]” |
|
Name of the service offering the instance has. Returned: success Sample: “2cpu_2gb” |
|
State of the instance. Returned: success Sample: “Running” |
|
List of resource tags associated with the instance. Returned: success Sample: “[ { \”key\”: \”foo\”, \”value\”: \”bar\” } ]” |
|
Name of template the instance was deployed with. Returned: success Sample: “Debian-8-64bit” |
|
List of dictionaries of the volumes attached to the instance. Returned: success Sample: “[ { name: \”ROOT-1369\”, type: \”ROOT\”, size: 10737418240 }, { name: \”data01, type: \”DATADISK\”, size: 10737418240 } ]” |
|
Name of zone the instance is in. Returned: success Sample: “ch-gva-2” |
Authors
René Moser (@resmo)