ansible.builtin.gcp_backend_service (v2.7.18) — module

Create or Destroy a Backend Service.

| "added in version" 2.4 of ansible.builtin"

Authors: Tom Melendez (@supertom) <tom@supertom.com>

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.7.18

Description

Create or Destroy a Backend Service. See U(https://cloud.google.com/compute/docs/load-balancing/http/backend-service) for an overview. Full install/configuration instructions for the Google Cloud modules can be found in the comments of ansible/test/gce_tests.py.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create Minimum Backend Service
  gcp_backend_service:
    service_account_email: "{{ service_account_email }}"
    credentials_file: "{{ credentials_file }}"
    project_id: "{{ project_id }}"
    backend_service_name: "{{ bes }}"
    backends:
    - instance_group: managed_instance_group_1
    healthchecks:
    - healthcheck_name_for_backend_service
    port_name: myhttpport
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create BES with extended backend parameters
  gcp_backend_service:
    service_account_email: "{{ service_account_email }}"
    credentials_file: "{{ credentials_file }}"
    project_id: "{{ project_id }}"
    backend_service_name: "{{ bes }}"
    backends:
    - instance_group: managed_instance_group_1
      max_utilization: 0.6
      max_rate: 10
    - instance_group: managed_instance_group_2
      max_utilization: 0.5
      max_rate: 4
    healthchecks:
    - healthcheck_name_for_backend_service
    port_name: myhttpport
    state: present
    timeout: 60

Inputs

    
state:
    choices:
    - absent
    - present
    default: present
    description:
    - Desired state of the resource

timeout:
    description:
    - How many seconds to wait for the backend before considering it a failed request.
      Default is 30 seconds. Valid range is 1-86400.
    required: false

backends:
    description:
    - List of backends that make up the backend service. A backend is made up of an instance
      group and optionally several other parameters.  See U(https://cloud.google.com/compute/docs/reference/latest/backendServices)
      for details.
    required: true

protocol:
    description:
    - The protocol this Backend Service uses to communicate with backends. Possible values
      are HTTP, HTTPS, TCP, and SSL. The default is HTTP.
    required: false

port_name:
    description:
    - Name of the port on the managed instance group (MIG) that backend services can forward
      data to. Required for external load balancing.

enable_cdn:
    description:
    - If true, enable Cloud CDN for this Backend Service.

project_id:
    description:
    - GCE project ID.

healthchecks:
    description:
    - List of healthchecks. Only one healthcheck is supported.
    required: true

credentials_file:
    description:
    - Path to the JSON file associated with the service account email.

backend_service_name:
    description:
    - Name of the Backend Service.
    required: true

service_account_email:
    description:
    - Service account email

Outputs

backend_service_created:
  description: Indicator Backend Service was created.
  returned: When a Backend Service is created.
  sample: 'True'
  type: boolean
backend_service_deleted:
  description: Indicator Backend Service was deleted.
  returned: When a Backend Service is deleted.
  sample: 'True'
  type: boolean
backend_service_name:
  description: Name of the Backend Service.
  returned: Always.
  sample: my-backend-service
  type: string
backends:
  description: List of backends (comprised of instance_group) that make up a Backend
    Service.
  returned: When a Backend Service exists.
  sample: '[ { ''instance_group'': ''mig_one'', ''zone'': ''us-central1-b''} ]'
  type: list
enable_cdn:
  description: If Cloud CDN is enabled. null if not set.
  returned: When a backend service exists.
  sample: 'True'
  type: boolean
healthchecks:
  description: List of healthchecks applied to the Backend Service.
  returned: When a Backend Service exists.
  sample: '[ ''my-healthcheck'' ]'
  type: list
port_name:
  description: Name of Backend Port.
  returned: When a Backend Service exists.
  sample: myhttpport
  type: string
protocol:
  description: Protocol used to communicate with the Backends.
  returned: When a Backend Service exists.
  sample: HTTP
  type: string
timeout:
  description: In seconds, how long before a request sent to a backend is considered
    failed.
  returned: If specified.
  sample: myhttpport
  type: int