gcore.cloud.network (1.0.1) — module

Manages networks

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

Create/update or delete network

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create new network
  gcore.cloud.network:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: create
    name: "test-network"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Rename network
  gcore.cloud.network:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: update
    network_id: "{{ network_id }}"
    name: "new-name"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete network
  gcore.cloud.network:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: delete
    network_id: "{{ network_id }}"

Inputs

    
name:
    description:
    - Network name.
    - Required if I(command) is create or update
    required: false
    type: str

type:
    choices:
    - vlan
    - vxlan
    description:
    - vlan or vxlan network type is allowed. Default value is vxlan.
    - Used if I(command) is create.
    required: false
    type: str

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

command:
    choices:
    - create
    - update
    - delete
    description:
    - Operation to perform.
    required: true
    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

metadata:
    description:
    - Network metadata
    - Used if I(command) is create.
    required: false
    type: dict

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

network_id:
    description:
    - The ID of network
    - Required if I(command) is update or delete
    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

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

create_router:
    description:
    - Defaults to True.
    - Used if I(command) is create.
    required: false
    type: bool

Outputs

network:
  contains:
    created_at:
      description: Datetime when the network was created
      returned: always
      sample: 2019-06-18T11:56:16+0000
      type: str
    creator_task_id:
      description: Task that created this entity
      returned: always
      sample: fd50fdd1-0482-4c9b-b847-fc9924665af6
      type: str
    default:
      description: True if the network has is_default attribute
      returned: if available
      sample: true
      type: bool
    external:
      description: True if the network has router:external attribute
      returned: always
      sample: true
      type: bool
    id:
      description: Network ID
      returned: always
      sample: 726ecfcc-7fd0-4e30-a86e-7892524aa483
      type: str
    metadata:
      description: Network metadata
      returned: if available
      sample:
      - key: key1
        read_only: false
        value: value1
      type: list
    mtu:
      description: Maximum transmission unit
      returned: always
      sample: 1450
      type: int
    name:
      description: Network name
      returned: always
      sample: 123
      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
    segmentation_id:
      description: Id of network segment
      returned: if available
      sample: 9
      type: int
    shared:
      description: True when the network is shared with your project by external owner
      returned: always
      sample: false
      type: bool
    subnets:
      description: List of subnetworks
      elements: str
      returned: always
      sample:
      - f00624ab-41bc-4d54-a723-1673ce32d997
      - 41e0f698-4d39-483b-b77a-18eb070e4c09
      type: list
    task_id:
      description: Active task. If None, action has been performed immediately in
        the request itself
      returned: if available
      sample: f00624ab-41bc-4d54-a723-1673ce32d997
      type: str
    type:
      description: Network type (vlan, vxlan)
      returned: always
      sample: vlan
      type: str
    updated_at:
      description: Datetime when the network was last updated
      returned: if available
      sample: 2019-06-19T11:56:16+0000
      type: str
  description:
  - Response depends of I(command).
  - If I(command) is create or update then response will be a dict of resource.
  - If I(command) is delete then response will be a dict of resource ID.
  returned: always
  type: complex

See also