On this page
gcp_backend_service - Create or Destroy a Backend Service.
New in version 2.4.
Synopsis
- Create or Destroy a Backend Service. See 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 (on host that executes module)
- python >= 2.6
- apache-libcloud >= 1.3.0
Options
parameter | required | default | choices | comments |
---|---|---|---|---|
backend_service_name |
yes |
Name of the Backend Service.
|
||
backends |
yes |
List of backends that make up the backend service. A backend is made up of an instance group and optionally several other parameters. See https://cloud.google.com/compute/docs/reference/latest/backendServices for details.
|
||
credentials_file |
no |
Path to the JSON file associated with the service account email.
|
||
enable_cdn |
no |
If true, enable Cloud CDN for this Backend Service.
|
||
healthchecks |
yes |
List of healthchecks. Only one healthcheck is supported.
|
||
port_name |
no |
Name of the port on the managed instance group (MIG) that backend services can forward data to. Required for external load balancing.
|
||
project_id |
no |
GCE project ID.
|
||
protocol |
no |
The protocol this Backend Service uses to communicate with backends. Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP.
|
||
service_account_email |
no |
Service account email
|
||
state |
no | present |
|
Desired state of the resource
|
timeout |
no |
How many seconds to wait for the backend before considering it a failed request. Default is 30 seconds. Valid range is 1-86400.
|
Examples
- 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:
- name: healthcheck_name_for_backend_service
port_name: myhttpport
state: present
- 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:
- name: healthcheck_name_for_backend_service
port_name: myhttpport
state: present
timeout: 60
Return Values
Common return values are documented here Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
backend_service_created |
Indicator Backend Service was created.
|
When a Backend Service is created. | boolean | True |
backend_service_deleted |
Indicator Backend Service was deleted.
|
When a Backend Service is deleted. | boolean | True |
backend_service_name |
Name of the Backend Service.
|
Always. | string | my-backend-service |
backends |
List of backends (comprised of instance_group) that make up a Backend Service.
|
When a Backend Service exists. | list | [ { 'instance_group': 'mig_one', 'zone': 'us-central1-b'} ] |
enable_cdn |
If Cloud CDN is enabled. null if not set.
|
When a backend service exists. | boolean | True |
healthchecks |
List of healthchecks applied to the Backend Service.
|
When a Backend Service exists. | list | [ 'my-healthcheck' ] |
port_name |
Name of Backend Port.
|
When a Backend Service exists. | string | myhttpport |
protocol |
Protocol used to communicate with the Backends.
|
When a Backend Service exists. | string | HTTP |
timeout |
In seconds, how long before a request sent to a backend is considered failed.
|
If specified. | int | myhttpport |
Notes
Note
- Update is not currently supported.
- Only global backend services are currently supported. Regional backends not currently supported.
- Internal load balancing not currently supported.
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/gcp_backend_service_module.html