W3cubDocs

/Ansible 2.11

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.0.0).

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

Synopsis

  • Create, update and remove hosts.

Requirements

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

  • python >= 2.6
  • cs >= 0.9.0

Parameters

Parameter Choices/Defaults Comments
allocation_state
string
    Choices:
  • enabled
  • disabled
  • maintenance
Allocation state of the host.
api_http_method
string
    Choices:
  • get
  • post
HTTP method used to query the API endpoint.
If not given, the CLOUDSTACK_METHOD env variable is considered.
api_key
string / required
API key of the CloudStack API.
If not given, the CLOUDSTACK_KEY env variable is considered.
api_secret
string / required
Secret key of the CloudStack API.
If not set, the CLOUDSTACK_SECRET env variable is considered.
api_timeout
integer
Default:
10
HTTP timeout in seconds.
If not given, the CLOUDSTACK_TIMEOUT env variable is considered.
api_url
string / required
URL of the CloudStack API e.g. https://cloud.example.com/client/api.
If not given, the CLOUDSTACK_ENDPOINT env variable is considered.
api_verify_ssl_cert
string
Verify CA authority cert file.
If not given, the CLOUDSTACK_VERIFY env variable is considered.
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
    Choices:
  • present
  • absent
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 / required
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 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


Authors

  • René Moser (@resmo)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/ngine_io/cloudstack/cs_host_module.html