cs_instance_facts - Gathering facts from the API of instances from Apache CloudStack based clouds.

New in version 2.1.

Synopsis

  • Gathering facts from the API of an instance.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.6
  • cs >= 0.6.10

Parameters

Parameter Choices/Defaults Comments
account
Account the instance is related to.
api_http_method
    Choices:
  • get
  • post
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
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 Default:
cloudstack
Name of the ini section in the cloustack.ini file.
If not given, the CLOUDSTACK_REGION env variable is considered.
api_secret
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
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
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.
domain
Domain the instance is related to.
name
required
Name or display name of the instance.
project
Project the instance is related to.

Notes

Note

  • Ansible uses the 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.
  • A detailed guide about cloudstack modules can be found in the CloudStack Cloud Guide.
  • This module supports check mode.

Examples

- name: gather instance facts
  cs_instance_facts:
    name: web-vm-1
  delegate_to: localhost

- debug:
    var: cloudstack_instance

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
cloudstack_instance.account
string
success
Account the instance is related to.

Sample:
example account
cloudstack_instance.affinity_groups
list
success
Affinity groups the instance is in.

Sample:
[ "webservers" ]
cloudstack_instance.default_ip
string
success
Default IP address of the instance.

Sample:
10.23.37.42
cloudstack_instance.display_name
string
success
Display name of the instance.

Sample:
web-01
cloudstack_instance.domain
string
success
Domain the instance is related to.

Sample:
example domain
cloudstack_instance.group
string
success
Group name of the instance is related.

Sample:
web
cloudstack_instance.hypervisor
string
success
Hypervisor related to this instance.

Sample:
KVM
cloudstack_instance.id
string
success
UUID of the instance.

Sample:
04589590-ac63-4ffc-93f5-b698b8ac38b6
cloudstack_instance.instance_name
string
success
Internal name of the instance (ROOT admin only).

Sample:
i-44-3992-VM
cloudstack_instance.iso
string
success
Name of ISO the instance was deployed with.

Sample:
Debian-8-64bit
cloudstack_instance.name
string
success
Name of the instance.

Sample:
web-01
cloudstack_instance.password
string
success
The password of the instance if exists.

Sample:
Ge2oe7Do
cloudstack_instance.password_enabled
boolean
success
True if password setting is enabled.

Sample:
True
cloudstack_instance.project
string
success
Name of project the instance is related to.

Sample:
Production
cloudstack_instance.public_ip
string
success
Public IP address with instance via static NAT rule.

Sample:
1.2.3.4
cloudstack_instance.security_groups
list
success
Security groups the instance is in.

Sample:
[ "default" ]
cloudstack_instance.service_offering
string
success
Name of the service offering the instance has.

Sample:
2cpu_2gb
cloudstack_instance.ssh_key
string
success
Name of SSH key deployed to instance.

Sample:
key@work
cloudstack_instance.state
string
success
State of the instance.

Sample:
Running
cloudstack_instance.tags
dict
success
List of resource tags associated with the instance.

Sample:
[ { "key": "foo", "value": "bar" } ]
cloudstack_instance.template
string
success
Name of template the instance was deployed with.

Sample:
Debian-8-64bit
cloudstack_instance.volumes
list
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 } ]
cloudstack_instance.zone
string
success
Name of zone the instance is in.

Sample:
ch-gva-2
created
string
success
Date of the instance was created.

Sample:
2014-12-01T14:57:57+0100


Status

This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.

Author

  • René Moser (@resmo)

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.5/modules/cs_instance_facts_module.html