Bug fixes for GCP modules (#53882)

This commit is contained in:
The Magician 2019-03-15 12:43:00 -07:00 committed by ansibot
parent b25a37bb38
commit 204ae88491
20 changed files with 486 additions and 560 deletions

View file

@ -76,26 +76,26 @@ notes:
EXAMPLES = '''
- name: create a instance
gcp_spanner_instance:
name: "instance-database"
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instance-database
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instance
- name: create a database
gcp_spanner_database:
name: webstore
instance: "{{ instance }}"
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: webstore
instance: "{{ instance }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''

View file

@ -52,12 +52,13 @@ extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: a database facts
- name: " a database facts"
gcp_spanner_database_facts:
instance: "{{ instance }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
instance: "{{ instance }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: facts
'''
RETURN = '''

View file

@ -85,16 +85,16 @@ notes:
EXAMPLES = '''
- name: create a instance
gcp_spanner_instance:
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''

View file

@ -44,11 +44,12 @@ extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: a instance facts
- name: " a instance facts"
gcp_spanner_instance_facts:
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: facts
'''
RETURN = '''

View file

@ -74,29 +74,29 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: create a instance
gcp_sql_instance:
name: "{{resource_name}}-3"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{resource_name}}-3"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instance
- name: create a database
gcp_sql_database:
name: "test_object"
charset: utf8
instance: "{{ instance }}"
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: test_object
charset: utf8
instance: "{{ instance }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''

View file

@ -52,12 +52,13 @@ extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: a database facts
- name: " a database facts"
gcp_sql_database_facts:
instance: "{{ instance }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
instance: "{{ instance }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: facts
'''
RETURN = '''

View file

@ -82,13 +82,6 @@ options:
to Second Generation instances.
required: false
suboptions:
available:
description:
- The availability status of the failover replica. A false status indicates
that the failover replica is out of sync. The master can only failover to
the failover replica when the status is true.
required: false
type: bool
name:
description:
- The name of the failover replica. If specified at instance creation, a failover
@ -286,31 +279,24 @@ options:
description:
- Define the backup start time in UTC (HH:MM) .
required: false
settings_version:
description:
- The version of instance settings. This is a required field for update method
to make sure concurrent updates are handled properly. During update, use
the most recent settingsVersion value for this instance and do not try to
update this value.
required: false
extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: create a instance
gcp_sql_instance:
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''
@ -624,7 +610,7 @@ def main():
backend_type=dict(type='str', choices=['FIRST_GEN', 'SECOND_GEN', 'EXTERNAL']),
connection_name=dict(type='str'),
database_version=dict(type='str', choices=['MYSQL_5_5', 'MYSQL_5_6', 'MYSQL_5_7', 'POSTGRES_9_6']),
failover_replica=dict(type='dict', options=dict(available=dict(type='bool'), name=dict(type='str'))),
failover_replica=dict(type='dict', options=dict(name=dict(type='str'))),
instance_type=dict(type='str', choices=['CLOUD_SQL_INSTANCE', 'ON_PREMISES_INSTANCE', 'READ_REPLICA_INSTANCE']),
ipv6_address=dict(type='str'),
master_instance_name=dict(type='str'),
@ -672,7 +658,6 @@ def main():
backup_configuration=dict(
type='dict', options=dict(enabled=dict(type='bool'), binary_log_enabled=dict(type='bool'), start_time=dict(type='str'))
),
settings_version=dict(type='int'),
),
),
)

View file

@ -44,11 +44,12 @@ extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: a instance facts
- name: " a instance facts"
gcp_sql_instance_facts:
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: facts
'''
RETURN = '''

View file

@ -75,30 +75,30 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: create a instance
gcp_sql_instance:
name: "{{resource_name}}-1"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{resource_name}}-1"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instance
- name: create a user
gcp_sql_user:
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''

View file

@ -52,12 +52,13 @@ extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: a user facts
- name: " a user facts"
gcp_sql_user_facts:
instance: "{{ instance }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
instance: "{{ instance }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: facts
'''
RETURN = '''

View file

@ -65,14 +65,6 @@ options:
string Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket
task and then set this bucket field to "{{ name-of-resource }}"'
required: true
domain:
description:
- The domain associated with the entity.
required: false
email:
description:
- The email address associated with the entity.
required: false
entity:
description:
- 'The entity holding the permission, in one of the following forms: user-userId
@ -87,10 +79,6 @@ options:
description:
- The ID for the entity.
required: false
id:
description:
- The ID of the access-control entry.
required: false
project_team:
description:
- The project team associated with the entity.
@ -156,14 +144,6 @@ options:
string Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket
task and then set this bucket field to "{{ name-of-resource }}"'
required: true
domain:
description:
- The domain associated with the entity.
required: false
email:
description:
- The email address associated with the entity.
required: false
entity:
description:
- 'The entity holding the permission, in one of the following forms: * user-{{userId}}
@ -172,39 +152,10 @@ options:
(such as "domain-example.com") * project-team-{{projectId}} * allUsers *
allAuthenticatedUsers .'
required: true
entity_id:
description:
- The ID for the entity.
required: false
generation:
description:
- The content generation of the object, if applied to an object.
required: false
id:
description:
- The ID of the access-control entry.
required: false
object:
description:
- The name of the object, if applied to an object.
required: false
project_team:
description:
- The project team associated with the entity.
required: false
suboptions:
project_number:
description:
- The project team associated with the entity.
required: false
team:
description:
- The team.
required: false
choices:
- editors
- owners
- viewers
role:
description:
- The access permission for the entity.
@ -313,10 +264,6 @@ options:
description:
- The entity, in the form project-owner-projectId.
required: false
entity_id:
description:
- The ID for the entity.
required: false
storage_class:
description:
- The bucket's default storage class, used whenever no storageClass is specified
@ -394,11 +341,11 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: create a bucket
gcp_storage_bucket:
name: ansible-storage-module
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: ansible-storage-module
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''
@ -794,11 +741,8 @@ def main():
elements='dict',
options=dict(
bucket=dict(required=True),
domain=dict(type='str'),
email=dict(type='str'),
entity=dict(required=True, type='str'),
entity_id=dict(type='str'),
id=dict(type='str'),
project_team=dict(
type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers']))
),
@ -820,16 +764,8 @@ def main():
elements='dict',
options=dict(
bucket=dict(required=True),
domain=dict(type='str'),
email=dict(type='str'),
entity=dict(required=True, type='str'),
entity_id=dict(type='str'),
generation=dict(type='int'),
id=dict(type='str'),
object=dict(type='str'),
project_team=dict(
type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers']))
),
role=dict(required=True, type='str', choices=['OWNER', 'READER']),
),
),
@ -861,7 +797,7 @@ def main():
logging=dict(type='dict', options=dict(log_bucket=dict(type='str'), log_object_prefix=dict(type='str'))),
metageneration=dict(type='int'),
name=dict(type='str'),
owner=dict(type='dict', options=dict(entity=dict(type='str'), entity_id=dict(type='str'))),
owner=dict(type='dict', options=dict(entity=dict(type='str'))),
storage_class=dict(type='str', choices=['MULTI_REGIONAL', 'REGIONAL', 'STANDARD', 'NEARLINE', 'COLDLINE', 'DURABLE_REDUCED_AVAILABILITY']),
versioning=dict(type='dict', options=dict(enabled=dict(type='bool'))),
website=dict(type='dict', options=dict(main_page_suffix=dict(type='str'), not_found_page=dict(type='str'))),

View file

@ -108,22 +108,22 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: create a bucket
gcp_storage_bucket:
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: bucket
- name: create a bucket access control
gcp_storage_bucket_access_control:
bucket: "test_object"
entity: user-alexstephen@google.com
role: WRITER
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
bucket: test_object
entity: user-alexstephen@google.com
role: WRITER
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''

View file

@ -78,15 +78,15 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: create a object
gcp_storage_object:
name: ansible-storage-module
action: download
bucket: ansible-bucket
src: modules.zip
dest: "~/modules.zip"
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: ansible-storage-module
action: download
bucket: ansible-bucket
src: modules.zip
dest: "~/modules.zip"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''

View file

@ -15,34 +15,34 @@
# Pre-test setup
- name: create a instance
gcp_spanner_instance:
name: "instance-database"
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instance-database
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instance
- name: delete a database
gcp_spanner_database:
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a database
gcp_spanner_database:
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -64,12 +64,12 @@
# ----------------------------------------------------------------------------
- name: create a database that already exists
gcp_spanner_database:
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -78,12 +78,12 @@
#----------------------------------------------------------
- name: delete a database
gcp_spanner_database:
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -105,12 +105,12 @@
# ----------------------------------------------------------------------------
- name: delete a database that does not exist
gcp_spanner_database:
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -121,15 +121,15 @@
# If errors happen, don't crash the playbook!
- name: delete a instance
gcp_spanner_instance:
name: "instance-database"
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instance-database
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instance
ignore_errors: true

View file

@ -15,29 +15,29 @@
# Pre-test setup
- name: delete a instance
gcp_spanner_instance:
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a instance
gcp_spanner_instance:
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -58,16 +58,16 @@
# ----------------------------------------------------------------------------
- name: create a instance that already exists
gcp_spanner_instance:
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -76,16 +76,16 @@
#----------------------------------------------------------
- name: delete a instance
gcp_spanner_instance:
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -106,16 +106,16 @@
# ----------------------------------------------------------------------------
- name: delete a instance that does not exist
gcp_spanner_instance:
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: testinstance
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -15,38 +15,38 @@
# Pre-test setup
- name: create a instance
gcp_sql_instance:
name: "{{resource_name}}-3"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{resource_name}}-3"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instance
- name: delete a database
gcp_sql_database:
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a database
gcp_sql_database:
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -69,13 +69,13 @@
# ----------------------------------------------------------------------------
- name: create a database that already exists
gcp_sql_database:
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -85,13 +85,13 @@
#----------------------------------------------------------
- name: delete a database
gcp_sql_database:
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -114,13 +114,13 @@
# ----------------------------------------------------------------------------
- name: delete a database that does not exist
gcp_sql_database:
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -132,17 +132,17 @@
# If errors happen, don't crash the playbook!
- name: delete a instance
gcp_sql_instance:
name: "{{resource_name}}-3"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{resource_name}}-3"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instance
ignore_errors: true

View file

@ -15,33 +15,33 @@
# Pre-test setup
- name: delete a instance
gcp_sql_instance:
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a instance
gcp_sql_instance:
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -63,18 +63,18 @@
# ----------------------------------------------------------------------------
- name: create a instance that already exists
gcp_sql_instance:
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -84,18 +84,18 @@
#----------------------------------------------------------
- name: delete a instance
gcp_sql_instance:
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -117,18 +117,18 @@
# ----------------------------------------------------------------------------
- name: delete a instance that does not exist
gcp_sql_instance:
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -15,40 +15,40 @@
# Pre-test setup
- name: create a instance
gcp_sql_instance:
name: "{{resource_name}}-1"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{resource_name}}-1"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instance
- name: delete a user
gcp_sql_user:
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a user
gcp_sql_user:
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -71,14 +71,14 @@
# ----------------------------------------------------------------------------
- name: create a user that already exists
gcp_sql_user:
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -88,14 +88,14 @@
#----------------------------------------------------------
- name: delete a user
gcp_sql_user:
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -118,14 +118,14 @@
# ----------------------------------------------------------------------------
- name: delete a user that does not exist
gcp_sql_user:
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-user
host: 10.1.2.3
password: secret-password
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -137,17 +137,17 @@
# If errors happen, don't crash the playbook!
- name: delete a instance
gcp_sql_instance:
name: "{{resource_name}}-1"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{resource_name}}-1"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instance
ignore_errors: true

View file

@ -15,19 +15,19 @@
# Pre-test setup
- name: delete a bucket
gcp_storage_bucket:
name: ansible-storage-module
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: ansible-storage-module
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a bucket
gcp_storage_bucket:
name: ansible-storage-module
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: ansible-storage-module
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -37,11 +37,11 @@
# ----------------------------------------------------------------------------
- name: create a bucket that already exists
gcp_storage_bucket:
name: ansible-storage-module
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: ansible-storage-module
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -51,11 +51,11 @@
#----------------------------------------------------------
- name: delete a bucket
gcp_storage_bucket:
name: ansible-storage-module
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: ansible-storage-module
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -65,11 +65,11 @@
# ----------------------------------------------------------------------------
- name: delete a bucket that does not exist
gcp_storage_bucket:
name: ansible-storage-module
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: ansible-storage-module
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -15,31 +15,31 @@
# Pre-test setup
- name: create a bucket
gcp_storage_bucket:
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: bucket
- name: delete a bucket access control
gcp_storage_bucket_access_control:
bucket: "{{ resource_name }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
bucket: "{{ resource_name }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a bucket access control
gcp_storage_bucket_access_control:
bucket: "{{ resource_name }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
bucket: "{{ resource_name }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -49,13 +49,13 @@
# ----------------------------------------------------------------------------
- name: create a bucket access control that already exists
gcp_storage_bucket_access_control:
bucket: "{{ resource_name }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
bucket: "{{ resource_name }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -65,13 +65,13 @@
#----------------------------------------------------------
- name: delete a bucket access control
gcp_storage_bucket_access_control:
bucket: "{{ resource_name }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
bucket: "{{ resource_name }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -81,13 +81,13 @@
# ----------------------------------------------------------------------------
- name: delete a bucket access control that does not exist
gcp_storage_bucket_access_control:
bucket: "{{ resource_name }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
bucket: "{{ resource_name }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -99,10 +99,10 @@
# If errors happen, don't crash the playbook!
- name: delete a bucket
gcp_storage_bucket:
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: bucket
ignore_errors: true