Note
This plugin is part of the ngine_io.cloudstack collection.
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
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| account string | Account the instance is related to. | |
| api_http_method string |
| HTTP method used to query the API endpoint. If not given, the CLOUDSTACK_METHOD env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. Fallback value is get if not specified. |
| api_key string | API key of the CloudStack API. If not given, the CLOUDSTACK_KEY env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. | |
| api_region string | Default: "cloudstack" | Name of the ini section in the cloustack.ini file.If not given, the CLOUDSTACK_REGION env variable is considered. |
| api_secret string | Secret key of the CloudStack API. If not set, the CLOUDSTACK_SECRET env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. | |
| api_timeout integer | HTTP timeout in seconds. If not given, the CLOUDSTACK_TIMEOUT env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. Fallback value is 10 seconds if not specified. | |
| api_url string | URL of the CloudStack API e.g. https://cloud.example.com/client/api. If not given, the CLOUDSTACK_ENDPOINT env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. | |
| api_verify_ssl_cert string | CA authority cert file. If not given, the CLOUDSTACK_VERIFY env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. Fallback value is null if not specified. | |
| domain string | Domain the instance is related to. | |
| name string | Name or display name of the instance. If not specified, all instances are returned | |
| project string | Project the instance is related to. |
Note
cs library’s configuration method if credentials are not provided by the arguments api_url, api_key, api_secret. Configuration is read from several locations, in the following order. The CLOUDSTACK_ENDPOINT, CLOUDSTACK_KEY, CLOUDSTACK_SECRET and CLOUDSTACK_METHOD. CLOUDSTACK_TIMEOUT environment variables. A CLOUDSTACK_CONFIG environment variable pointing to an .ini file. A cloudstack.ini file in the current working directory. A .cloudstack.ini file in the users home directory. Optionally multiple credentials and endpoints can be specified using ini sections in cloudstack.ini. Use the argument api_region to select the section name, default section is cloudstack. See https://github.com/exoscale/cs for more information.- 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 }}"
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | ||
|---|---|---|---|---|
| instances list / elements=string | success | A list of matching instances. | ||
| account string | success | Account the instance is related to. Sample: example account | ||
| affinity_groups list / elements=string | success | Affinity groups the instance is in. Sample: [ "webservers" ] | ||
| created string | success | Date of the instance was created. Sample: 2014-12-01T14:57:57+0100 | ||
| default_ip string | success | Default IP address of the instance. Sample: 10.23.37.42 | ||
| display_name string | success | Display name of the instance. Sample: web-01 | ||
| domain string | success | Domain the instance is related to. Sample: example domain | ||
| group string | success | Group name of the instance is related. Sample: web | ||
| host string | success and instance is running | Host the instance is running on. Sample: host01.example.com | ||
| hypervisor string | success | Hypervisor related to this instance. Sample: KVM | ||
| id string | success | UUID of the instance. Sample: 04589590-ac63-4ffc-93f5-b698b8ac38b6 | ||
| instance_name string | success | Internal name of the instance (ROOT admin only). Sample: i-44-3992-VM | ||
| iso string | success | Name of ISO the instance was deployed with. Sample: Debian-8-64bit | ||
| name string | success | Name of the instance. Sample: web-01 | ||
| nic complex | success | List of dictionaries of the instance nics. | ||
| broadcasturi string | success | The broadcast uri of the nic. Sample: vlan://2250 | ||
| gateway string | success | The gateway of the nic. Sample: 10.1.2.1 | ||
| id string | success | The ID of the nic. Sample: 5dc74fa3-2ec3-48a0-9e0d-6f43365336a9 | ||
| ipaddress string | success | The ip address of the nic. Sample: 10.1.2.3 | ||
| isdefault boolean | success | True if nic is default, false otherwise. Sample: True | ||
| isolationuri string | success | The isolation uri of the nic. Sample: vlan://2250 | ||
| macaddress string | success | The mac address of the nic. Sample: 06:a2:03:00:08:12 | ||
| netmask string | success | The netmask of the nic. Sample: 255.255.255.0 | ||
| networkid string | success | The ID of the corresponding network. Sample: 432ce27b-c2bb-4e12-a88c-a919cd3a3017 | ||
| networkname string | success | The name of the corresponding network. Sample: network1 | ||
| traffictype string | success | The traffic type of the nic. Sample: Guest | ||
| type string | success | The type of the network. Sample: Shared | ||
| password string | success | The password of the instance if exists. Sample: Ge2oe7Do | ||
| password_enabled boolean | success | True if password setting is enabled. Sample: True | ||
| project string | success | Name of project the instance is related to. Sample: Production | ||
| public_ip string | success | Public IP address with instance via static NAT rule. Sample: 1.2.3.4 | ||
| security_groups list / elements=string | success | Security groups the instance is in. Sample: [ "default" ] | ||
| service_offering string | success | Name of the service offering the instance has. Sample: 2cpu_2gb | ||
| ssh_key string | success | Name of SSH key deployed to instance. Sample: key@work | ||
| state string | success | State of the instance. Sample: Running | ||
| tags list / elements=string | success | List of resource tags associated with the instance. Sample: [ { "key": "foo", "value": "bar" } ] | ||
| template string | success | Name of template the instance was deployed with. Sample: Debian-8-64bit | ||
| volumes list / elements=string | success | List of dictionaries of the volumes attached to the instance. Sample: [ { name: "ROOT-1369", type: "ROOT", size: 10737418240 }, { name: "data01, type: "DATADISK", size: 10737418240 } ] | ||
| zone string | success | Name of zone the instance is in. Sample: ch-gva-2 | ||
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/ngine_io/cloudstack/cs_instance_info_module.html