gcore.cloud.subnet_info (1.0.1) — module

Gather infos about all GCore subnets.

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 subnets.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gather gcore subnets info
  gcore.cloud.subnet_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 subnet info
  gcore.cloud.subnet_info:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    subnet_id: "{{ subnet_id }}"

Inputs

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

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

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

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

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

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

network_id:
    description:
    - Only list subnets of this network.
    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

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

Outputs

subnet_info:
  contains:
    available_ips:
      description: Number of available ips in subnet
      returned: always
      sample: 250
      type: int
    cidr:
      description: CIDR
      returned: always
      sample: 192.168.13.0/24
      type: str
    connect_to_network_router:
      description: Connecto to router
      returned: if available
      sample: true
      type: bool
    created_at:
      description: Datetime when the subnet was created
      returned: always
      sample: 2020-08-17T12:39:02+0000
      type: str
    creator_task_id:
      description: Task that created this entity
      returned: if available
      sample: 5cc890da-d031-4a23-ac31-625edfa22812
      type: str
    dns_nameservers:
      description: List IP addresses of a DNS resolver reachable from the network
      elements: str
      returned: always
      sample:
      - 8.8.8.8
      - 8.8.4.4
      type: list
    enable_dhcp:
      description: True if DHCP should be enabled
      returned: always
      sample: true
      type: bool
    gateway_ip:
      description:
      - Default GW IPv4 address, advertised in DHCP routes of this subnet.
      - If null, no gateway is advertised by this subnet
      returned: always
      sample: 192.168.13.1
      type: str
    has_router:
      description: Subnet has router attached to it
      returned: if available
      sample: false
      type: bool
    host_routes:
      description: List of custom static routes to advertise via DHCP
      elements: dict
      returned: always
      sample: []
      type: list
    id:
      description: Subnet ID
      returned: always
      sample: b39792c3-3160-4356-912e-ba396c95cdcf
      type: str
    ip_version:
      description: IP version
      returned: always
      sample: 4
      type: int
    metadata:
      description: Metadata
      elements: dict
      returned: always
      sample:
      - key: key1
        read_only: false
        value: value1
      type: list
    name:
      description: Subnet name
      returned: always
      sample: subnet_1
      type: str
    network_id:
      description: Network ID
      returned: always
      sample: b30d0de7-bca2-4c83-9c57-9e645bd2cc92
      type: str
    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
    task_id:
      description: Active task. If None, action has been performed immediately in
        the request itself
      returned: always
      sample: 907a87b0-7b63-4fd5-beb3-5ab4ba445c93
      type: str
    total_ips:
      description: Total number of ips in subnet
      returned: always
      sample: 253
      type: int
    updated_at:
      description: Datetime when the subnet was updated
      returned: always
      sample: 2020-08-17T12:39:02+0000
      type: str
  description:
  - When I(subnet_id) is passed, it is a dict of resource.
  - Otherwise it is a list of dictionaries.
  returned: always
  type: complex

See also