Bug fixes for GCP modules (#53879)

pull/53897/head
The Magician 6 years ago committed by ansibot
parent e8e69bf069
commit b429ba61dc

@ -49,13 +49,14 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a health check facts - name: " a health check facts"
gcp_compute_health_check_facts: gcp_compute_health_check_facts:
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''

@ -105,22 +105,22 @@ options:
required: false required: false
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes: notes:
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks)' - 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks)'
- 'Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)' - 'Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)'
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: create a http health check - name: create a http health check
gcp_compute_http_health_check: gcp_compute_http_health_check:
name: "test_object" name: test_object
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
''' '''
RETURN = ''' RETURN = '''

@ -49,13 +49,14 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a http health check facts - name: " a http health check facts"
gcp_compute_http_health_check_facts: gcp_compute_http_health_check_facts:
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''

@ -102,22 +102,22 @@ options:
required: false required: false
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes: notes:
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpsHealthChecks)' - 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks)'
- 'Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)' - 'Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)'
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: create a https health check - name: create a https health check
gcp_compute_https_health_check: gcp_compute_https_health_check:
name: "test_object" name: test_object
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
''' '''
RETURN = ''' RETURN = '''

@ -49,13 +49,14 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a https health check facts - name: " a https health check facts"
gcp_compute_https_health_check_facts: gcp_compute_https_health_check_facts:
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''

@ -106,11 +106,6 @@ options:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource. base64 to either encrypt or decrypt this resource.
required: false required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
labels: labels:
description: description:
- Labels to apply to this Image. - Labels to apply to this Image.
@ -173,11 +168,6 @@ options:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource. base64 to either encrypt or decrypt this resource.
required: false required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
source_disk_id: source_disk_id:
description: description:
- The ID value of the disk used to create this image. This value may be used to - The ID value of the disk used to create this image. This value may be used to
@ -193,29 +183,29 @@ options:
- RAW - RAW
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes: notes:
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/images)' - 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/images)'
- 'Official Documentation: U(https://cloud.google.com/compute/docs/images)' - 'Official Documentation: U(https://cloud.google.com/compute/docs/images)'
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: create a disk - name: create a disk
gcp_compute_disk: gcp_compute_disk:
name: "disk-image" name: disk-image
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: disk register: disk
- name: create a image - name: create a image
gcp_compute_image: gcp_compute_image:
name: "test_object" name: test_object
source_disk: "{{ disk }}" source_disk: "{{ disk }}"
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
''' '''
RETURN = ''' RETURN = '''
@ -453,7 +443,7 @@ def main():
disk_size_gb=dict(type='int'), disk_size_gb=dict(type='int'),
family=dict(type='str'), family=dict(type='str'),
guest_os_features=dict(type='list', elements='dict', options=dict(type=dict(type='str', choices=['VIRTIO_SCSI_MULTIQUEUE']))), guest_os_features=dict(type='list', elements='dict', options=dict(type=dict(type='str', choices=['VIRTIO_SCSI_MULTIQUEUE']))),
image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))),
labels=dict(type='dict'), labels=dict(type='dict'),
licenses=dict(type='list', elements='str'), licenses=dict(type='list', elements='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
@ -462,7 +452,7 @@ def main():
options=dict(container_type=dict(type='str', choices=['TAR']), sha1_checksum=dict(type='str'), source=dict(required=True, type='str')), options=dict(container_type=dict(type='str', choices=['TAR']), sha1_checksum=dict(type='str'), source=dict(required=True, type='str')),
), ),
source_disk=dict(), source_disk=dict(),
source_disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), source_disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))),
source_disk_id=dict(type='str'), source_disk_id=dict(type='str'),
source_type=dict(type='str', choices=['RAW']), source_type=dict(type='str', choices=['RAW']),
) )

@ -49,13 +49,14 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a image facts - name: " a image facts"
gcp_compute_image_facts: gcp_compute_image_facts:
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''

@ -98,11 +98,6 @@ options:
- Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied
encryption key to either encrypt or decrypt this resource. encryption key to either encrypt or decrypt this resource.
required: false required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
index: index:
description: description:
- Assigns a zero-based index to this disk, where 0 is reserved for the boot - Assigns a zero-based index to this disk, where 0 is reserved for the boot
@ -156,11 +151,6 @@ options:
- Specifies a 256-bit customer-supplied encryption key, encoded in - Specifies a 256-bit customer-supplied encryption key, encoded in
RFC 4648 base64 to either encrypt or decrypt this resource. RFC 4648 base64 to either encrypt or decrypt this resource.
required: false required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied
encryption key that protects this resource.
required: false
interface: interface:
description: description:
- Specifies the disk interface to use for attaching this disk, which is either - Specifies the disk interface to use for attaching this disk, which is either
@ -302,11 +292,6 @@ options:
from which to allocate the IP CIDR range for this alias IP range. If from which to allocate the IP CIDR range for this alias IP range. If
left unspecified, the primary range of the subnetwork will be used. left unspecified, the primary range of the subnetwork will be used.
required: false required: false
name:
description:
- The name of the network interface, generated by the server. For network
devices, these are eth0, eth1, etc .
required: false
network: network:
description: description:
- Specifies the title of an existing network. When creating an instance, if - Specifies the title of an existing network. When creating an instance, if
@ -424,57 +409,57 @@ extends_documentation_fragment: gcp
EXAMPLES = ''' EXAMPLES = '''
- name: create a disk - name: create a disk
gcp_compute_disk: gcp_compute_disk:
name: "disk-instance" name: disk-instance
size_gb: 50 size_gb: 50
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: disk register: disk
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-instance" name: network-instance
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: network register: network
- name: create a address - name: create a address
gcp_compute_address: gcp_compute_address:
name: "address-instance" name: address-instance
region: us-central1 region: us-central1
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: address register: address
- name: create a instance - name: create a instance
gcp_compute_instance: gcp_compute_instance:
name: "test_object" name: test_object
machine_type: n1-standard-1 machine_type: n1-standard-1
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
source: "{{ disk }}" source: "{{ disk }}"
metadata: metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345' cost-center: '12345'
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: External NAT - name: External NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
zone: us-central1-a zone: us-central1-a
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
''' '''
RETURN = ''' RETURN = '''
@ -902,7 +887,7 @@ def main():
auto_delete=dict(type='bool'), auto_delete=dict(type='bool'),
boot=dict(type='bool'), boot=dict(type='bool'),
device_name=dict(type='str'), device_name=dict(type='str'),
disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'), sha256=dict(type='str'))), disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'))),
index=dict(type='int'), index=dict(type='int'),
initialize_params=dict( initialize_params=dict(
type='dict', type='dict',
@ -911,7 +896,7 @@ def main():
disk_size_gb=dict(type='int'), disk_size_gb=dict(type='int'),
disk_type=dict(type='str'), disk_type=dict(type='str'),
source_image=dict(type='str', aliases=['image', 'image_family']), source_image=dict(type='str', aliases=['image', 'image_family']),
source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))),
), ),
), ),
interface=dict(type='str', choices=['SCSI', 'NVME']), interface=dict(type='str', choices=['SCSI', 'NVME']),
@ -936,7 +921,6 @@ def main():
options=dict(name=dict(required=True, type='str'), nat_ip=dict(), type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT'])), options=dict(name=dict(required=True, type='str'), nat_ip=dict(), type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT'])),
), ),
alias_ip_ranges=dict(type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str'))), alias_ip_ranges=dict(type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str'))),
name=dict(type='str'),
network=dict(), network=dict(),
network_ip=dict(type='str'), network_ip=dict(type='str'),
subnetwork=dict(), subnetwork=dict(),

@ -53,14 +53,15 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a instance facts - name: " a instance facts"
gcp_compute_instance_facts: gcp_compute_instance_facts:
zone: us-central1-a zone: us-central1-a
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''

@ -118,25 +118,25 @@ extends_documentation_fragment: gcp
EXAMPLES = ''' EXAMPLES = '''
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-instancegroup" name: network-instancegroup
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: network register: network
- name: create a instance group - name: create a instance group
gcp_compute_instance_group: gcp_compute_instance_group:
name: "test_object" name: test_object
named_ports: named_ports:
- name: ansible - name: ansible
port: 1234 port: 1234
network: "{{ network }}" network: "{{ network }}"
zone: us-central1-a zone: us-central1-a
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
''' '''
RETURN = ''' RETURN = '''

@ -53,14 +53,15 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a instance group facts - name: " a instance group facts"
gcp_compute_instance_group_facts: gcp_compute_instance_group_facts:
zone: us-central1-a zone: us-central1-a
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''

@ -117,56 +117,56 @@ extends_documentation_fragment: gcp
EXAMPLES = ''' EXAMPLES = '''
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-instancetemplate" name: network-instancetemplate
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: network register: network
- name: create a address - name: create a address
gcp_compute_address: gcp_compute_address:
name: "address-instancetemplate" name: address-instancetemplate
region: us-west1 region: us-west1
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: address register: address
- name: create a instance template - name: create a instance template
gcp_compute_instance_template: gcp_compute_instance_template:
name: "{{ resource_name }}" name: "{{ resource_name }}"
properties: properties:
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
initialize_params: initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1 machine_type: n1-standard-1
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: test-config - name: test-config
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: instancetemplate register: instancetemplate
- name: create a instance group manager - name: create a instance group manager
gcp_compute_instance_group_manager: gcp_compute_instance_group_manager:
name: "test_object" name: test_object
base_instance_name: test1-child base_instance_name: test1-child
instance_template: "{{ instancetemplate }}" instance_template: "{{ instancetemplate }}"
target_size: 3 target_size: 3
zone: us-west1-a zone: us-west1-a
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
''' '''
RETURN = ''' RETURN = '''

@ -53,14 +53,15 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a instance group manager facts - name: " a instance group manager facts"
gcp_compute_instance_group_manager_facts: gcp_compute_instance_group_manager_facts:
zone: us-west1-a zone: us-west1-a
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''

@ -123,11 +123,6 @@ options:
- Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied
encryption key to either encrypt or decrypt this resource. encryption key to either encrypt or decrypt this resource.
required: false required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied
encryption key that protects this resource.
required: false
index: index:
description: description:
- Assigns a zero-based index to this disk, where 0 is reserved for the - Assigns a zero-based index to this disk, where 0 is reserved for the
@ -179,11 +174,6 @@ options:
- Specifies a 256-bit customer-supplied encryption key, encoded - Specifies a 256-bit customer-supplied encryption key, encoded
in RFC 4648 base64 to either encrypt or decrypt this resource. in RFC 4648 base64 to either encrypt or decrypt this resource.
required: false required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied
encryption key that protects this resource.
required: false
interface: interface:
description: description:
- Specifies the disk interface to use for attaching this disk, which is - Specifies the disk interface to use for attaching this disk, which is
@ -315,11 +305,6 @@ options:
range. If left unspecified, the primary range of the subnetwork range. If left unspecified, the primary range of the subnetwork
will be used. will be used.
required: false required: false
name:
description:
- The name of the network interface, generated by the server. For network
devices, these are eth0, eth1, etc .
required: false
network: network:
description: description:
- Specifies the title of an existing network. When creating an instance, - Specifies the title of an existing network. When creating an instance,
@ -418,43 +403,43 @@ extends_documentation_fragment: gcp
EXAMPLES = ''' EXAMPLES = '''
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-instancetemplate" name: network-instancetemplate
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: network register: network
- name: create a address - name: create a address
gcp_compute_address: gcp_compute_address:
name: "address-instancetemplate" name: address-instancetemplate
region: us-west1 region: us-west1
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: address register: address
- name: create a instance template - name: create a instance template
gcp_compute_instance_template: gcp_compute_instance_template:
name: "test_object" name: test_object
properties: properties:
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
initialize_params: initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1 machine_type: n1-standard-1
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: test-config - name: test-config
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
''' '''
RETURN = ''' RETURN = '''
@ -878,9 +863,7 @@ def main():
auto_delete=dict(type='bool'), auto_delete=dict(type='bool'),
boot=dict(type='bool'), boot=dict(type='bool'),
device_name=dict(type='str'), device_name=dict(type='str'),
disk_encryption_key=dict( disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'))),
type='dict', options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'), sha256=dict(type='str'))
),
index=dict(type='int'), index=dict(type='int'),
initialize_params=dict( initialize_params=dict(
type='dict', type='dict',
@ -889,7 +872,7 @@ def main():
disk_size_gb=dict(type='int'), disk_size_gb=dict(type='int'),
disk_type=dict(type='str'), disk_type=dict(type='str'),
source_image=dict(type='str'), source_image=dict(type='str'),
source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))),
), ),
), ),
interface=dict(type='str', choices=['SCSI', 'NVME']), interface=dict(type='str', choices=['SCSI', 'NVME']),
@ -916,7 +899,6 @@ def main():
alias_ip_ranges=dict( alias_ip_ranges=dict(
type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str')) type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str'))
), ),
name=dict(type='str'),
network=dict(), network=dict(),
network_ip=dict(type='str'), network_ip=dict(type='str'),
subnetwork=dict(), subnetwork=dict(),

@ -49,13 +49,14 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a instance template facts - name: " a instance template facts"
gcp_compute_instance_template_facts: gcp_compute_instance_template_facts:
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''

@ -119,14 +119,14 @@ extends_documentation_fragment: gcp
EXAMPLES = ''' EXAMPLES = '''
- name: create a interconnect attachment - name: create a interconnect attachment
gcp_compute_interconnect_attachment: gcp_compute_interconnect_attachment:
name: "test_object" name: test_object
region: us-central1 region: us-central1
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
interconnect: https://googleapis.com/compute/v1/projects/test_project/global/interconnects/... interconnect: https://googleapis.com/compute/v1/projects/test_project/global/interconnects/...
router: https://googleapis.com/compute/v1/projects/test_project/regions/us-central1/routers/... router: https://googleapis.com/compute/v1/projects/test_project/regions/us-central1/routers/...
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
register: disk register: disk
''' '''

@ -53,14 +53,15 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a interconnect attachment facts - name: " a interconnect attachment facts"
gcp_compute_interconnect_attachment_facts: gcp_compute_interconnect_attachment_facts:
region: us-central1 region: us-central1
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''

@ -31,18 +31,7 @@ DOCUMENTATION = '''
--- ---
module: gcp_compute_network module: gcp_compute_network
description: description:
- Represents a Network resource. - Manages a VPC network or legacy network resource on GCP.
- Your Cloud Platform Console project can contain multiple networks, and each network
can have multiple instances attached to it. A network allows you to define a gateway
IP and the network range for the instances attached to that network. Every project
is provided with a default network with preset configurations and firewall rules.
You can choose to customize the default network by adding or removing rules, or
you can create new networks in that project. Generally, most users only need one
network, although you can have up to five networks per project by default.
- A network belongs to only one project, and each instance can only belong to one
network. All Compute Engine networks use the IPv4 protocol. Compute Engine currently
does not support IPv6. However, Google is a major advocate of IPv6 and it is an
important future direction.
short_description: Creates a GCP Network short_description: Creates a GCP Network
version_added: 2.6 version_added: 2.6
author: Google Inc. (@googlecloudplatform) author: Google Inc. (@googlecloudplatform)
@ -60,14 +49,18 @@ options:
default: present default: present
description: description:
description: description:
- An optional description of this resource. Provide this property when you create - An optional description of this resource. The resource must be recreated to
the resource. modify this field.
required: false required: false
ipv4_range: ipv4_range:
description: description:
- 'The range of internal addresses that are legal on this network. This range - If this field is specified, a deprecated legacy network is created.
is a CIDR specification, for example: 192.168.0.0/16. Provided by the client - You will no longer be able to create a legacy network on Feb 1, 2020.
when the network is created.' - See the [legacy network docs](U(https://cloud.google.com/vpc/docs/legacy)) for
more details.
- The range of internal addresses that are legal on this legacy network.
- 'This range is a CIDR specification, for example: `192.168.0.0/16`.'
- The resource must be recreated to modify this field.
required: false required: false
name: name:
description: description:
@ -80,10 +73,11 @@ options:
required: true required: true
auto_create_subnetworks: auto_create_subnetworks:
description: description:
- When set to true, the network is created in "auto subnet mode". When set to - When set to `true`, the network is created in "auto subnet mode" and it will
false, the network is in "custom subnet mode". create a subnet for each region automatically across the `10.128.0.0/9` address
- In "auto subnet mode", a newly created network is assigned the default CIDR range.
of 10.128.0.0/9 and it automatically creates one subnetwork per region. - When set to `false`, the network is created in "custom subnet mode" so the user
can explicitly connect subnetwork resources.
required: false required: false
type: bool type: bool
routing_config: routing_config:
@ -95,9 +89,9 @@ options:
suboptions: suboptions:
routing_mode: routing_mode:
description: description:
- The network-wide routing mode to use. If set to REGIONAL, this network's - The network-wide routing mode to use. If set to `REGIONAL`, this network's
cloud routers will only advertise routes with subnetworks of this network cloud routers will only advertise routes with subnetworks of this network
in the same region as the router. If set to GLOBAL, this network's cloud in the same region as the router. If set to `GLOBAL`, this network's cloud
routers will advertise routes with all subnetworks of this network, across routers will advertise routes with all subnetworks of this network, across
regions. regions.
required: true required: true
@ -113,26 +107,25 @@ notes:
EXAMPLES = ''' EXAMPLES = '''
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "test_object" name: test_object
auto_create_subnetworks: true auto_create_subnetworks: 'true'
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
''' '''
RETURN = ''' RETURN = '''
description: description:
description: description:
- An optional description of this resource. Provide this property when you create - An optional description of this resource. The resource must be recreated to modify
the resource. this field.
returned: success returned: success
type: str type: str
gateway_ipv4: gateway_ipv4:
description: description:
- A gateway address for default routing to other networks. This value is read only - The gateway address for default routing out of the network. This value is selected
and is selected by the Google Compute Engine, typically as the first usable address by GCP.
in the IPv4Range.
returned: success returned: success
type: str type: str
id: id:
@ -142,9 +135,13 @@ id:
type: int type: int
ipv4_range: ipv4_range:
description: description:
- 'The range of internal addresses that are legal on this network. This range is - If this field is specified, a deprecated legacy network is created.
a CIDR specification, for example: 192.168.0.0/16. Provided by the client when - You will no longer be able to create a legacy network on Feb 1, 2020.
the network is created.' - See the [legacy network docs](U(https://cloud.google.com/vpc/docs/legacy)) for
more details.
- The range of internal addresses that are legal on this legacy network.
- 'This range is a CIDR specification, for example: `192.168.0.0/16`.'
- The resource must be recreated to modify this field.
returned: success returned: success
type: str type: str
name: name:
@ -164,10 +161,10 @@ subnetworks:
type: list type: list
autoCreateSubnetworks: autoCreateSubnetworks:
description: description:
- When set to true, the network is created in "auto subnet mode". When set to false, - When set to `true`, the network is created in "auto subnet mode" and it will create
the network is in "custom subnet mode". a subnet for each region automatically across the `10.128.0.0/9` address range.
- In "auto subnet mode", a newly created network is assigned the default CIDR of - When set to `false`, the network is created in "custom subnet mode" so the user
10.128.0.0/9 and it automatically creates one subnetwork per region. can explicitly connect subnetwork resources.
returned: success returned: success
type: bool type: bool
creationTimestamp: creationTimestamp:
@ -184,10 +181,11 @@ routingConfig:
contains: contains:
routingMode: routingMode:
description: description:
- The network-wide routing mode to use. If set to REGIONAL, this network's cloud - The network-wide routing mode to use. If set to `REGIONAL`, this network's
routers will only advertise routes with subnetworks of this network in the cloud routers will only advertise routes with subnetworks of this network
same region as the router. If set to GLOBAL, this network's cloud routers in the same region as the router. If set to `GLOBAL`, this network's cloud
will advertise routes with all subnetworks of this network, across regions. routers will advertise routes with all subnetworks of this network, across
regions.
returned: success returned: success
type: str type: str
''' '''
@ -232,7 +230,7 @@ def main():
if fetch: if fetch:
if state == 'present': if state == 'present':
if is_different(module, fetch): if is_different(module, fetch):
update(module, self_link(module), kind) update(module, self_link(module), kind, fetch)
fetch = fetch_resource(module, self_link(module), kind) fetch = fetch_resource(module, self_link(module), kind)
changed = True changed = True
else: else:
@ -256,9 +254,22 @@ def create(module, link, kind):
return wait_for_operation(module, auth.post(link, resource_to_request(module))) return wait_for_operation(module, auth.post(link, resource_to_request(module)))
def update(module, link, kind): def update(module, link, kind, fetch):
update_fields(module, resource_to_request(module), response_to_hash(module, fetch))
return fetch_resource(module, self_link(module), kind)
def update_fields(module, request, response):
if response.get('routingConfig') != request.get('routingConfig'):
routing_config_update(module, request, response)
def routing_config_update(module, request, response):
auth = GcpSession(module, 'compute') auth = GcpSession(module, 'compute')
return wait_for_operation(module, auth.patch(link, resource_to_request(module))) auth.patch(
''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/networks/{name}"]).format(**module.params),
{u'routingConfig': NetworkRoutingconfig(module.params.get('routing_config', {}), module).to_request()},
)
def delete(module, link, kind): def delete(module, link, kind):

@ -49,13 +49,14 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a network facts - name: " a network facts"
gcp_compute_network_facts: gcp_compute_network_facts:
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''
@ -66,15 +67,14 @@ items:
contains: contains:
description: description:
description: description:
- An optional description of this resource. Provide this property when you create - An optional description of this resource. The resource must be recreated to
the resource. modify this field.
returned: success returned: success
type: str type: str
gateway_ipv4: gateway_ipv4:
description: description:
- A gateway address for default routing to other networks. This value is read - The gateway address for default routing out of the network. This value is
only and is selected by the Google Compute Engine, typically as the first selected by GCP.
usable address in the IPv4Range.
returned: success returned: success
type: str type: str
id: id:
@ -84,9 +84,13 @@ items:
type: int type: int
ipv4_range: ipv4_range:
description: description:
- 'The range of internal addresses that are legal on this network. This range - If this field is specified, a deprecated legacy network is created.
is a CIDR specification, for example: 192.168.0.0/16. Provided by the client - You will no longer be able to create a legacy network on Feb 1, 2020.
when the network is created.' - See the [legacy network docs](U(https://cloud.google.com/vpc/docs/legacy))
for more details.
- The range of internal addresses that are legal on this legacy network.
- 'This range is a CIDR specification, for example: `192.168.0.0/16`.'
- The resource must be recreated to modify this field.
returned: success returned: success
type: str type: str
name: name:
@ -106,10 +110,11 @@ items:
type: list type: list
autoCreateSubnetworks: autoCreateSubnetworks:
description: description:
- When set to true, the network is created in "auto subnet mode". When set to - When set to `true`, the network is created in "auto subnet mode" and it will
false, the network is in "custom subnet mode". create a subnet for each region automatically across the `10.128.0.0/9` address
- In "auto subnet mode", a newly created network is assigned the default CIDR range.
of 10.128.0.0/9 and it automatically creates one subnetwork per region. - When set to `false`, the network is created in "custom subnet mode" so the
user can explicitly connect subnetwork resources.
returned: success returned: success
type: bool type: bool
creationTimestamp: creationTimestamp:
@ -126,9 +131,9 @@ items:
contains: contains:
routingMode: routingMode:
description: description:
- The network-wide routing mode to use. If set to REGIONAL, this network's - The network-wide routing mode to use. If set to `REGIONAL`, this network's
cloud routers will only advertise routes with subnetworks of this network cloud routers will only advertise routes with subnetworks of this network
in the same region as the router. If set to GLOBAL, this network's cloud in the same region as the router. If set to `GLOBAL`, this network's cloud
routers will advertise routes with all subnetworks of this network, across routers will advertise routes with all subnetworks of this network, across
regions. regions.
returned: success returned: success

@ -88,6 +88,14 @@ options:
of sizeGb must not be less than the size of the sourceImage or the size of the of sizeGb must not be less than the size of the sourceImage or the size of the
snapshot. snapshot.
required: false required: false
physical_block_size_bytes:
description:
- Physical block size of the persistent disk, in bytes. If not present in a request,
a default value is used. Currently supported sizes are 4096 and 16384, other
sizes may be added in the future.
- If an unsupported value is requested, the error message will list the supported
values for the caller's project.
required: false
replica_zones: replica_zones:
description: description:
- URLs of the zones where the disk should be replicated to. - URLs of the zones where the disk should be replicated to.
@ -118,11 +126,6 @@ options:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource. base64 to either encrypt or decrypt this resource.
required: false required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
source_snapshot: source_snapshot:
description: description:
- The source snapshot used to create this disk. You can provide this as a partial - The source snapshot used to create this disk. You can provide this as a partial
@ -143,11 +146,6 @@ options:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource. base64 to either encrypt or decrypt this resource.
required: false required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes: notes:
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/regionDisks)' - 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/regionDisks)'
@ -157,18 +155,18 @@ notes:
EXAMPLES = ''' EXAMPLES = '''
- name: create a region disk - name: create a region disk
gcp_compute_region_disk: gcp_compute_region_disk:
name: "test_object" name: test_object
size_gb: 50 size_gb: 50
disk_encryption_key: disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1 region: us-central1
replica_zones: replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
''' '''
RETURN = ''' RETURN = '''
@ -240,6 +238,15 @@ users:
.' .'
returned: success returned: success
type: list type: list
physicalBlockSizeBytes:
description:
- Physical block size of the persistent disk, in bytes. If not present in a request,
a default value is used. Currently supported sizes are 4096 and 16384, other sizes
may be added in the future.
- If an unsupported value is requested, the error message will list the supported
values for the caller's project.
returned: success
type: int
replicaZones: replicaZones:
description: description:
- URLs of the zones where the disk should be replicated to. - URLs of the zones where the disk should be replicated to.
@ -342,12 +349,13 @@ def main():
licenses=dict(type='list', elements='str'), licenses=dict(type='list', elements='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
size_gb=dict(type='int'), size_gb=dict(type='int'),
physical_block_size_bytes=dict(type='int'),
replica_zones=dict(required=True, type='list', elements='str'), replica_zones=dict(required=True, type='list', elements='str'),
type=dict(type='str'), type=dict(type='str'),
region=dict(required=True, type='str'), region=dict(required=True, type='str'),
disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))),
source_snapshot=dict(), source_snapshot=dict(),
source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))),
) )
) )
@ -430,6 +438,7 @@ def resource_to_request(module):
u'licenses': module.params.get('licenses'), u'licenses': module.params.get('licenses'),
u'name': module.params.get('name'), u'name': module.params.get('name'),
u'sizeGb': module.params.get('size_gb'), u'sizeGb': module.params.get('size_gb'),
u'physicalBlockSizeBytes': module.params.get('physical_block_size_bytes'),
u'replicaZones': module.params.get('replica_zones'), u'replicaZones': module.params.get('replica_zones'),
u'type': region_disk_type_selflink(module.params.get('type'), module.params), u'type': region_disk_type_selflink(module.params.get('type'), module.params),
} }
@ -508,6 +517,7 @@ def response_to_hash(module, response):
u'name': module.params.get('name'), u'name': module.params.get('name'),
u'sizeGb': response.get(u'sizeGb'), u'sizeGb': response.get(u'sizeGb'),
u'users': response.get(u'users'), u'users': response.get(u'users'),
u'physicalBlockSizeBytes': response.get(u'physicalBlockSizeBytes'),
u'replicaZones': response.get(u'replicaZones'), u'replicaZones': response.get(u'replicaZones'),
u'type': response.get(u'type'), u'type': response.get(u'type'),
} }

@ -53,14 +53,15 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a region disk facts - name: " a region disk facts"
gcp_compute_region_disk_facts: gcp_compute_region_disk_facts:
region: us-central1 region: us-central1
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''
@ -137,6 +138,15 @@ items:
.' .'
returned: success returned: success
type: list type: list
physicalBlockSizeBytes:
description:
- Physical block size of the persistent disk, in bytes. If not present in a
request, a default value is used. Currently supported sizes are 4096 and 16384,
other sizes may be added in the future.
- If an unsupported value is requested, the error message will list the supported
values for the caller's project.
returned: success
type: int
replicaZones: replicaZones:
description: description:
- URLs of the zones where the disk should be replicated to. - URLs of the zones where the disk should be replicated to.

@ -142,26 +142,26 @@ notes:
EXAMPLES = ''' EXAMPLES = '''
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-route" name: network-route
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: network register: network
- name: create a route - name: create a route
gcp_compute_route: gcp_compute_route:
name: "test_object" name: test_object
dest_range: 192.168.6.0/24 dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}" network: "{{ network }}"
tags: tags:
- backends - backends
- databases - databases
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
''' '''
RETURN = ''' RETURN = '''

@ -49,13 +49,14 @@ extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: a route facts - name: " a route facts"
gcp_compute_route_facts: gcp_compute_route_facts:
filters: filters:
- name = test_object - name = test_object
project: test_project project: test_project
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: facts
''' '''
RETURN = ''' RETURN = '''

@ -15,27 +15,27 @@
# Pre-test setup # Pre-test setup
- name: delete a http health check - name: delete a http health check
gcp_compute_http_health_check: gcp_compute_http_health_check:
name: "{{ resource_name }}" name: "{{ resource_name }}"
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a http health check - name: create a http health check
gcp_compute_http_health_check: gcp_compute_http_health_check:
name: "{{ resource_name }}" name: "{{ resource_name }}"
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -59,15 +59,15 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a http health check that already exists - name: create a http health check that already exists
gcp_compute_http_health_check: gcp_compute_http_health_check:
name: "{{ resource_name }}" name: "{{ resource_name }}"
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -77,15 +77,15 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a http health check - name: delete a http health check
gcp_compute_http_health_check: gcp_compute_http_health_check:
name: "{{ resource_name }}" name: "{{ resource_name }}"
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -109,15 +109,15 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a http health check that does not exist - name: delete a http health check that does not exist
gcp_compute_http_health_check: gcp_compute_http_health_check:
name: "{{ resource_name }}" name: "{{ resource_name }}"
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:

@ -15,27 +15,27 @@
# Pre-test setup # Pre-test setup
- name: delete a https health check - name: delete a https health check
gcp_compute_https_health_check: gcp_compute_https_health_check:
name: "{{ resource_name }}" name: "{{ resource_name }}"
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a https health check - name: create a https health check
gcp_compute_https_health_check: gcp_compute_https_health_check:
name: "{{ resource_name }}" name: "{{ resource_name }}"
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -59,15 +59,15 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a https health check that already exists - name: create a https health check that already exists
gcp_compute_https_health_check: gcp_compute_https_health_check:
name: "{{ resource_name }}" name: "{{ resource_name }}"
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -77,15 +77,15 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a https health check - name: delete a https health check
gcp_compute_https_health_check: gcp_compute_https_health_check:
name: "{{ resource_name }}" name: "{{ resource_name }}"
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -109,15 +109,15 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a https health check that does not exist - name: delete a https health check that does not exist
gcp_compute_https_health_check: gcp_compute_https_health_check:
name: "{{ resource_name }}" name: "{{ resource_name }}"
healthy_threshold: 10 healthy_threshold: 10
port: 8080 port: 8080
timeout_sec: 2 timeout_sec: 2
unhealthy_threshold: 5 unhealthy_threshold: 5
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:

@ -15,30 +15,30 @@
# Pre-test setup # Pre-test setup
- name: create a disk - name: create a disk
gcp_compute_disk: gcp_compute_disk:
name: "disk-image" name: disk-image
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: disk register: disk
- name: delete a image - name: delete a image
gcp_compute_image: gcp_compute_image:
name: "{{ resource_name }}" name: "{{ resource_name }}"
source_disk: "{{ disk }}" source_disk: "{{ disk }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a image - name: create a image
gcp_compute_image: gcp_compute_image:
name: "{{ resource_name }}" name: "{{ resource_name }}"
source_disk: "{{ disk }}" source_disk: "{{ disk }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -62,12 +62,12 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a image that already exists - name: create a image that already exists
gcp_compute_image: gcp_compute_image:
name: "{{ resource_name }}" name: "{{ resource_name }}"
source_disk: "{{ disk }}" source_disk: "{{ disk }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -77,12 +77,12 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a image - name: delete a image
gcp_compute_image: gcp_compute_image:
name: "{{ resource_name }}" name: "{{ resource_name }}"
source_disk: "{{ disk }}" source_disk: "{{ disk }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -106,12 +106,12 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a image that does not exist - name: delete a image that does not exist
gcp_compute_image: gcp_compute_image:
name: "{{ resource_name }}" name: "{{ resource_name }}"
source_disk: "{{ disk }}" source_disk: "{{ disk }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -123,11 +123,11 @@
# If errors happen, don't crash the playbook! # If errors happen, don't crash the playbook!
- name: delete a disk - name: delete a disk
gcp_compute_disk: gcp_compute_disk:
name: "disk-image" name: disk-image
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: disk register: disk
ignore_errors: true ignore_errors: true

@ -15,77 +15,77 @@
# Pre-test setup # Pre-test setup
- name: create a disk - name: create a disk
gcp_compute_disk: gcp_compute_disk:
name: "disk-instance" name: disk-instance
size_gb: 50 size_gb: 50
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: disk register: disk
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-instance" name: network-instance
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: network register: network
- name: create a address - name: create a address
gcp_compute_address: gcp_compute_address:
name: "address-instance" name: address-instance
region: us-central1 region: us-central1
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: address register: address
- name: delete a instance - name: delete a instance
gcp_compute_instance: gcp_compute_instance:
name: "{{ resource_name }}" name: "{{ resource_name }}"
machine_type: n1-standard-1 machine_type: n1-standard-1
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
source: "{{ disk }}" source: "{{ disk }}"
metadata: metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345' cost-center: '12345'
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: External NAT - name: External NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a instance - name: create a instance
gcp_compute_instance: gcp_compute_instance:
name: "{{ resource_name }}" name: "{{ resource_name }}"
machine_type: n1-standard-1 machine_type: n1-standard-1
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
source: "{{ disk }}" source: "{{ disk }}"
metadata: metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345' cost-center: '12345'
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: External NAT - name: External NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -110,26 +110,26 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a instance that already exists - name: create a instance that already exists
gcp_compute_instance: gcp_compute_instance:
name: "{{ resource_name }}" name: "{{ resource_name }}"
machine_type: n1-standard-1 machine_type: n1-standard-1
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
source: "{{ disk }}" source: "{{ disk }}"
metadata: metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345' cost-center: '12345'
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: External NAT - name: External NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -139,26 +139,26 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a instance - name: delete a instance
gcp_compute_instance: gcp_compute_instance:
name: "{{ resource_name }}" name: "{{ resource_name }}"
machine_type: n1-standard-1 machine_type: n1-standard-1
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
source: "{{ disk }}" source: "{{ disk }}"
metadata: metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345' cost-center: '12345'
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: External NAT - name: External NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -183,26 +183,26 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a instance that does not exist - name: delete a instance that does not exist
gcp_compute_instance: gcp_compute_instance:
name: "{{ resource_name }}" name: "{{ resource_name }}"
machine_type: n1-standard-1 machine_type: n1-standard-1
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
source: "{{ disk }}" source: "{{ disk }}"
metadata: metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345' cost-center: '12345'
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: External NAT - name: External NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -214,32 +214,32 @@
# If errors happen, don't crash the playbook! # If errors happen, don't crash the playbook!
- name: delete a address - name: delete a address
gcp_compute_address: gcp_compute_address:
name: "address-instance" name: address-instance
region: us-central1 region: us-central1
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: address register: address
ignore_errors: true ignore_errors: true
- name: delete a network - name: delete a network
gcp_compute_network: gcp_compute_network:
name: "network-instance" name: network-instance
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: network register: network
ignore_errors: true ignore_errors: true
- name: delete a disk - name: delete a disk
gcp_compute_disk: gcp_compute_disk:
name: "disk-instance" name: disk-instance
size_gb: 50 size_gb: 50
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: disk register: disk
ignore_errors: true ignore_errors: true

@ -15,37 +15,37 @@
# Pre-test setup # Pre-test setup
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-instancegroup" name: network-instancegroup
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: network register: network
- name: delete a instance group - name: delete a instance group
gcp_compute_instance_group: gcp_compute_instance_group:
name: "{{ resource_name }}" name: "{{ resource_name }}"
named_ports: named_ports:
- name: ansible - name: ansible
port: 1234 port: 1234
network: "{{ network }}" network: "{{ network }}"
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a instance group - name: create a instance group
gcp_compute_instance_group: gcp_compute_instance_group:
name: "{{ resource_name }}" name: "{{ resource_name }}"
named_ports: named_ports:
- name: ansible - name: ansible
port: 1234 port: 1234
network: "{{ network }}" network: "{{ network }}"
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -70,16 +70,16 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a instance group that already exists - name: create a instance group that already exists
gcp_compute_instance_group: gcp_compute_instance_group:
name: "{{ resource_name }}" name: "{{ resource_name }}"
named_ports: named_ports:
- name: ansible - name: ansible
port: 1234 port: 1234
network: "{{ network }}" network: "{{ network }}"
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -89,16 +89,16 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a instance group - name: delete a instance group
gcp_compute_instance_group: gcp_compute_instance_group:
name: "{{ resource_name }}" name: "{{ resource_name }}"
named_ports: named_ports:
- name: ansible - name: ansible
port: 1234 port: 1234
network: "{{ network }}" network: "{{ network }}"
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -123,16 +123,16 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a instance group that does not exist - name: delete a instance group that does not exist
gcp_compute_instance_group: gcp_compute_instance_group:
name: "{{ resource_name }}" name: "{{ resource_name }}"
named_ports: named_ports:
- name: ansible - name: ansible
port: 1234 port: 1234
network: "{{ network }}" network: "{{ network }}"
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -144,10 +144,10 @@
# If errors happen, don't crash the playbook! # If errors happen, don't crash the playbook!
- name: delete a network - name: delete a network
gcp_compute_network: gcp_compute_network:
name: "network-instancegroup" name: network-instancegroup
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: network register: network
ignore_errors: true ignore_errors: true

@ -15,65 +15,65 @@
# Pre-test setup # Pre-test setup
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-instancetemplate" name: network-instancetemplate
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: network register: network
- name: create a address - name: create a address
gcp_compute_address: gcp_compute_address:
name: "address-instancetemplate" name: address-instancetemplate
region: us-west1 region: us-west1
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: address register: address
- name: create a instance template - name: create a instance template
gcp_compute_instance_template: gcp_compute_instance_template:
name: "{{ resource_name }}" name: "{{ resource_name }}"
properties: properties:
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
initialize_params: initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1 machine_type: n1-standard-1
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: test-config - name: test-config
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: instancetemplate register: instancetemplate
- name: delete a instance group manager - name: delete a instance group manager
gcp_compute_instance_group_manager: gcp_compute_instance_group_manager:
name: "{{ resource_name }}" name: "{{ resource_name }}"
base_instance_name: test1-child base_instance_name: test1-child
instance_template: "{{ instancetemplate }}" instance_template: "{{ instancetemplate }}"
target_size: 3 target_size: 3
zone: us-west1-a zone: us-west1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a instance group manager - name: create a instance group manager
gcp_compute_instance_group_manager: gcp_compute_instance_group_manager:
name: "{{ resource_name }}" name: "{{ resource_name }}"
base_instance_name: test1-child base_instance_name: test1-child
instance_template: "{{ instancetemplate }}" instance_template: "{{ instancetemplate }}"
target_size: 3 target_size: 3
zone: us-west1-a zone: us-west1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -98,15 +98,15 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a instance group manager that already exists - name: create a instance group manager that already exists
gcp_compute_instance_group_manager: gcp_compute_instance_group_manager:
name: "{{ resource_name }}" name: "{{ resource_name }}"
base_instance_name: test1-child base_instance_name: test1-child
instance_template: "{{ instancetemplate }}" instance_template: "{{ instancetemplate }}"
target_size: 3 target_size: 3
zone: us-west1-a zone: us-west1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -116,15 +116,15 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a instance group manager - name: delete a instance group manager
gcp_compute_instance_group_manager: gcp_compute_instance_group_manager:
name: "{{ resource_name }}" name: "{{ resource_name }}"
base_instance_name: test1-child base_instance_name: test1-child
instance_template: "{{ instancetemplate }}" instance_template: "{{ instancetemplate }}"
target_size: 3 target_size: 3
zone: us-west1-a zone: us-west1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -149,15 +149,15 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a instance group manager that does not exist - name: delete a instance group manager that does not exist
gcp_compute_instance_group_manager: gcp_compute_instance_group_manager:
name: "{{ resource_name }}" name: "{{ resource_name }}"
base_instance_name: test1-child base_instance_name: test1-child
instance_template: "{{ instancetemplate }}" instance_template: "{{ instancetemplate }}"
target_size: 3 target_size: 3
zone: us-west1-a zone: us-west1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -169,42 +169,42 @@
# If errors happen, don't crash the playbook! # If errors happen, don't crash the playbook!
- name: delete a instance template - name: delete a instance template
gcp_compute_instance_template: gcp_compute_instance_template:
name: "{{ resource_name }}" name: "{{ resource_name }}"
properties: properties:
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
initialize_params: initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1 machine_type: n1-standard-1
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: test-config - name: test-config
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: instancetemplate register: instancetemplate
ignore_errors: true ignore_errors: true
- name: delete a address - name: delete a address
gcp_compute_address: gcp_compute_address:
name: "address-instancetemplate" name: address-instancetemplate
region: us-west1 region: us-west1
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: address register: address
ignore_errors: true ignore_errors: true
- name: delete a network - name: delete a network
gcp_compute_network: gcp_compute_network:
name: "network-instancetemplate" name: network-instancetemplate
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: network register: network
ignore_errors: true ignore_errors: true

@ -15,62 +15,62 @@
# Pre-test setup # Pre-test setup
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-instancetemplate" name: network-instancetemplate
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: network register: network
- name: create a address - name: create a address
gcp_compute_address: gcp_compute_address:
name: "address-instancetemplate" name: address-instancetemplate
region: us-west1 region: us-west1
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: address register: address
- name: delete a instance template - name: delete a instance template
gcp_compute_instance_template: gcp_compute_instance_template:
name: "{{ resource_name }}" name: "{{ resource_name }}"
properties: properties:
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
initialize_params: initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1 machine_type: n1-standard-1
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: test-config - name: test-config
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a instance template - name: create a instance template
gcp_compute_instance_template: gcp_compute_instance_template:
name: "{{ resource_name }}" name: "{{ resource_name }}"
properties: properties:
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
initialize_params: initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1 machine_type: n1-standard-1
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: test-config - name: test-config
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -94,24 +94,24 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a instance template that already exists - name: create a instance template that already exists
gcp_compute_instance_template: gcp_compute_instance_template:
name: "{{ resource_name }}" name: "{{ resource_name }}"
properties: properties:
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
initialize_params: initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1 machine_type: n1-standard-1
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: test-config - name: test-config
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -121,24 +121,24 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a instance template - name: delete a instance template
gcp_compute_instance_template: gcp_compute_instance_template:
name: "{{ resource_name }}" name: "{{ resource_name }}"
properties: properties:
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
initialize_params: initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1 machine_type: n1-standard-1
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: test-config - name: test-config
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -162,24 +162,24 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a instance template that does not exist - name: delete a instance template that does not exist
gcp_compute_instance_template: gcp_compute_instance_template:
name: "{{ resource_name }}" name: "{{ resource_name }}"
properties: properties:
disks: disks:
- auto_delete: true - auto_delete: 'true'
boot: true boot: 'true'
initialize_params: initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1 machine_type: n1-standard-1
network_interfaces: network_interfaces:
- network: "{{ network }}" - network: "{{ network }}"
access_configs: access_configs:
- name: test-config - name: test-config
type: ONE_TO_ONE_NAT type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}" nat_ip: "{{ address }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -191,20 +191,20 @@
# If errors happen, don't crash the playbook! # If errors happen, don't crash the playbook!
- name: delete a address - name: delete a address
gcp_compute_address: gcp_compute_address:
name: "address-instancetemplate" name: address-instancetemplate
region: us-west1 region: us-west1
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: address register: address
ignore_errors: true ignore_errors: true
- name: delete a network - name: delete a network
gcp_compute_network: gcp_compute_network:
name: "network-instancetemplate" name: network-instancetemplate
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: network register: network
ignore_errors: true ignore_errors: true

@ -15,21 +15,21 @@
# Pre-test setup # Pre-test setup
- name: delete a network - name: delete a network
gcp_compute_network: gcp_compute_network:
name: "{{ resource_name }}" name: "{{ resource_name }}"
auto_create_subnetworks: true auto_create_subnetworks: 'true'
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "{{ resource_name }}" name: "{{ resource_name }}"
auto_create_subnetworks: true auto_create_subnetworks: 'true'
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -53,12 +53,12 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a network that already exists - name: create a network that already exists
gcp_compute_network: gcp_compute_network:
name: "{{ resource_name }}" name: "{{ resource_name }}"
auto_create_subnetworks: true auto_create_subnetworks: 'true'
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -68,12 +68,12 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a network - name: delete a network
gcp_compute_network: gcp_compute_network:
name: "{{ resource_name }}" name: "{{ resource_name }}"
auto_create_subnetworks: true auto_create_subnetworks: 'true'
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -97,12 +97,12 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a network that does not exist - name: delete a network that does not exist
gcp_compute_network: gcp_compute_network:
name: "{{ resource_name }}" name: "{{ resource_name }}"
auto_create_subnetworks: true auto_create_subnetworks: 'true'
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:

@ -15,33 +15,33 @@
# Pre-test setup # Pre-test setup
- name: delete a region disk - name: delete a region disk
gcp_compute_region_disk: gcp_compute_region_disk:
name: "{{ resource_name }}" name: "{{ resource_name }}"
size_gb: 50 size_gb: 50
disk_encryption_key: disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1 region: us-central1
replica_zones: replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a region disk - name: create a region disk
gcp_compute_region_disk: gcp_compute_region_disk:
name: "{{ resource_name }}" name: "{{ resource_name }}"
size_gb: 50 size_gb: 50
disk_encryption_key: disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1 region: us-central1
replica_zones: replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -66,18 +66,18 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a region disk that already exists - name: create a region disk that already exists
gcp_compute_region_disk: gcp_compute_region_disk:
name: "{{ resource_name }}" name: "{{ resource_name }}"
size_gb: 50 size_gb: 50
disk_encryption_key: disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1 region: us-central1
replica_zones: replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -87,18 +87,18 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a region disk - name: delete a region disk
gcp_compute_region_disk: gcp_compute_region_disk:
name: "{{ resource_name }}" name: "{{ resource_name }}"
size_gb: 50 size_gb: 50
disk_encryption_key: disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1 region: us-central1
replica_zones: replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -123,18 +123,18 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a region disk that does not exist - name: delete a region disk that does not exist
gcp_compute_region_disk: gcp_compute_region_disk:
name: "{{ resource_name }}" name: "{{ resource_name }}"
size_gb: 50 size_gb: 50
disk_encryption_key: disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1 region: us-central1
replica_zones: replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:

@ -15,39 +15,39 @@
# Pre-test setup # Pre-test setup
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-route" name: network-route
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: network register: network
- name: delete a route - name: delete a route
gcp_compute_route: gcp_compute_route:
name: "{{ resource_name }}" name: "{{ resource_name }}"
dest_range: 192.168.6.0/24 dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}" network: "{{ network }}"
tags: tags:
- backends - backends
- databases - databases
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a route - name: create a route
gcp_compute_route: gcp_compute_route:
name: "{{ resource_name }}" name: "{{ resource_name }}"
dest_range: 192.168.6.0/24 dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}" network: "{{ network }}"
tags: tags:
- backends - backends
- databases - databases
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -71,17 +71,17 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a route that already exists - name: create a route that already exists
gcp_compute_route: gcp_compute_route:
name: "{{ resource_name }}" name: "{{ resource_name }}"
dest_range: 192.168.6.0/24 dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}" network: "{{ network }}"
tags: tags:
- backends - backends
- databases - databases
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -91,17 +91,17 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a route - name: delete a route
gcp_compute_route: gcp_compute_route:
name: "{{ resource_name }}" name: "{{ resource_name }}"
dest_range: 192.168.6.0/24 dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}" network: "{{ network }}"
tags: tags:
- backends - backends
- databases - databases
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
assert: assert:
@ -125,17 +125,17 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a route that does not exist - name: delete a route that does not exist
gcp_compute_route: gcp_compute_route:
name: "{{ resource_name }}" name: "{{ resource_name }}"
dest_range: 192.168.6.0/24 dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}" network: "{{ network }}"
tags: tags:
- backends - backends
- databases - databases
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false
assert: assert:
@ -147,10 +147,10 @@
# If errors happen, don't crash the playbook! # If errors happen, don't crash the playbook!
- name: delete a network - name: delete a network
gcp_compute_network: gcp_compute_network:
name: "network-route" name: network-route
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: network register: network
ignore_errors: true ignore_errors: true

Loading…
Cancel
Save