community.general.cs_instance_info (0.1.1) — module

Gathering information from the API of instances from Apache CloudStack based clouds.

Authors: René Moser (@resmo)

stableinterface | 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

Gathering information from the API of an instance.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gather instance information
  cs_instance_info:
    name: web-vm-1
  delegate_to: localhost
  register: vm
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Show the returned results of the registered variable
  debug:
    msg: "{{ vm }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gather information from all instances
  cs_instance_info:
  delegate_to: localhost
  register: vms
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Show information on all instances
  debug:
    msg: "{{ vms }}"

Inputs

    
name:
    description:
    - Name or display name of the instance.
    - If not specified, all instances are returned
    required: false
    type: str

domain:
    description:
    - Domain the instance is related to.
    type: str

account:
    description:
    - Account the instance is related to.
    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

project:
    description:
    - Project the instance is related to.
    type: str

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

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

Outputs

instances:
  contains:
    account:
      description: Account the instance is related to.
      returned: success
      sample: example account
      type: str
    affinity_groups:
      description: Affinity groups the instance is in.
      returned: success
      sample: '[ "webservers" ]'
      type: list
    created:
      description: Date of the instance was created.
      returned: success
      sample: 2014-12-01T14:57:57+0100
      type: str
    default_ip:
      description: Default IP address of the instance.
      returned: success
      sample: 10.23.37.42
      type: str
    display_name:
      description: Display name of the instance.
      returned: success
      sample: web-01
      type: str
    domain:
      description: Domain the instance is related to.
      returned: success
      sample: example domain
      type: str
    group:
      description: Group name of the instance is related.
      returned: success
      sample: web
      type: str
    host:
      description: Host the instance is running on.
      returned: success and instance is running
      sample: host01.example.com
      type: str
      version_added: '2.6'
      version_added_collection: community.general
    hypervisor:
      description: Hypervisor related to this instance.
      returned: success
      sample: KVM
      type: str
    id:
      description: UUID of the instance.
      returned: success
      sample: 04589590-ac63-4ffc-93f5-b698b8ac38b6
      type: str
    instance_name:
      description: Internal name of the instance (ROOT admin only).
      returned: success
      sample: i-44-3992-VM
      type: str
    iso:
      description: Name of ISO the instance was deployed with.
      returned: success
      sample: Debian-8-64bit
      type: str
    name:
      description: Name of the instance.
      returned: success
      sample: web-01
      type: str
    nic:
      contains:
        broadcasturi:
          description: The broadcast uri of the nic.
          returned: success
          sample: vlan://2250
          type: str
        gateway:
          description: The gateway of the nic.
          returned: success
          sample: 10.1.2.1
          type: str
        id:
          description: The ID of the nic.
          returned: success
          sample: 5dc74fa3-2ec3-48a0-9e0d-6f43365336a9
          type: str
        ipaddress:
          description: The ip address of the nic.
          returned: success
          sample: 10.1.2.3
          type: str
        isdefault:
          description: True if nic is default, false otherwise.
          returned: success
          sample: true
          type: bool
        isolationuri:
          description: The isolation uri of the nic.
          returned: success
          sample: vlan://2250
          type: str
        macaddress:
          description: The mac address of the nic.
          returned: success
          sample: 06:a2:03:00:08:12
          type: str
        netmask:
          description: The netmask of the nic.
          returned: success
          sample: 255.255.255.0
          type: str
        networkid:
          description: The ID of the corresponding network.
          returned: success
          sample: 432ce27b-c2bb-4e12-a88c-a919cd3a3017
          type: str
        networkname:
          description: The name of the corresponding network.
          returned: success
          sample: network1
          type: str
        traffictype:
          description: The traffic type of the nic.
          returned: success
          sample: Guest
          type: str
        type:
          description: The type of the network.
          returned: success
          sample: Shared
          type: str
      description: List of dictionaries of the instance nics.
      returned: success
      type: complex
      version_added: '2.8'
      version_added_collection: community.general
    password:
      description: The password of the instance if exists.
      returned: success
      sample: Ge2oe7Do
      type: str
    password_enabled:
      description: True if password setting is enabled.
      returned: success
      sample: true
      type: bool
    project:
      description: Name of project the instance is related to.
      returned: success
      sample: Production
      type: str
    public_ip:
      description: Public IP address with instance via static NAT rule.
      returned: success
      sample: 1.2.3.4
      type: str
    security_groups:
      description: Security groups the instance is in.
      returned: success
      sample: '[ "default" ]'
      type: list
    service_offering:
      description: Name of the service offering the instance has.
      returned: success
      sample: 2cpu_2gb
      type: str
    ssh_key:
      description: Name of SSH key deployed to instance.
      returned: success
      sample: key@work
      type: str
    state:
      description: State of the instance.
      returned: success
      sample: Running
      type: str
    tags:
      description: List of resource tags associated with the instance.
      returned: success
      sample: '[ { "key": "foo", "value": "bar" } ]'
      type: list
    template:
      description: Name of template the instance was deployed with.
      returned: success
      sample: Debian-8-64bit
      type: str
    volumes:
      description: List of dictionaries of the volumes attached to the instance.
      returned: success
      sample: '[ { name: "ROOT-1369", type: "ROOT", size: 10737418240 }, { name: "data01,
        type: "DATADISK", size: 10737418240 } ]'
      type: list
    zone:
      description: Name of zone the instance is in.
      returned: success
      sample: ch-gva-2
      type: str
  description: A list of matching instances.
  returned: success
  type: list