google.cloud.gcp_compute_network_endpoint_group – Creates a GCP NetworkEndpointGroup¶
Note
This plugin is part of the google.cloud collection (version 1.0.2).
To install it use: ansible-galaxy collection install google.cloud
.
To use it in a playbook, specify: google.cloud.gcp_compute_network_endpoint_group
.
Synopsis¶
Network endpoint groups (NEGs) are zonal resources that represent collections of IP address and port combinations for GCP resources within a single subnet. Each IP address and port combination is called a network endpoint.
Network endpoint groups can be used as backends in backend services for HTTP(S), TCP proxy, and SSL proxy load balancers. You cannot use NEGs as a backend with internal load balancers. Because NEG backends allow you to specify IP addresses and ports, you can distribute traffic in a granular fashion among applications or containers running within VM instances.
Recreating a network endpoint group that’s in use by another resource will give a resourceInUseByAnotherResource error. Use lifecycle.create_before_destroy to avoid this type of error.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.6
requests >= 2.18.4
google-auth >= 1.3.0
Parameters¶
Notes¶
Note
API Reference: https://cloud.google.com/compute/docs/reference/rest/beta/networkEndpointGroups
Official Documentation: https://cloud.google.com/load-balancing/docs/negs/
for authentication, you can set service_account_file using the
gcp_service_account_file
env variable.for authentication, you can set service_account_contents using the
GCP_SERVICE_ACCOUNT_CONTENTS
env variable.For authentication, you can set service_account_email using the
GCP_SERVICE_ACCOUNT_EMAIL
env variable.For authentication, you can set auth_kind using the
GCP_AUTH_KIND
env variable.For authentication, you can set scopes using the
GCP_SCOPES
env variable.Environment variables values will only be used if the playbook values are not set.
The service_account_email and service_account_file options are mutually exclusive.
Examples¶
- name: create a network
google.cloud.gcp_compute_network:
name: "{{ resource_name }}"
auto_create_subnetworks: 'false'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: create a subnetwork
google.cloud.gcp_compute_subnetwork:
name: "{{ resource_name }}"
ip_cidr_range: 10.0.0.0/16
region: us-central1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: subnetwork
- name: create a network endpoint group
google.cloud.gcp_compute_network_endpoint_group:
name: test_object
network: "{{ network }}"
subnetwork: "{{ subnetwork }}"
default_port: 90
zone: us-central1-a
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Google Inc. (@googlecloudplatform)