gcore.cloud.loadbalancer (1.0.1) — module

Manages loadblancers

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 loadbalancer

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create new loadbalancer
  gcore.cloud.loadbalancer:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: create
    name: 'my-loadbalancer'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update loadbalancer
  gcore.cloud.loadbalancer:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: update
    loadbalancer_id: "{{ loadbalancer_id }}"
    name: 'new-name'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete loadbalancer
  gcore.cloud.loadbalancer:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: delete
    loadbalancer_id: "{{ loadbalancer_id }}"

Inputs

    
name:
    description:
    - Load balancer name.
    - Used if I(command) is create or update
    - Required if I(command) is create and name_template is not passed
    required: false
    type: str

flavor:
    description:
    - Load balancer flavor name.
    - 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

logging:
    description:
    - Logging configuration.
    - Used if I(command) is create
    required: false
    type: dict

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:
    - Loadbalancer metadata.
    - Used if I(command) is create
    required: false
    type: dict

listeners:
    description:
    - Load balancer listeners.
    - Used if I(command) is create
    elements: dict
    required: false
    type: list

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

floating_ip:
    description:
    - Floating IP configuration for assignment.
    - Used if I(command) is create
    required: false
    type: dict

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

vip_port_id:
    description:
    - Existing Reserved Fixed IP port ID for load balancer.
    - Mutually exclusive with vip_network_id.
    - Used if I(command) is create
    required: false
    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

name_template:
    description:
    - Load balancer name which will be changed by template.
    - Required if I(command) is create and name is not passed
    required: false
    type: str

vip_subnet_id:
    description:
    - Subnet ID for load balancer.
    - If not specified, any subnet from vip_network_id will be selected.
    - Ignored when vip_network_id is not specified.
    - Used if I(command) is create
    required: false
    type: str

vip_network_id:
    description:
    - Network ID for load balancer. If not specified, default external network will be
      used.
    - vip_subnet_id is required in addition to vip_network_id. Mutually exclusive with
      vip_port_id.
    - Used if I(command) is create.
    required: false
    type: str

loadbalancer_id:
    description:
    - Loadbalancer Id.
    - Required if I(command) is update or delete
    required: false
    type: str

Outputs

loadbalancer:
  contains:
    created_at:
      description: Loadbalancer create datetime
      returned: always
      sample: 2020-01-24T13:57:12+0000
      type: str
    ddos_profile:
      description: Logging configuration
      returned: if available
      sample:
        fields:
        - base_field: 10
          default: null
          description: ARK server ports. Valid port values are in range 1000-65535
          field_type: null
          field_value:
          - 45046
          - 45047
          id: 11
          name: ARK Ports
          required: true
          validation_schema:
            items:
              maximum: 65535
              minimum: 1000
              type: integer
            minItems: 1
            type: array
          value: null
        id: 0
        ip_address: 123.123.123.1
        options:
          active: true
          bgp: true
        profile_template:
          description: test client profile template
          fields:
          - default: null
            description: ARK server ports. Valid port values are in range 1000-65535
            field_type: null
            id: 11
            name: ARK Ports
            required: true
            validation_schema:
              items:
                maximum: 65535
                minimum: 1000
                type: integer
              minItems: 1
              type: array
          id: 0
          name: test_client_profile_template
        profile_template_description: ARK server ports. Valid port values are in range
          1000-65535
        protocols:
        - additionalProp1: string
          additionalProp2: string
          additionalProp3: string
        site: ED
        status:
          error_description: An error occurred while deleting profile
          status: Error Deleting
      type: dict
    flavor:
      description: Load balancer flavor
      returned: always
      sample:
        flavor_id: 1d276f53-2834-4855-9859-aa922f073055
        flavor_name: lb1-1-2
        ram: 2048
        vcpus: 1
      type: dict
    floating_ips:
      description: List of assigned floating IPs
      elements: dict
      returned: always
      sample:
      - existing_floating_id: c1b79a5f-916a-4457-b284-c61e59727751
        source: existing
      type: list
    id:
      description: Loadbalancer ID
      returned: always
      sample: e8ab1be4-1521-4266-be69-28dad4148a30
      type: str
    listeners:
      description: Load balancer listeners
      elements: dict
      returned: always
      sample:
      - allowed_cidrs: []
        description: test
        id: 0b831470-0160-4601-bfd6-04a0df623eae
        name: listener
        operating_status: ONLINE
        protocol: HTTP
        protocol_port: 80
        provisioning_status: ACTIVE
      type: list
    logging:
      description: Logging configuration
      returned: if available
      sample:
        destination_region_id: 1
        enabled: false
        retention_policy:
          period: 45
        topic_name: some_topic_name
      type: dict
    metadata:
      description: Create one or more metadata items for a loadbalancers
      elements: dict
      returned: if available
      sample:
      - key: type
        read_only: false
        value: standart
      type: list
    name:
      description: Loadbalancer name
      returned: always
      sample: lbaas_test_lb
      type: str
    operating_status:
      description: Load balancer operating status
      returned: always
      sample: ONLINE
      type: str
    project_id:
      description: Project ID
      returned: always
      sample: 1
      type: int
    provisioning_status:
      description: Load balancer lifecycle status
      returned: always
      sample: ACTIVE
      type: str
    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: 4966d73a-451a-4768-9fb7-65661f246fad
      type: str
    updated_at:
      description: Loadbalancer update datetime
      returned: always
      sample: 2020-01-24T13:57:35+0000
      type: str
    vip_address:
      description: Load balancer IP address
      returned: always
      sample: 5.5.5.5
      type: str
    vip_port_id:
      description: Port ID
      returned: always
      sample: 5eee7e6f-55d6-4044-b205-4988247d2540
      type: str
    vrrp_ips:
      description: List of VRRP IP addresses
      elements: dict
      returned: always
      sample:
      - vrrp_ip: 45.67.211.68
      type: list
  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