ngine_io.cloudstack.cs_host – Manages hosts on Apache CloudStack based clouds.
Note
This plugin is part of the ngine_io.cloudstack collection (version 2.2.2).
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_host
.
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 |
---|---|
Allocation state of the host. Choices:
|
|
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 |
|
Name of the cluster. |
|
Tags of the host. |
|
Name of the cluster. Required if state=present and host does not yet exist. Possible values are |
|
Name of the host. |
|
Password for the host. Required if state=present and host does not yet exist. |
|
Name of the pod. Required if state=present and host does not yet exist. |
|
State of the host. Choices:
|
|
Url of the host used to create a host. If not provided, Only considered if state=present and host does not yet exist. |
|
Username for the host. Required if state=present and host does not yet exist. |
|
Name of the zone in which the host should be deployed. |
Notes
Note
A detailed guide about cloudstack modules can be found in the CloudStack Cloud Guide.
This module supports check mode.
Examples
- 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
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Allocation state of the host. Returned: success Sample: “enabled” |
|
Capabilities of the host. Returned: success Sample: “hvm” |
|
Cluster of the host. Returned: success Sample: “vcenter.example.com/zone/cluster01” |
|
Type of the cluster of the host. Returned: success Sample: “ExternalManaged” |
|
Amount in percent of the host’s CPU currently allocated. Returned: success Sample: “166.25%” |
|
Number of CPUs of the host. Returned: success Sample: 24 |
|
Number of CPU sockets of the host. Returned: success Sample: 2 |
|
CPU speed in Mhz Returned: success Sample: 1999 |
|
Amount of the host’s CPU currently used. Returned: success Sample: “33.6%” |
|
Amount of the host’s CPU after applying the cpu.overprovisioning.factor. Returned: success Sample: 959520.0 |
|
Date when the host was created. Returned: success Sample: “2015-05-03T15:05:51+0200” |
|
Date when the host was disconnected. Returned: success Sample: “2015-05-03T15:05:51+0200” |
|
Host’s currently allocated disk size. Returned: success Sample: 2593 |
|
Total disk size of the host Returned: success Sample: 259300 |
|
Events available for the host Returned: success Sample: “Ping; HostDown; AgentConnected; AgentDisconnected; PingTimeout; ShutdownRequested; Remove; StartAgentRebalance; ManagementServerDown” |
|
GPU cards present in the host. Returned: success Sample: [] |
|
Whether the host is a HA host. Returned: success Sample: false |
|
Whether the host has enough CPU and RAM capacity to migrate a VM to it. Returned: success Sample: true |
|
Comma-separated list of tags for the host. Returned: success Sample: “perf” |
|
Type of the host. Returned: success Sample: “Routing” |
|
Version of the host. Returned: success Sample: “4.5.2” |
|
Host’s hypervisor. Returned: success Sample: “VMware” |
|
Hypervisor version. Returned: success Sample: 5.1 |
|
IP address of the host Returned: success Sample: “10.10.10.1” |
|
Whether the local storage is available or not. Returned: success Sample: false |
|
Date and time the host was last pinged. Returned: success Sample: “1970-01-17T17:27:32+0100” |
|
Management server ID of the host. Returned: success Sample: 345050593418 |
|
Amount of the host’s memory currently allocated. Returned: success Sample: 69793218560 |
|
Total of memory of the host. Returned: success Sample: 206085263360 |
|
Amount of the host’s memory currently used. Returned: success Sample: 65504776192 |
|
Name of the host. Returned: success Sample: “esx32.example.com” |
|
Incoming network traffic on the host. Returned: success Sample: 0 |
|
Outgoing network traffic on the host. Returned: success Sample: 0 |
|
OS category name of the host. Returned: success Sample: “…” |
|
Host out-of-band management information. Returned: success Sample: “…” |
|
Pod name of the host. Returned: success Sample: “Pod01” |
|
Date and time the host was removed. Returned: success Sample: “1970-01-17T17:27:32+0100” |
|
Resource state of the host. Returned: success Sample: “Enabled” |
|
State of the host. Returned: success Sample: “Up” |
|
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. Returned: success Sample: true |
|
Zone of the host. Returned: success Sample: “zone01” |
Authors
René Moser (@resmo)