mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-07-30 00:21:33 -07:00
fix: upgrade ansible version, address test and lint errors
This commit is contained in:
parent
c15b47250d
commit
08ada5354d
216 changed files with 4394 additions and 4262 deletions
|
@ -14,8 +14,8 @@ Role Variables
|
|||
|
||||
```
|
||||
gcp_http_lb_backend: the selflink for the backend that this load balancer will be supporting
|
||||
gcp_project: the name of your gcp project
|
||||
service_account_file: the path to your service account JSON file
|
||||
gcp_http_lb_gcp_project: the name of your gcp project
|
||||
gcp_http_lb_service_account_file: the path to your service account JSON file
|
||||
```
|
||||
|
||||
Example Playbook
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
# defaults file for gcp-http-lb
|
||||
gcp_http_lb_state: present
|
||||
gcp_http_lb_cdn: true
|
||||
gcp_http_lb_name_prefix: 'gcp'
|
||||
gcp_http_lb_name_prefix: gcp
|
||||
|
||||
# Name schemes for resources being created
|
||||
gcp_http_lb_globaladdress: "{{gcp_lb_name_prefix}}-globaladdress"
|
||||
gcp_http_lb_instancegroup: "{{gcp_lb_name_prefix}}-instancegroup"
|
||||
gcp_http_lb_healthcheck: "{{gcp_lb_name_prefix}}-healthcheck"
|
||||
gcp_http_lb_backendservice: "{{gcp_lb_name_prefix}}-backendservice"
|
||||
gcp_http_lb_urlmap: "{{gcp_lb_name_prefix}}-urlmap"
|
||||
gcp_http_lb_httpproxy: "{{gcp_lb_name_prefix}}-httpproxy"
|
||||
gcp_http_lb_forwardingrule: "{{gcp_lb_name_prefix}}-forwardingrule"
|
||||
gcp_http_lb_globaladdress: "{{ gcp_lb_name_prefix }}-globaladdress"
|
||||
gcp_http_lb_instancegroup: "{{ gcp_lb_name_prefix }}-instancegroup"
|
||||
gcp_http_lb_healthcheck: "{{ gcp_lb_name_prefix }}-healthcheck"
|
||||
gcp_http_lb_backendservice: "{{ gcp_lb_name_prefix }}-backendservice"
|
||||
gcp_http_lb_urlmap: "{{ gcp_lb_name_prefix }}-urlmap"
|
||||
gcp_http_lb_httpproxy: "{{ gcp_lb_name_prefix }}-httpproxy"
|
||||
gcp_http_lb_forwardingrule: "{{ gcp_lb_name_prefix }}-forwardingrule"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
galaxy_info:
|
||||
author: googlecloudplatform
|
||||
description: Create a HTTP Load Balancer on GCP
|
||||
|
@ -16,7 +17,7 @@ galaxy_info:
|
|||
# - CC-BY
|
||||
license: GPLv3
|
||||
|
||||
min_ansible_version: 2.7
|
||||
min_ansible_version: "2.7"
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
|
@ -47,12 +48,12 @@ galaxy_info:
|
|||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
|
|
|
@ -1,65 +1,65 @@
|
|||
---
|
||||
- name: create a global address for the load balancer.
|
||||
gcp_compute_global_address:
|
||||
name: "{{ gcp_http_lb_globaladdress }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
- name: Create a global address for the load balancer.
|
||||
google.cloud.gcp_compute_global_address:
|
||||
name: "{{ gcp_http_lb_globaladdress }}"
|
||||
project: "{{ gcp_http_lb_gcp_project }}"
|
||||
auth_kind: "{{ gcp_http_lb_auth_kind }}"
|
||||
service_account_file: "{{ gcp_http_lb_service_account_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
register: globaladdress
|
||||
- name: create a http health check to verify lb working
|
||||
gcp_compute_http_health_check:
|
||||
name: "{{ gcp_http_lb_healthcheck }}"
|
||||
healthy_threshold: 10
|
||||
port: 80
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
- name: Create a http health check to verify lb working
|
||||
google.cloud.gcp_compute_http_health_check:
|
||||
name: "{{ gcp_http_lb_healthcheck }}"
|
||||
healthy_threshold: 10
|
||||
port: 80
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_http_lb_gcp_project }}"
|
||||
auth_kind: "{{ gcp_http_lb_auth_kind }}"
|
||||
service_account_file: "{{ gcp_http_lb_service_account_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: "{{ gcp_http_lb_backendservice }}"
|
||||
backends:
|
||||
- name: Create a backend service
|
||||
google.cloud.gcp_compute_backend_service:
|
||||
name: "{{ gcp_http_lb_backendservice }}"
|
||||
backends:
|
||||
- group: "{{ gcp_http_lb_backend.selfLink }}"
|
||||
health_checks:
|
||||
health_checks:
|
||||
- "{{ healthcheck.selfLink }}"
|
||||
enable_cdn: "{{ gcp_http_lb_cdn }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
enable_cdn: "{{ gcp_http_lb_cdn }}"
|
||||
project: "{{ gcp_http_lb_gcp_project }}"
|
||||
auth_kind: "{{ gcp_http_lb_auth_kind }}"
|
||||
service_account_file: "{{ gcp_http_lb_service_account_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
register: backendservice
|
||||
- name: create a url map
|
||||
gcp_compute_url_map:
|
||||
name: "{{ gcp_http_lb_urlmap }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
- name: Create a url map
|
||||
google.cloud.gcp_compute_url_map:
|
||||
name: "{{ gcp_http_lb_urlmap }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_http_lb_gcp_project }}"
|
||||
auth_kind: "{{ gcp_http_lb_auth_kind }}"
|
||||
service_account_file: "{{ gcp_http_lb_service_account_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
register: urlmap
|
||||
- name: create a target http proxy
|
||||
gcp_compute_target_http_proxy:
|
||||
name: "{{ gcp_http_lb_httpproxy }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
- name: Create a target http proxy
|
||||
google.cloud.gcp_compute_target_http_proxy:
|
||||
name: "{{ gcp_http_lb_httpproxy }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_http_lb_gcp_project }}"
|
||||
auth_kind: "{{ gcp_http_lb_auth_kind }}"
|
||||
service_account_file: "{{ gcp_http_lb_service_account_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
register: httpproxy
|
||||
- name: create a global forwarding rule
|
||||
gcp_compute_global_forwarding_rule:
|
||||
name: "{{ gcp_http_lb_forwardingrule }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
load_balancing_scheme: "EXTERNAL"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
- name: Create a global forwarding rule
|
||||
google.cloud.gcp_compute_global_forwarding_rule:
|
||||
name: "{{ gcp_http_lb_forwardingrule }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
load_balancing_scheme: EXTERNAL
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_http_lb_gcp_project }}"
|
||||
auth_kind: "{{ gcp_http_lb_auth_kind }}"
|
||||
service_account_file: "{{ gcp_http_lb_service_account_file }}"
|
||||
state: "{{ gcp_http_lb_state }}"
|
||||
register: result
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
- name: Test gcp_http_lb role
|
||||
hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- gcp_http_lb
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
# vars file for gcp-http-lb
|
||||
vars:
|
||||
# The backend this LB will be supporting. This will typically be a Instance Group:
|
||||
# example: projects/sample-project/zones/us-central1-c/instanceGroups/sample-instance-group
|
||||
gcp_http_lb_backend: your-backend
|
||||
# The name of your GCP project
|
||||
gcp_project: your-project
|
||||
# The kind of authentication you will use (serviceaccount is recommended)
|
||||
auth_kind: serviceaccount
|
||||
# The path to your service account file (if using the serviceaccount auth kind)
|
||||
service_account_file: path-to-service-account-file
|
||||
|
||||
# The backend this LB will be supporting. This will typically be a Instance Group:
|
||||
# example: projects/sample-project/zones/us-central1-c/instanceGroups/sample-instance-group
|
||||
gcp_http_lb_backend: your-backend
|
||||
# The name of your GCP project
|
||||
gcp_http_lb_gcp_project: your-project
|
||||
# The kind of authentication you will use (serviceaccount is recommended)
|
||||
gcp_http_lb_auth_kind: serviceaccount
|
||||
# The path to your service account file (if using the serviceaccount auth kind)
|
||||
gcp_http_lb_service_account_file: path-to-service-account-file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue