1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Bug fixes for GCP modules (#53881)

This commit is contained in:
The Magician 2019-03-15 14:49:38 -07:00 committed by ansibot
parent b429ba61dc
commit 3a43e41b39
32 changed files with 873 additions and 705 deletions

View file

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

View file

@ -170,20 +170,6 @@ options:
Because the master endpoint is open to the Internet, you should create a
strong password.
required: false
cluster_ca_certificate:
description:
- Base64-encoded public certificate that is the root of trust for the cluster.
required: false
client_certificate:
description:
- Base64-encoded public certificate used by clients to authenticate to the
cluster endpoint.
required: false
client_key:
description:
- Base64-encoded private key used by clients to authenticate to the cluster
endpoint.
required: false
logging_service:
description:
- 'The logging service the cluster should use to write logs. Currently available
@ -210,6 +196,31 @@ options:
- The name of the Google Compute Engine network to which the cluster is connected.
If left unspecified, the default network will be used.
required: false
private_cluster_config:
description:
- Configuration for a private cluster.
required: false
version_added: 2.8
suboptions:
enable_private_nodes:
description:
- Whether nodes have internal IP addresses only. If enabled, all nodes are
given only RFC 1918 private addresses and communicate with the master via
private networking.
required: false
type: bool
enable_private_endpoint:
description:
- Whether the master's internal IP address is used as the cluster endpoint.
required: false
type: bool
master_ipv4_cidr_block:
description:
- The IP range in CIDR notation to use for the hosted master network. This
range will be used for assigning internal IP addresses to the master or
set of masters, as well as the ILB VIP. This range must not overlap with
any other ranges in use within the cluster's network.
required: false
cluster_ipv4_cidr:
description:
- The IP address range of the container pods in this cluster, in CIDR notation
@ -265,19 +276,19 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: create a cluster
gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''
@ -459,6 +470,42 @@ network:
If left unspecified, the default network will be used.
returned: success
type: str
privateClusterConfig:
description:
- Configuration for a private cluster.
returned: success
type: complex
contains:
enablePrivateNodes:
description:
- Whether nodes have internal IP addresses only. If enabled, all nodes are given
only RFC 1918 private addresses and communicate with the master via private
networking.
returned: success
type: bool
enablePrivateEndpoint:
description:
- Whether the master's internal IP address is used as the cluster endpoint.
returned: success
type: bool
masterIpv4CidrBlock:
description:
- The IP range in CIDR notation to use for the hosted master network. This range
will be used for assigning internal IP addresses to the master or set of masters,
as well as the ILB VIP. This range must not overlap with any other ranges
in use within the cluster's network.
returned: success
type: str
privateEndpoint:
description:
- The internal IP address of this cluster's master endpoint.
returned: success
type: str
publicEndpoint:
description:
- The external IP address of this cluster's master endpoint.
returned: success
type: str
clusterIpv4Cidr:
description:
- The IP address range of the container pods in this cluster, in CIDR notation (e.g.
@ -603,19 +650,14 @@ def main():
preemptible=dict(type='bool'),
),
),
master_auth=dict(
type='dict',
options=dict(
username=dict(type='str'),
password=dict(type='str'),
cluster_ca_certificate=dict(type='str'),
client_certificate=dict(type='str'),
client_key=dict(type='str'),
),
),
master_auth=dict(type='dict', options=dict(username=dict(type='str'), password=dict(type='str'))),
logging_service=dict(type='str', choices=['logging.googleapis.com', 'none']),
monitoring_service=dict(type='str', choices=['monitoring.googleapis.com', 'none']),
network=dict(type='str'),
private_cluster_config=dict(
type='dict',
options=dict(enable_private_nodes=dict(type='bool'), enable_private_endpoint=dict(type='bool'), master_ipv4_cidr_block=dict(type='str')),
),
cluster_ipv4_cidr=dict(type='str'),
addons_config=dict(
type='dict',
@ -684,6 +726,7 @@ def resource_to_request(module):
u'loggingService': module.params.get('logging_service'),
u'monitoringService': module.params.get('monitoring_service'),
u'network': module.params.get('network'),
u'privateClusterConfig': ClusterPrivateclusterconfig(module.params.get('private_cluster_config', {}), module).to_request(),
u'clusterIpv4Cidr': module.params.get('cluster_ipv4_cidr'),
u'addonsConfig': ClusterAddonsconfig(module.params.get('addons_config', {}), module).to_request(),
u'subnetwork': module.params.get('subnetwork'),
@ -761,6 +804,7 @@ def response_to_hash(module, response):
u'loggingService': response.get(u'loggingService'),
u'monitoringService': response.get(u'monitoringService'),
u'network': response.get(u'network'),
u'privateClusterConfig': ClusterPrivateclusterconfig(response.get(u'privateClusterConfig', {}), module).from_response(),
u'clusterIpv4Cidr': response.get(u'clusterIpv4Cidr'),
u'addonsConfig': ClusterAddonsconfig(response.get(u'addonsConfig', {}), module).from_response(),
u'subnetwork': response.get(u'subnetwork'),
@ -897,6 +941,37 @@ class ClusterMasterauth(object):
)
class ClusterPrivateclusterconfig(object):
def __init__(self, request, module):
self.module = module
if request:
self.request = request
else:
self.request = {}
def to_request(self):
return remove_nones_from_dict(
{
u'enablePrivateNodes': self.request.get('enable_private_nodes'),
u'enablePrivateEndpoint': self.request.get('enable_private_endpoint'),
u'masterIpv4CidrBlock': self.request.get('master_ipv4_cidr_block'),
u'privateEndpoint': self.request.get('private_endpoint'),
u'publicEndpoint': self.request.get('public_endpoint'),
}
)
def from_response(self):
return remove_nones_from_dict(
{
u'enablePrivateNodes': self.request.get(u'enablePrivateNodes'),
u'enablePrivateEndpoint': self.request.get(u'enablePrivateEndpoint'),
u'masterIpv4CidrBlock': self.request.get(u'masterIpv4CidrBlock'),
u'privateEndpoint': self.request.get(u'privateEndpoint'),
u'publicEndpoint': self.request.get(u'publicEndpoint'),
}
)
class ClusterAddonsconfig(object):
def __init__(self, request, module):
self.module = module

View file

@ -52,12 +52,13 @@ extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: a cluster facts
- name: " a cluster facts"
gcp_container_cluster_facts:
location: us-central1-a
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
location: us-central1-a
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: facts
'''
RETURN = '''
@ -245,6 +246,42 @@ items:
If left unspecified, the default network will be used.
returned: success
type: str
privateClusterConfig:
description:
- Configuration for a private cluster.
returned: success
type: complex
contains:
enablePrivateNodes:
description:
- Whether nodes have internal IP addresses only. If enabled, all nodes are
given only RFC 1918 private addresses and communicate with the master
via private networking.
returned: success
type: bool
enablePrivateEndpoint:
description:
- Whether the master's internal IP address is used as the cluster endpoint.
returned: success
type: bool
masterIpv4CidrBlock:
description:
- The IP range in CIDR notation to use for the hosted master network. This
range will be used for assigning internal IP addresses to the master or
set of masters, as well as the ILB VIP. This range must not overlap with
any other ranges in use within the cluster's network.
returned: success
type: str
privateEndpoint:
description:
- The internal IP address of this cluster's master endpoint.
returned: success
type: str
publicEndpoint:
description:
- The external IP address of this cluster's master endpoint.
returned: success
type: str
clusterIpv4Cidr:
description:
- The IP address range of the container pods in this cluster, in CIDR notation

View file

@ -144,6 +144,11 @@ options:
resource quota is sufficient for this number of instances. You must also have
available firewall and routes quota.
required: true
version:
description:
- The version of the Kubernetes of this node.
required: false
version_added: 2.8
autoscaling:
description:
- Autoscaler configuration for this NodePool. Autoscaler is enabled only if a
@ -188,17 +193,7 @@ options:
description:
- Specifies the Auto Upgrade knobs for the node pool.
required: false
suboptions:
auto_upgrade_start_time:
description:
- This field is set when upgrades are about to commence with the approximate
start time for the upgrades, in RFC3339 text format.
required: false
description:
description:
- This field is set when upgrades are about to commence with the description
of the upgrade.
required: false
suboptions: {}
cluster:
description:
- The cluster this node pool belongs to.
@ -221,25 +216,25 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: create a cluster
gcp_container_cluster:
name: "cluster-nodepool"
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: cluster-nodepool
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: cluster
- name: create a node pool
gcp_container_node_pool:
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''
@ -462,14 +457,10 @@ def main():
),
),
initial_node_count=dict(required=True, type='int'),
version=dict(type='str'),
autoscaling=dict(type='dict', options=dict(enabled=dict(type='bool'), min_node_count=dict(type='int'), max_node_count=dict(type='int'))),
management=dict(
type='dict',
options=dict(
auto_upgrade=dict(type='bool'),
auto_repair=dict(type='bool'),
upgrade_options=dict(type='dict', options=dict(auto_upgrade_start_time=dict(type='str'), description=dict(type='str'))),
),
type='dict', options=dict(auto_upgrade=dict(type='bool'), auto_repair=dict(type='bool'), upgrade_options=dict(type='dict', options=dict()))
),
cluster=dict(required=True),
location=dict(required=True, type='str', aliases=['region', 'zone']),
@ -526,6 +517,7 @@ def resource_to_request(module):
u'name': module.params.get('name'),
u'config': NodePoolConfig(module.params.get('config', {}), module).to_request(),
u'initialNodeCount': module.params.get('initial_node_count'),
u'version': module.params.get('version'),
u'autoscaling': NodePoolAutoscaling(module.params.get('autoscaling', {}), module).to_request(),
u'management': NodePoolManagement(module.params.get('management', {}), module).to_request(),
}
@ -604,7 +596,7 @@ def response_to_hash(module, response):
u'name': response.get(u'name'),
u'config': NodePoolConfig(response.get(u'config', {}), module).from_response(),
u'initialNodeCount': module.params.get('initial_node_count'),
u'version': response.get(u'version'),
u'version': module.params.get('version'),
u'autoscaling': NodePoolAutoscaling(response.get(u'autoscaling', {}), module).from_response(),
u'management': NodePoolManagement(response.get(u'management', {}), module).from_response(),
}

View file

@ -60,13 +60,14 @@ extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: a node pool facts
- name: " a node pool facts"
gcp_container_node_pool_facts:
cluster: "{{ cluster }}"
location: us-central1-a
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
cluster: "{{ cluster }}"
location: us-central1-a
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: facts
'''
RETURN = '''

View file

@ -82,13 +82,13 @@ notes:
EXAMPLES = '''
- name: create a managed zone
gcp_dns_managed_zone:
name: "test_object"
dns_name: test.somewild2.example.com.
description: test zone
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: test_object
dns_name: test.somewild2.example.com.
description: test zone
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''
@ -126,7 +126,7 @@ nameServerSet:
a set of DNS name servers that all host the same ManagedZones. Most users will
leave this field unset.
returned: success
type: list
type: str
creationTime:
description:
- The time that this resource was created on the server.
@ -161,7 +161,7 @@ def main():
description=dict(required=True, type='str'),
dns_name=dict(required=True, type='str'),
name=dict(required=True, type='str'),
name_server_set=dict(type='list', elements='str'),
name_server_set=dict(type='str'),
labels=dict(type='dict'),
)
)

View file

@ -47,12 +47,13 @@ extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: a managed zone facts
- name: " a managed zone facts"
gcp_dns_managed_zone_facts:
dns_name: test.somewild2.example.com.
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
dns_name: test.somewild2.example.com.
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: facts
'''
RETURN = '''
@ -95,7 +96,7 @@ items:
is a set of DNS name servers that all host the same ManagedZones. Most users
will leave this field unset.
returned: success
type: list
type: str
creationTime:
description:
- The time that this resource was created on the server.

View file

@ -95,28 +95,28 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: create a managed zone
gcp_dns_managed_zone:
name: "managedzone-rrs"
dns_name: testzone-4.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: managedzone-rrs
dns_name: testzone-4.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: managed_zone
- name: create a resource record set
gcp_dns_resource_record_set:
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
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 resource record set facts
- name: " a resource record set facts"
gcp_dns_resource_record_set_facts:
managed_zone: "{{ managed_zone }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
managed_zone: "{{ managed_zone }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: facts
'''
RETURN = '''

View file

@ -61,14 +61,12 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: create a service account
gcp_iam_service_account:
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"
'
display_name: My Ansible test key
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"'
display_name: My Ansible test key
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 service account facts
- name: " a service account facts"
gcp_iam_service_account_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

@ -83,23 +83,23 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: create a service account
gcp_iam_service_account:
name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: serviceaccount
- name: create a service account key
gcp_iam_service_account_key:
service_account: "{{ serviceaccount }}"
private_key_type: TYPE_GOOGLE_CREDENTIALS_FILE
path: "~/test_account.json"
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
service_account: "{{ serviceaccount }}"
private_key_type: TYPE_GOOGLE_CREDENTIALS_FILE
path: "~/test_account.json"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''

View file

@ -113,6 +113,26 @@ options:
- If the subscriber never acknowledges the message, the Pub/Sub system will eventually
redeliver the message.
required: false
message_retention_duration:
description:
- How long to retain unacknowledged messages in the subscription's backlog, from
the moment a message is published. If retainAckedMessages is true, then this
also configures the retention of acknowledged messages, and thus configures
how far back in time a subscriptions.seek can be done. Defaults to 7 days. Cannot
be more than 7 days (`"604800s"`) or less than 10 minutes (`"600s"`).
- 'A duration in seconds with up to nine fractional digits, terminated by ''s''.
Example: `"600.5s"`.'
required: false
default: 604800s
version_added: 2.8
retain_acked_messages:
description:
- Indicates whether to retain acknowledged messages. If `true`, then messages
are not expunged from the subscription's backlog, even if they are acknowledged,
until they fall out of the messageRetentionDuration window.
required: false
type: bool
version_added: 2.8
extends_documentation_fragment: gcp
notes:
- 'API Reference: U(https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions)'
@ -122,22 +142,22 @@ notes:
EXAMPLES = '''
- name: create a topic
gcp_pubsub_topic:
name: "topic-subscription"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: topic-subscription
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: topic
- name: create a subscription
gcp_pubsub_subscription:
name: "test_object"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: test_object
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''
@ -207,6 +227,24 @@ ackDeadlineSeconds:
redeliver the message.
returned: success
type: int
messageRetentionDuration:
description:
- How long to retain unacknowledged messages in the subscription's backlog, from
the moment a message is published. If retainAckedMessages is true, then this also
configures the retention of acknowledged messages, and thus configures how far
back in time a subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (`"604800s"`) or less than 10 minutes (`"600s"`).
- 'A duration in seconds with up to nine fractional digits, terminated by ''s''.
Example: `"600.5s"`.'
returned: success
type: str
retainAckedMessages:
description:
- Indicates whether to retain acknowledged messages. If `true`, then messages are
not expunged from the subscription's backlog, even if they are acknowledged, until
they fall out of the messageRetentionDuration window.
returned: success
type: bool
'''
################################################################################
@ -232,6 +270,8 @@ def main():
labels=dict(type='dict'),
push_config=dict(type='dict', options=dict(push_endpoint=dict(required=True, type='str'), attributes=dict(type='dict'))),
ack_deadline_seconds=dict(type='int'),
message_retention_duration=dict(default='604800s', type='str'),
retain_acked_messages=dict(type='bool'),
)
)
@ -286,6 +326,10 @@ def updateMask(request, response):
update_mask.append('pushConfig')
if request.get('ackDeadlineSeconds') != response.get('ackDeadlineSeconds'):
update_mask.append('ackDeadlineSeconds')
if request.get('messageRetentionDuration') != response.get('messageRetentionDuration'):
update_mask.append('messageRetentionDuration')
if request.get('retainAckedMessages') != response.get('retainAckedMessages'):
update_mask.append('retainAckedMessages')
return ','.join(update_mask)
@ -301,6 +345,8 @@ def resource_to_request(module):
u'labels': module.params.get('labels'),
u'pushConfig': SubscriptionPushconfig(module.params.get('push_config', {}), module).to_request(),
u'ackDeadlineSeconds': module.params.get('ack_deadline_seconds'),
u'messageRetentionDuration': module.params.get('message_retention_duration'),
u'retainAckedMessages': module.params.get('retain_acked_messages'),
}
request = encode_request(request, module)
return_vals = {}
@ -375,6 +421,8 @@ def response_to_hash(module, response):
u'labels': response.get(u'labels'),
u'pushConfig': SubscriptionPushconfig(response.get(u'pushConfig', {}), module).from_response(),
u'ackDeadlineSeconds': response.get(u'ackDeadlineSeconds'),
u'messageRetentionDuration': response.get(u'messageRetentionDuration'),
u'retainAckedMessages': response.get(u'retainAckedMessages'),
}

View file

@ -44,11 +44,12 @@ extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: a subscription facts
- name: " a subscription facts"
gcp_pubsub_subscription_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 = '''
@ -125,6 +126,24 @@ items:
eventually redeliver the message.
returned: success
type: int
messageRetentionDuration:
description:
- How long to retain unacknowledged messages in the subscription's backlog,
from the moment a message is published. If retainAckedMessages is true, then
this also configures the retention of acknowledged messages, and thus configures
how far back in time a subscriptions.seek can be done. Defaults to 7 days.
Cannot be more than 7 days (`"604800s"`) or less than 10 minutes (`"600s"`).
- 'A duration in seconds with up to nine fractional digits, terminated by ''s''.
Example: `"600.5s"`.'
returned: success
type: str
retainAckedMessages:
description:
- Indicates whether to retain acknowledged messages. If `true`, then messages
are not expunged from the subscription's backlog, even if they are acknowledged,
until they fall out of the messageRetentionDuration window.
returned: success
type: bool
'''
################################################################################

View file

@ -65,11 +65,11 @@ notes:
EXAMPLES = '''
- name: create a topic
gcp_pubsub_topic:
name: test-topic1
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: test-topic1
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 topic facts
- name: " a topic facts"
gcp_pubsub_topic_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

@ -123,30 +123,30 @@ notes:
EXAMPLES = '''
- name: create a network
gcp_compute_network:
name: "network-instance"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-instance
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: create a instance
gcp_redis_instance:
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''

View file

@ -48,12 +48,13 @@ extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: a instance facts
- name: " a instance facts"
gcp_redis_instance_facts:
region: us-central1
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
region: us-central1
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: facts
'''
RETURN = '''

View file

@ -90,14 +90,14 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: create a project
gcp_resourcemanager_project:
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
parent:
type: organization
id: 636173955921
state: present
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
parent:
type: organization
id: 636173955921
state: present
'''
RETURN = '''

View file

@ -44,11 +44,12 @@ extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: a project facts
- name: " a project facts"
gcp_resourcemanager_project_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

@ -62,11 +62,11 @@ notes:
EXAMPLES = '''
- name: create a repository
gcp_sourcerepo_repository:
name: projects/test_project/repos/test_object
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: projects/test_project/repos/test_object
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 repository facts
- name: " a repository facts"
gcp_sourcerepo_repository_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

@ -15,35 +15,35 @@
# Pre-test setup
- name: delete a cluster
gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a cluster
gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -65,19 +65,19 @@
# ----------------------------------------------------------------------------
- name: create a cluster that already exists
gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -86,19 +86,19 @@
#----------------------------------------------------------
- name: delete a cluster
gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -120,19 +120,19 @@
# ----------------------------------------------------------------------------
- name: delete a cluster that does not exist
gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
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,35 +15,35 @@
# Pre-test setup
- name: create a cluster
gcp_container_cluster:
name: "cluster-nodepool"
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: cluster-nodepool
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: cluster
- name: delete a node pool
gcp_container_node_pool:
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a node pool
gcp_container_node_pool:
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -66,14 +66,14 @@
# ----------------------------------------------------------------------------
- name: create a node pool that already exists
gcp_container_node_pool:
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -82,14 +82,14 @@
#----------------------------------------------------------
- name: delete a node pool
gcp_container_node_pool:
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -112,14 +112,14 @@
# ----------------------------------------------------------------------------
- name: delete a node pool that does not exist
gcp_container_node_pool:
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -130,12 +130,12 @@
# If errors happen, don't crash the playbook!
- name: delete a cluster
gcp_container_cluster:
name: "cluster-nodepool"
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: cluster-nodepool
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: cluster
ignore_errors: true

View file

@ -15,23 +15,23 @@
# Pre-test setup
- name: delete a managed zone
gcp_dns_managed_zone:
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a managed zone
gcp_dns_managed_zone:
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -54,13 +54,13 @@
# ----------------------------------------------------------------------------
- name: create a managed zone that already exists
gcp_dns_managed_zone:
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -70,13 +70,13 @@
#----------------------------------------------------------
- name: delete a managed zone
gcp_dns_managed_zone:
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -99,13 +99,13 @@
# ----------------------------------------------------------------------------
- name: delete a managed zone that does not exist
gcp_dns_managed_zone:
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
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,41 +15,41 @@
# Pre-test setup
- name: create a managed zone
gcp_dns_managed_zone:
name: "managedzone-rrs"
dns_name: testzone-4.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: managedzone-rrs
dns_name: testzone-4.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: managed_zone
- name: delete a resource record set
gcp_dns_resource_record_set:
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a resource record set
gcp_dns_resource_record_set:
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -72,17 +72,17 @@
# ----------------------------------------------------------------------------
- name: create a resource record set that already exists
gcp_dns_resource_record_set:
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -92,17 +92,17 @@
#----------------------------------------------------------
- name: delete a resource record set
gcp_dns_resource_record_set:
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -125,17 +125,17 @@
# ----------------------------------------------------------------------------
- name: delete a resource record set that does not exist
gcp_dns_resource_record_set:
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: www.testzone-4.com.
managed_zone: "{{ managed_zone }}"
type: A
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -147,12 +147,12 @@
# If errors happen, don't crash the playbook!
- name: delete a managed zone
gcp_dns_managed_zone:
name: "managedzone-rrs"
dns_name: testzone-4.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: managedzone-rrs
dns_name: testzone-4.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: managed_zone
ignore_errors: true

View file

@ -15,25 +15,21 @@
# Pre-test setup
- name: delete a service account
gcp_iam_service_account:
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"
'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a service account
gcp_iam_service_account:
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"
'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -54,14 +50,12 @@
# ----------------------------------------------------------------------------
- name: create a service account that already exists
gcp_iam_service_account:
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"
'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -70,14 +64,12 @@
#----------------------------------------------------------
- name: delete a service account
gcp_iam_service_account:
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"
'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -98,14 +90,12 @@
# ----------------------------------------------------------------------------
- name: delete a service account that does not exist
gcp_iam_service_account:
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"
'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"'
display_name: My Ansible test key
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 topic
gcp_pubsub_topic:
name: "topic-subscription"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: topic-subscription
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: topic
- name: delete a subscription
gcp_pubsub_subscription:
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a subscription
gcp_pubsub_subscription:
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -60,13 +60,13 @@
# ----------------------------------------------------------------------------
- name: create a subscription that already exists
gcp_pubsub_subscription:
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -75,13 +75,13 @@
#----------------------------------------------------------
- name: delete a subscription
gcp_pubsub_subscription:
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -102,13 +102,13 @@
# ----------------------------------------------------------------------------
- name: delete a subscription that does not exist
gcp_pubsub_subscription:
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -119,10 +119,10 @@
# If errors happen, don't crash the playbook!
- name: delete a topic
gcp_pubsub_topic:
name: "topic-subscription"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: topic-subscription
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: topic
ignore_errors: true

View file

@ -15,19 +15,19 @@
# Pre-test setup
- name: delete a topic
gcp_pubsub_topic:
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a topic
gcp_pubsub_topic:
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -48,11 +48,11 @@
# ----------------------------------------------------------------------------
- name: create a topic that already exists
gcp_pubsub_topic:
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -61,11 +61,11 @@
#----------------------------------------------------------
- name: delete a topic
gcp_pubsub_topic:
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -86,11 +86,11 @@
# ----------------------------------------------------------------------------
- name: delete a topic that does not exist
gcp_pubsub_topic:
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-topic1
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,47 +15,47 @@
# Pre-test setup
- name: create a network
gcp_compute_network:
name: "network-instance"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-instance
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: delete a instance
gcp_redis_instance:
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a instance
gcp_redis_instance:
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -77,21 +77,21 @@
# ----------------------------------------------------------------------------
- name: create a instance that already exists
gcp_redis_instance:
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -100,21 +100,21 @@
#----------------------------------------------------------
- name: delete a instance
gcp_redis_instance:
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -136,21 +136,21 @@
# ----------------------------------------------------------------------------
- name: delete a instance that does not exist
gcp_redis_instance:
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -161,10 +161,10 @@
# If errors happen, don't crash the playbook!
- name: delete a network
gcp_compute_network:
name: "network-instance"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: network-instance
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true

View file

@ -15,25 +15,25 @@
# Pre-test setup
- name: delete a project
gcp_resourcemanager_project:
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
#----------------------------------------------------------
- name: create a project
gcp_resourcemanager_project:
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: present
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: present
register: result
- name: assert changed is true
assert:
@ -54,14 +54,14 @@
# ----------------------------------------------------------------------------
- name: create a project that already exists
gcp_resourcemanager_project:
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: present
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: present
register: result
- name: assert changed is false
assert:
@ -70,14 +70,14 @@
#----------------------------------------------------------
- name: delete a project
gcp_resourcemanager_project:
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
register: result
- name: assert changed is true
assert:
@ -98,14 +98,14 @@
# ----------------------------------------------------------------------------
- name: delete a project that does not exist
gcp_resourcemanager_project:
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -15,19 +15,19 @@
# Pre-test setup
- name: delete a repository
gcp_sourcerepo_repository:
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a repository
gcp_sourcerepo_repository:
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -48,11 +48,11 @@
# ----------------------------------------------------------------------------
- name: create a repository that already exists
gcp_sourcerepo_repository:
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -61,11 +61,11 @@
#----------------------------------------------------------
- name: delete a repository
gcp_sourcerepo_repository:
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -86,11 +86,11 @@
# ----------------------------------------------------------------------------
- name: delete a repository that does not exist
gcp_sourcerepo_repository:
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert: