gcore.cloud.loadbalancer_listener (1.0.1) — module

Manages loadbalancer listeners.

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create new listener
  gcore.cloud.loadbalancer_listener:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: create
    name: tcp_test
    protocol: TCP
    protocol_port: 80
    loadbalancer_id: "{{ loadbalancer_id }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update listener
  gcore.cloud.loadbalancer_listener:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: update
    loadbalancer_listener_id: "{{ loadbalancer_listener_id }}"
    name: tcp_listener_2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete listener
  gcore.cloud.loadbalancer_listener:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: delete
    loadbalancer_listener_id: "{{ loadbalancer_listener_id }}"

Inputs

    
name:
    description:
    - Load balancer listener name.
    - Required if I(command) is create.
    - Used if I(command) is update
    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

protocol:
    choices:
    - HTTP
    - HTTPS
    - TCP
    - UDP
    - TERMINATED_HTTPS
    - PROMETHEUS
    description:
    - Load balancer protocol.
    - Required if I(command) is create.
    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

secret_id:
    description:
    - ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS load balancer.
    - Used if I(command) is create.
    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

allowed_cidrs:
    description:
    - Network CIDRs from which service will be accessible.
    - Used if I(command) is create.
    elements: str
    required: false
    type: list

protocol_port:
    description:
    - Protocol port.
    - Required if I(command) is create.
    required: false
    type: int

sni_secret_id:
    description:
    - List of secret's ID containing PKCS12 format certificate/key bundles for TERMINATED_HTTPS
      listeners.
    - Used if I(command) is create.
    elements: str
    required: false
    type: list

loadbalancer_id:
    description:
    - Load balancer ID.
    - Required if I(command) is create.
    required: false
    type: str

insert_x_forwarded:
    description:
    - Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests.
    - Only used with HTTP or TERMINATED_HTTPS protocols.
    - Used if I(command) is create.
    required: false
    type: bool

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

Outputs

loadbalancer_listener:
  contains:
    allowed_cidrs:
      description: Network CIDRs from which service will be accessible
      elements: str
      returned: always
      sample:
      - 10.0.0.0/32
      type: list
    creator_task_id:
      description: Task that created this entity
      returned: always
      sample: d2d871da-d7ce-4c2b-bedc-5900c37880e6
      type: str
    id:
      description: Load balancer listener ID
      returned: always
      sample: 43658ea9-54bd-4807-90b1-925921c9a0d1
      type: str
    insert_headers:
      description:
      - Dictionary of additional header insertion into HTTP headers.
      - Only used with HTTP and TERMINATED_HTTPS protocols.
      returned: always
      sample: {}
      type: dict
    loadbalancer_id:
      description: Load balancer ID
      returned: always
      sample: 61d0a6c0-3676-4b5b-9455-03efff0143d3
      type: str
    name:
      description: Load balancer listener name
      returned: always
      sample: lbaas_test_listener
      type: str
    operating_status:
      description: Listener operating status
      returned: always
      sample: ONLINE
      type: str
    pool_count:
      description: Number of pools
      returned: always
      sample: 0
      type: int
    protocol:
      description: Load balancer protocol
      returned: always
      sample: TCP
      type: str
    protocol_port:
      description: Protocol port
      returned: always
      sample: 80
      type: int
    provisioning_status:
      description: Listener lifecycle status
      returned: always
      sample: ACTIVE
      type: str
    secret_id:
      description: ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS
        load balancer
      returned: always
      sample: eddd2336-0e38-4efc-86d7-e8b3801e83e0
      type: str
    sni_secret_id:
      description:
      - List of secret's ID containing PKCS12 format certificate/key bundles for TERMINATED_HTTPS
        listeners.
      elements: str
      returned: always
      sample:
      - e76a3f17-f5a1-4efa-8917-c6c2e8eb157c
      type: list
    stats:
      description: Statistic of the listener. It is available only in get functions
        by a flag.
      returned: if available
      sample:
        active_connections: 0
        bytes_in: 34942398609
        bytes_out: 304777113641
        request_errors: 4
        total_connections: 21095970
      type: dict
    task_id:
      description: Active task. If None, action has been performed immediately in
        the request itself.
      returned: always
      sample: c593da0c-1fa4-4882-8d0c-c5179fbcfc71
      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