gcore.cloud.instance_info (1.0.1) — module

Gather infos about all GCore instances.

Authors: GCore (@GCore)

Install collection

Install with ansible-galaxy collection install gcore.cloud:==1.0.1


Add to requirements.yml

  collections:
    - name: gcore.cloud
      version: 1.0.1

Description

Gather infos about all GCore instances.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gather gcore instances info
  gcore.cloud.instance_info:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gather gcore specific instance info
  gcore.cloud.gcore_instance_info:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    instance_id: "{{ instance_id }}"

Inputs

    
ip:
    description:
    - An IPv4 address to filter results by. Regular expression allowed.
    required: false
    type: str

name:
    description:
    - Filter out instances by name.
    required: false
    type: str

uuid:
    description:
    - Filter the server list result by the UUID of the server.
    - Allowed list of UUIDs part.
    required: false
    type: str

limit:
    description:
    - Limit the number of returned instances
    required: false
    type: int

offset:
    description:
    - Offset value is used to exclude the first set of records from the result
    required: false
    type: int

status:
    choices:
    - ACTIVE
    - ERROR
    - SHUTOFF
    - REBOOT
    - PAUSED
    description:
    - Filters instances by a server status, as a string.
    required: false
    type: str

api_key:
    description:
    - GCore API auth key
    - Can be passed as I(CLOUD_API_KEY) environment variable.
    type: str

api_host:
    default: https://api.gcore.com/cloud
    description:
    - GCore API base host
    - Can be passed as I(CLOUD_API_HOST) environment variable.
    type: str

order_by:
    description:
    - Ordering the server list result by name or created date fields of the server.
    required: false
    type: str

flavor_id:
    description:
    - Filter out instances by flavor_id. Flavor id must match exactly.
    required: false
    type: str

region_id:
    description:
    - GCore API region ID
    - Required if I(region_name) is not passed
    - Can be passed as I(CLOUD_REGION_ID) environment variable.
    type: int

include_ai:
    default: false
    description:
    - Include AI instances.
    required: false
    type: bool

metadata_v:
    description:
    - Filter by metadata values. Must be a valid JSON string.
    required: false
    type: str

project_id:
    description:
    - GCore API project ID
    - Required if I(project_name) is not passed
    - Can be passed as I(CLOUD_PROJECT_ID) environment variable.
    type: int

api_timeout:
    default: 30
    description:
    - Timeout in seconds to polling GCore API
    type: int

include_k8s:
    default: true
    description:
    - Include k8s instances.
    required: false
    type: bool

instance_id:
    description:
    - The ID of instance you want to get.
    - The module will fail if the provided ID is invalid.
    required: false
    type: str

metadata_kv:
    description:
    - Filter by metadata key-value pairs. Must be a valid JSON string.
    required: false
    type: str

region_name:
    description:
    - GCore API region name
    - Required if I(region_id) is not passed
    - Can be passed as I(CLOUD_REGION_NAME) environment variable.
    type: str

project_name:
    description:
    - GCore API project name
    - Required if I(project_id) is not passed
    - Can be passed as I(CLOUD_PROJECT_NAME) environment variable.
    type: str

changes_since:
    description:
    - Filters the instances by a date and time stamp when the instances last changed status.
    required: false
    type: str

flavor_prefix:
    description:
    - Filter out instances by flavor prefix.
    required: false
    type: str

changes_before:
    description:
    - Filters the instances by a date and time stamp when the instances last changed.
    required: false
    type: str

exclude_secgroup:
    description:
    - Exclude instances with specified security group name.
    required: false
    type: str

include_baremetal:
    description:
    - Include baremetal instances.
    required: false
    type: bool

available_floating:
    description:
    - Pass any string to only show instances which are able to handle floating address.
    required: false
    type: str

Outputs

instance_info:
  contains:
    addresses:
      description: Map of network_name
      returned: always
      sample:
        net1:
        - addr: 10.0.0.17
          subnet_id: 91200a6c-07e0-42aa-98da-32d1f6545ae7
          subnet_name: string
          type: fixed
        - addr: 92.38.157.215
          subnet_id: 91200a6c-07e0-42aa-98da-32d1f6545ae7
          subnet_name: string
          type: floating
        net2:
        - addr: 192.168.68.68
          subnet_id: 91200a6c-07e0-42aa-98da-32d1f6545ae7
          subnet_name: string
          type: fixed
      type: dict
    blackhole_ports:
      description: IP addresses of the instances that are blackholed by DDoS mitigation
        system
      returned: if available
      sample:
      - AlarmEnd: '2021-03-17T16:24:06'
        AlarmStart: '2021-03-17T14:24:06'
        AlarmState: ALARM
        AlertDuration: 2 hours
        DestinationIP: 92.38.162.134
        ID: 1
      type: list
    creator_task_id:
      description: Task that created this entity
      returned: if available
      sample: d1e1500b-e2be-40aa-9a4b-cc493fa1af30
      type: str
    flavor:
      description: Flavor
      returned: always
      sample:
        disk: 0
        flavor_id: g1s-shared-1-0.5
        flavor_name: g1s-shared-1-0.5
        ram: 512
        vcpus: 1
      type: dict
    instance_created:
      description: Datetime when instance was created
      returned: always
      sample: '2019-07-11T06:58:48Z'
      type: str
    instance_description:
      description: Instance description
      returned: always
      sample: Testing
      type: str
    instance_id:
      description: Region ID
      returned: always
      sample: a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9
      type: str
    instance_name:
      description: Instance name
      returned: always
      sample: Testing
      type: str
    keypair_name:
      description: Keypair name
      returned: if available
      sample: None
      type: str
    metadata:
      description: Metadata
      returned: if available
      sample:
        image_id: f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1
        image_name: cirros-0.3.5-x86_64-disk
        os_distro: centos
        os_version: 1711-x64
        snapshot_id: c286cd13-fba9-4302-9cdb-4351a05a56ea
        snapshot_name: test_snapshot
        task_id: d1e1500b-e2be-40aa-9a4b-cc493fa1af30
      type: dict
    metadata_detailed:
      description: Detailed VM metadata
      returned: if available
      sample:
      - key: task_id
        read_only: true
        value: d1e1500b-e2be-40aa-9a4b-cc493fa1af30
      type: list
    project_id:
      description: Project ID
      returned: always
      sample: 1
      type: int
    region:
      description: Region name
      returned: always
      sample: Luxembourg 1
      type: str
    region_id:
      description: Region ID
      returned: always
      sample: 1
      type: int
    security_groups:
      description: Security groups
      returned: if available
      sample:
      - name: default
      type: list
    status:
      description: VM status
      returned: always
      sample: ACTIVE
      type: str
    task_id:
      description: Active task. If None, action has been performed immediately in
        the request itself
      returned: always
      sample: f28a4982-9be1-4e50-84e7-6d1a6d3f8a02
      type: str
    task_state:
      description: Task state
      returned: always
      sample: None
      type: str
    vm_state:
      description: Virtual machine state
      returned: always
      sample: active
      type: str
    volumes:
      description: List of volumes
      returned: always
      sample:
      - delete_on_termination: false
        id: 28bfe198-a003-4283-8dca-ab5da4a71b62
      type: dict
  description:
  - When I(instance_id) is passed, it is a dict of resource.
  - Otherwise it is a list of dictionaries.
  returned: always
  type: complex

See also