community.general.cs_host (0.1.1) — module

Manages hosts on Apache CloudStack based clouds.

Authors: René Moser (@resmo)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

Create, update and remove hosts.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure a host is present but disabled
  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
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure an existing host is disabled
  cs_host:
    name: pod01.zone01.example.com
    zone: zone01
    allocation_state: disabled
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure an existing host is enabled
  cs_host:
    name: pod01.zone01.example.com
    zone: zone01
    allocation_state: enabled
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure a host is absent
  cs_host:
    name: pod01.zone01.example.com
    zone: zone01
    state: absent
  delegate_to: localhost

Inputs

    
pod:
    description:
    - Name of the pod.
    - Required if I(state=present) and host does not yet exist.
    type: str

url:
    description:
    - Url of the host used to create a host.
    - If not provided, C(http://) and param I(name) is used as url.
    - Only considered if I(state=present) and host does not yet exist.
    type: str

name:
    aliases:
    - ip_address
    description:
    - Name of the host.
    required: true
    type: str

zone:
    description:
    - Name of the zone in which the host should be deployed.
    - If not set, default zone is used.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the host.
    type: str

api_key:
    description:
    - API key of the CloudStack API.
    - If not given, the C(CLOUDSTACK_KEY) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    type: str

api_url:
    description:
    - URL of the CloudStack API e.g. https://cloud.example.com/client/api.
    - If not given, the C(CLOUDSTACK_ENDPOINT) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    type: str

cluster:
    description:
    - Name of the cluster.
    type: str

password:
    description:
    - Password for the host.
    - Required if I(state=present) and host does not yet exist.
    type: str

username:
    description:
    - Username for the host.
    - Required if I(state=present) and host does not yet exist.
    type: str

host_tags:
    aliases:
    - host_tag
    description:
    - Tags of the host.
    type: list

api_region:
    default: cloudstack
    description:
    - Name of the ini section in the C(cloustack.ini) file.
    - If not given, the C(CLOUDSTACK_REGION) env variable is considered.
    type: str

api_secret:
    description:
    - Secret key of the CloudStack API.
    - If not set, the C(CLOUDSTACK_SECRET) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    type: str

hypervisor:
    description:
    - Name of the cluster.
    - Required if I(state=present) and host does not yet exist.
    - Possible values are C(KVM), C(VMware), C(BareMetal), C(XenServer), C(LXC), C(HyperV),
      C(UCS), C(OVM), C(Simulator).
    type: str

api_timeout:
    description:
    - HTTP timeout in seconds.
    - If not given, the C(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.
    type: int

api_http_method:
    choices:
    - get
    - post
    description:
    - HTTP method used to query the API endpoint.
    - If not given, the C(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 C(get) if not specified.
    type: str

allocation_state:
    choices:
    - enabled
    - disabled
    - maintenance
    description:
    - Allocation state of the host.
    type: str

Outputs

'allocation_state:':
  description: Allocation state of the host.
  returned: success
  sample: enabled
  type: str
capabilities:
  description: Capabilities of the host.
  returned: success
  sample: hvm
  type: str
cluster:
  description: Cluster of the host.
  returned: success
  sample: vcenter.example.com/zone/cluster01
  type: str
cluster_type:
  description: Type of the cluster of the host.
  returned: success
  sample: ExternalManaged
  type: str
cpu_allocated:
  description: Amount in percent of the host's CPU currently allocated.
  returned: success
  sample: 166.25%
  type: str
cpu_number:
  description: Number of CPUs of the host.
  returned: success
  sample: 24
  type: str
cpu_sockets:
  description: Number of CPU sockets of the host.
  returned: success
  sample: 2
  type: int
cpu_speed:
  description: CPU speed in Mhz
  returned: success
  sample: 1999
  type: int
cpu_used:
  description: Amount of the host's CPU currently used.
  returned: success
  sample: 33.6%
  type: str
cpu_with_overprovisioning:
  description: Amount of the host's CPU after applying the cpu.overprovisioning.factor.
  returned: success
  sample: 959520.0
  type: str
created:
  description: Date when the host was created.
  returned: success
  sample: 2015-05-03T15:05:51+0200
  type: str
disconnected:
  description: Date when the host was disconnected.
  returned: success
  sample: 2015-05-03T15:05:51+0200
  type: str
disk_size_allocated:
  description: Host's currently allocated disk size.
  returned: success
  sample: 2593
  type: int
disk_size_total:
  description: Total disk size of the host
  returned: success
  sample: 259300
  type: int
events:
  description: Events available for the host
  returned: success
  sample: Ping; HostDown; AgentConnected; AgentDisconnected; PingTimeout; ShutdownRequested;
    Remove; StartAgentRebalance; ManagementServerDown
  type: str
gpu_group:
  description: GPU cards present in the host.
  returned: success
  sample: []
  type: list
ha_host:
  description: Whether the host is a HA host.
  returned: success
  sample: false
  type: bool
has_enough_capacity:
  description: Whether the host has enough CPU and RAM capacity to migrate a VM to
    it.
  returned: success
  sample: true
  type: bool
host_tags:
  description: Comma-separated list of tags for the host.
  returned: success
  sample: perf
  type: str
host_type:
  description: Type of the host.
  returned: success
  sample: Routing
  type: str
host_version:
  description: Version of the host.
  returned: success
  sample: 4.5.2
  type: str
hypervisor:
  description: Host's hypervisor.
  returned: success
  sample: VMware
  type: str
hypervisor_version:
  description: Hypervisor version.
  returned: success
  sample: 5.1
  type: str
ip_address:
  description: IP address of the host
  returned: success
  sample: 10.10.10.1
  type: str
is_local_storage_active:
  description: Whether the local storage is available or not.
  returned: success
  sample: false
  type: bool
last_pinged:
  description: Date and time the host was last pinged.
  returned: success
  sample: 1970-01-17T17:27:32+0100
  type: str
management_server_id:
  description: Management server ID of the host.
  returned: success
  sample: 345050593418
  type: int
memory_allocated:
  description: Amount of the host's memory currently allocated.
  returned: success
  sample: 69793218560
  type: int
memory_total:
  description: Total of memory of the host.
  returned: success
  sample: 206085263360
  type: int
memory_used:
  description: Amount of the host's memory currently used.
  returned: success
  sample: 65504776192
  type: int
name:
  description: Name of the host.
  returned: success
  sample: esx32.example.com
  type: str
network_kbs_read:
  description: Incoming network traffic on the host.
  returned: success
  sample: 0
  type: int
network_kbs_write:
  description: Outgoing network traffic on the host.
  returned: success
  sample: 0
  type: int
os_category:
  description: OS category name of the host.
  returned: success
  sample: '...'
  type: str
out_of_band_management:
  description: Host out-of-band management information.
  returned: success
  sample: '...'
  type: str
pod:
  description: Pod name of the host.
  returned: success
  sample: Pod01
  type: str
removed:
  description: Date and time the host was removed.
  returned: success
  sample: 1970-01-17T17:27:32+0100
  type: str
resource_state:
  description: Resource state of the host.
  returned: success
  sample: Enabled
  type: str
state:
  description: State of the host.
  returned: success
  sample: Up
  type: str
suitable_for_migration:
  description: 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
  type: str
zone:
  description: Zone of the host.
  returned: success
  sample: zone01
  type: str