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_host.
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 |
|---|---|---|
| allocation_state string |
| Allocation state of the host. |
| 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. | |
| cluster string | Name of the cluster. | |
| host_tags list / elements=string | Tags of the host. aliases: host_tag | |
| hypervisor string | Name of the cluster. Required if state=present and host does not yet exist. Possible values are KVM, VMware, BareMetal, XenServer, LXC, HyperV, UCS, OVM, Simulator. | |
| name string / required | Name of the host. aliases: ip_address | |
| password string | Password for the host. Required if state=present and host does not yet exist. | |
| pod string | Name of the pod. Required if state=present and host does not yet exist. | |
| state string |
| State of the host. |
| url string | Url of the host used to create a host. If not provided, http:// and param name is used as url.Only considered if state=present and host does not yet exist. | |
| username string | Username for the host. Required if state=present and host does not yet exist. | |
| zone string | Name of the zone in which the host should be deployed. If not set, default zone is used. |
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: Ensure a host is present but disabled
ngine_io.cloudstack.cs_host:
name: pod01.zone01.example.com
cluster: vcenter.example.com/zone01/cluster01
pod: pod01
zone: zone01
hypervisor: VMware
allocation_state: disabled
host_tags:
- perf
- gpu
- name: Ensure an existing host is disabled
ngine_io.cloudstack.cs_host:
name: pod01.zone01.example.com
zone: zone01
allocation_state: disabled
- name: Ensure an existing host is enabled
ngine_io.cloudstack.cs_host:
name: pod01.zone01.example.com
zone: zone01
allocation_state: enabled
- name: Ensure a host is absent
ngine_io.cloudstack.cs_host:
name: pod01.zone01.example.com
zone: zone01
state: absent
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
| allocation_state: string | success | Allocation state of the host. Sample: enabled |
| capabilities string | success | Capabilities of the host. Sample: hvm |
| cluster string | success | Cluster of the host. Sample: vcenter.example.com/zone/cluster01 |
| cluster_type string | success | Type of the cluster of the host. Sample: ExternalManaged |
| cpu_allocated string | success | Amount in percent of the host's CPU currently allocated. Sample: 166.25% |
| cpu_number string | success | Number of CPUs of the host. Sample: 24 |
| cpu_sockets integer | success | Number of CPU sockets of the host. Sample: 2 |
| cpu_speed integer | success | CPU speed in Mhz Sample: 1999 |
| cpu_used string | success | Amount of the host's CPU currently used. Sample: 33.6% |
| cpu_with_overprovisioning string | success | Amount of the host's CPU after applying the cpu.overprovisioning.factor. Sample: 959520.0 |
| created string | success | Date when the host was created. Sample: 2015-05-03T15:05:51+0200 |
| disconnected string | success | Date when the host was disconnected. Sample: 2015-05-03T15:05:51+0200 |
| disk_size_allocated integer | success | Host's currently allocated disk size. Sample: 2593 |
| disk_size_total integer | success | Total disk size of the host Sample: 259300 |
| events string | success | Events available for the host Sample: Ping; HostDown; AgentConnected; AgentDisconnected; PingTimeout; ShutdownRequested; Remove; StartAgentRebalance; ManagementServerDown |
| gpu_group list / elements=string | success | GPU cards present in the host. |
| ha_host boolean | success | Whether the host is a HA host. |
| has_enough_capacity boolean | success | Whether the host has enough CPU and RAM capacity to migrate a VM to it. Sample: True |
| host_tags string | success | Comma-separated list of tags for the host. Sample: perf |
| host_type string | success | Type of the host. Sample: Routing |
| host_version string | success | Version of the host. Sample: 4.5.2 |
| hypervisor string | success | Host's hypervisor. Sample: VMware |
| hypervisor_version string | success | Hypervisor version. Sample: 5.1 |
| ip_address string | success | IP address of the host Sample: 10.10.10.1 |
| is_local_storage_active boolean | success | Whether the local storage is available or not. |
| last_pinged string | success | Date and time the host was last pinged. Sample: 1970-01-17T17:27:32+0100 |
| management_server_id integer | success | Management server ID of the host. Sample: 345050593418 |
| memory_allocated integer | success | Amount of the host's memory currently allocated. Sample: 69793218560 |
| memory_total integer | success | Total of memory of the host. Sample: 206085263360 |
| memory_used integer | success | Amount of the host's memory currently used. Sample: 65504776192 |
| name string | success | Name of the host. Sample: esx32.example.com |
| network_kbs_read integer | success | Incoming network traffic on the host. |
| network_kbs_write integer | success | Outgoing network traffic on the host. |
| os_category string | success | OS category name of the host. Sample: ... |
| out_of_band_management string | success | Host out-of-band management information. Sample: ... |
| pod string | success | Pod name of the host. Sample: Pod01 |
| removed string | success | Date and time the host was removed. Sample: 1970-01-17T17:27:32+0100 |
| resource_state string | success | Resource state of the host. Sample: Enabled |
| state string | success | State of the host. Sample: Up |
| suitable_for_migration string | success | Whether this host is suitable (has enough capacity and satisfies all conditions like hosttags, max guests VM limit, etc) to migrate a VM to it or not. Sample: True |
| zone string | success | Zone of the host. Sample: zone01 |
© 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_host_module.html