gcore.cloud.servergroup (1.0.1) — module

Manages servergroups

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 or delete servergroup

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create new servergroup
  gcore.cloud.servergroup:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: create
    name: "my-servergroup"
    policy: "soft-anti-affinity"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete servergroup
  gcore.cloud.servergroup:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: delete
    servergroup_id: "{{ servergroup_id }}"

Inputs

    
name:
    description:
    - Server group name.
    - Required if I(command) is create
    required: false
    type: str

policy:
    choices:
    - anti-affinity
    - affinity
    - soft-anti-affinity
    description:
    - Server group policy.
    - Required 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
    - 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

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

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

servergroup_id:
    description:
    - Server group ID.
    - Required if I(command) is delete
    required: false
    type: str

Outputs

servergroup:
  contains:
    instances:
      description: Instances in this server group
      elements: dict
      returned: always
      sample:
      - instance_id: 6d14f194-6c1e-49b3-9fc7-50dc8401eb74
        instance_name: test_ruslan_aa2
      type: list
    name:
      description: Server group name
      returned: always
      sample: example_server_group
      type: str
    policy:
      description: anti-affinity or affinity or soft-anti-affinity
      returned: always
      sample: anti-affinity
      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
    servergroup_id:
      description: Server group ID
      returned: always
      sample: 47003067-550a-6f17-93b6-81ee16ba061e
      type: str
  description:
  - Response depends of I(command).
  returned: always
  type: complex

See also