mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-09 04:10:27 -07:00
The Last of the Facts Modules
<!-- This change is generated by MagicModules. --> /cc @rambleraptor
This commit is contained in:
parent
6f1eb02314
commit
748132a695
18 changed files with 1195 additions and 1210 deletions
|
@ -276,7 +276,7 @@ extends_documentation_fragment: gcp
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: create a cluster
|
- name: create a cluster
|
||||||
gcp_container_cluster:
|
gcp_container_cluster:
|
||||||
name: "test_object"
|
name: my-cluster
|
||||||
initial_node_count: 2
|
initial_node_count: 2
|
||||||
master_auth:
|
master_auth:
|
||||||
username: cluster_admin
|
username: cluster_admin
|
||||||
|
|
|
@ -18,375 +18,338 @@
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Documentation
|
# Documentation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
|
'status': ["preview"],
|
||||||
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: gcp_container_cluster_facts
|
module: gcp_container_cluster_facts
|
||||||
description:
|
description:
|
||||||
- Gather facts for GCP Cluster
|
- Gather facts for GCP Cluster
|
||||||
short_description: Gather facts for GCP Cluster
|
short_description: Gather facts for GCP Cluster
|
||||||
version_added: 2.8
|
version_added: 2.8
|
||||||
author: Google Inc. (@googlecloudplatform)
|
author: Google Inc. (@googlecloudplatform)
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
- requests >= 2.18.4
|
- requests >= 2.18.4
|
||||||
- google-auth >= 1.3.0
|
- google-auth >= 1.3.0
|
||||||
options:
|
options:
|
||||||
location:
|
zone:
|
||||||
description:
|
description:
|
||||||
- The location where the cluster is deployed.
|
- The zone where the cluster is deployed.
|
||||||
required: true
|
required: true
|
||||||
aliases:
|
|
||||||
- region
|
|
||||||
- zone
|
|
||||||
version_added: 2.8
|
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: " a cluster facts"
|
- name: a cluster facts
|
||||||
gcp_container_cluster_facts:
|
gcp_container_cluster_facts:
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: test_project
|
project: test_project
|
||||||
auth_kind: serviceaccount
|
auth_kind: serviceaccount
|
||||||
service_account_file: "/tmp/auth.pem"
|
service_account_file: "/tmp/auth.pem"
|
||||||
state: facts
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
items:
|
items:
|
||||||
description: List of items
|
description: List of items
|
||||||
returned: always
|
returned: always
|
||||||
type: complex
|
type: complex
|
||||||
contains:
|
contains:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The name of this cluster. The name must be unique within this project and
|
- The name of this cluster. The name must be unique within this project and zone,
|
||||||
location, and can be up to 40 characters. Must be Lowercase letters, numbers,
|
and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens
|
||||||
and hyphens only. Must start with a letter. Must end with a number or a letter.
|
only. Must start with a letter. Must end with a number or a letter.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
description:
|
description:
|
||||||
- An optional description of this cluster.
|
- An optional description of this cluster.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
initialNodeCount:
|
initialNodeCount:
|
||||||
description:
|
description:
|
||||||
- The number of nodes to create in this cluster. You must ensure that your Compute
|
- The number of nodes to create in this cluster. You must ensure that your Compute
|
||||||
Engine resource quota is sufficient for this number of instances. You must
|
Engine resource quota is sufficient for this number of instances. You must also
|
||||||
also have available firewall and routes quota. For requests, this field should
|
have available firewall and routes quota. For requests, this field should only be
|
||||||
only be used in lieu of a "nodePool" object, since this configuration (along
|
used in lieu of a "nodePool" object, since this configuration (along with the "nodeConfig")
|
||||||
with the "nodeConfig") will be used to create a "NodePool" object with an
|
will be used to create a "NodePool" object with an auto-generated name. Do not use
|
||||||
auto-generated name. Do not use this and a nodePool at the same time.
|
this and a nodePool at the same time.
|
||||||
returned: success
|
returned: success
|
||||||
type: int
|
type: int
|
||||||
nodeConfig:
|
nodeConfig:
|
||||||
description:
|
description:
|
||||||
- Parameters used in creating the cluster's nodes.
|
- Parameters used in creating the cluster's nodes.
|
||||||
- For requests, this field should only be used in lieu of a "nodePool" object,
|
- For requests, this field should only be used in lieu of a "nodePool" object, since
|
||||||
since this configuration (along with the "initialNodeCount") will be used
|
this configuration (along with the "initialNodeCount") will be used to create a
|
||||||
to create a "NodePool" object with an auto-generated name. Do not use this
|
"NodePool" object with an auto-generated name. Do not use this and a nodePool at
|
||||||
and a nodePool at the same time. For responses, this field will be populated
|
the same time. For responses, this field will be populated with the node configuration
|
||||||
with the node configuration of the first node pool. If unspecified, the defaults
|
of the first node pool. If unspecified, the defaults are used.
|
||||||
are used.
|
returned: success
|
||||||
returned: success
|
type: complex
|
||||||
type: complex
|
contains:
|
||||||
contains:
|
machineType:
|
||||||
machineType:
|
description:
|
||||||
description:
|
- The name of a Google Compute Engine machine type (e.g.
|
||||||
- The name of a Google Compute Engine machine type (e.g.
|
- n1-standard-1). If unspecified, the default machine type is n1-standard-1.
|
||||||
- n1-standard-1). If unspecified, the default machine type is n1-standard-1.
|
returned: success
|
||||||
returned: success
|
type: str
|
||||||
type: str
|
diskSizeGb:
|
||||||
diskSizeGb:
|
description:
|
||||||
description:
|
- Size of the disk attached to each node, specified in GB. The smallest allowed disk
|
||||||
- Size of the disk attached to each node, specified in GB. The smallest
|
size is 10GB. If unspecified, the default disk size is 100GB.
|
||||||
allowed disk size is 10GB. If unspecified, the default disk size is 100GB.
|
returned: success
|
||||||
returned: success
|
type: int
|
||||||
type: int
|
oauthScopes:
|
||||||
oauthScopes:
|
description:
|
||||||
description:
|
- The set of Google API scopes to be made available on all of the node VMs under the
|
||||||
- The set of Google API scopes to be made available on all of the node VMs
|
"default" service account.
|
||||||
under the "default" service account.
|
- 'The following scopes are recommended, but not required, and by default are not
|
||||||
- 'The following scopes are recommended, but not required, and by default
|
included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent
|
||||||
are not included: U(https://www.googleapis.com/auth/compute) is required
|
storage on your nodes.'
|
||||||
for mounting persistent storage on your nodes.'
|
- U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating
|
||||||
- U(https://www.googleapis.com/auth/devstorage.read_only) is required for
|
with gcr.io (the Google Container Registry).
|
||||||
communicating with gcr.io (the Google Container Registry).
|
- If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are
|
||||||
- If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring
|
enabled, in which case their required scopes will be added.
|
||||||
are enabled, in which case their required scopes will be added.
|
returned: success
|
||||||
returned: success
|
type: list
|
||||||
type: list
|
serviceAccount:
|
||||||
serviceAccount:
|
description:
|
||||||
description:
|
- The Google Cloud Platform Service Account to be used by the node VMs. If no Service
|
||||||
- The Google Cloud Platform Service Account to be used by the node VMs.
|
Account is specified, the "default" service account is used.
|
||||||
If no Service Account is specified, the "default" service account is used.
|
returned: success
|
||||||
returned: success
|
type: str
|
||||||
type: str
|
metadata:
|
||||||
metadata:
|
description:
|
||||||
description:
|
- The metadata key/value pairs assigned to instances in the cluster.
|
||||||
- The metadata key/value pairs assigned to instances in the cluster.
|
- 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length.
|
||||||
- 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes
|
These are reflected as part of a URL in the metadata server. Additionally, to avoid
|
||||||
in length. These are reflected as part of a URL in the metadata server.
|
ambiguity, keys must not conflict with any other metadata keys for the project or
|
||||||
Additionally, to avoid ambiguity, keys must not conflict with any other
|
be one of the four reserved keys: "instance-template", "kube-env", "startup-script",
|
||||||
metadata keys for the project or be one of the four reserved keys: "instance-template",
|
and "user-data" Values are free-form strings, and only have meaning as interpreted
|
||||||
"kube-env", "startup-script", and "user-data" Values are free-form strings,
|
by the image running in the instance. The only restriction placed on them is that
|
||||||
and only have meaning as interpreted by the image running in the instance.
|
each value''s size must be less than or equal to 32 KB.'
|
||||||
The only restriction placed on them is that each value''s size must be
|
- The total size of all keys and values must be less than 512 KB.
|
||||||
less than or equal to 32 KB.'
|
- 'An object containing a list of "key": value pairs.'
|
||||||
- The total size of all keys and values must be less than 512 KB.
|
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
|
||||||
- 'An object containing a list of "key": value pairs.'
|
returned: success
|
||||||
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
|
type: dict
|
||||||
returned: success
|
imageType:
|
||||||
type: dict
|
description:
|
||||||
imageType:
|
- The image type to use for this node. Note that for a given image type, the latest
|
||||||
description:
|
version of it will be used.
|
||||||
- The image type to use for this node. Note that for a given image type,
|
returned: success
|
||||||
the latest version of it will be used.
|
type: str
|
||||||
returned: success
|
labels:
|
||||||
type: str
|
description:
|
||||||
labels:
|
- 'The map of Kubernetes labels (key/value pairs) to be applied to each node.
|
||||||
description:
|
These will added in addition to any default label(s) that Kubernetes may apply
|
||||||
- 'The map of Kubernetes labels (key/value pairs) to be applied to each
|
to the node. In case of conflict in label keys, the applied set may differ
|
||||||
node. These will added in addition to any default label(s) that Kubernetes
|
depending on the Kubernetes version -- it''s best to assume the behavior is
|
||||||
may apply to the node. In case of conflict in label keys, the applied
|
undefined and conflicts should be avoided. For more information, including
|
||||||
set may differ depending on the Kubernetes version -- it''s best to assume
|
usage and the valid values, see:
|
||||||
the behavior is undefined and conflicts should be avoided. For more information,
|
U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object containing
|
||||||
including usage and the valid values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html)
|
a list of "key": value pairs.'
|
||||||
An object containing a list of "key": value pairs.'
|
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
|
||||||
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
|
returned: success
|
||||||
returned: success
|
type: dict
|
||||||
type: dict
|
localSsdCount:
|
||||||
localSsdCount:
|
description:
|
||||||
description:
|
- The number of local SSD disks to be attached to the node.
|
||||||
- The number of local SSD disks to be attached to the node.
|
- 'The limit for this value is dependant upon the maximum number of disks available
|
||||||
- 'The limit for this value is dependant upon the maximum number of disks
|
on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for
|
||||||
available on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits)
|
more information.'
|
||||||
for more information.'
|
returned: success
|
||||||
returned: success
|
type: int
|
||||||
type: int
|
tags:
|
||||||
tags:
|
description:
|
||||||
description:
|
- The list of instance tags applied to all nodes. Tags are used to identify valid
|
||||||
- The list of instance tags applied to all nodes. Tags are used to identify
|
sources or targets for network firewalls and are specified by the client during
|
||||||
valid sources or targets for network firewalls and are specified by the
|
cluster or node pool creation. Each tag within the list must comply with RFC1035.
|
||||||
client during cluster or node pool creation. Each tag within the list
|
returned: success
|
||||||
must comply with RFC1035.
|
type: list
|
||||||
returned: success
|
preemptible:
|
||||||
type: list
|
description:
|
||||||
preemptible:
|
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
|
||||||
description:
|
for more inforamtion about preemptible VM instances.'
|
||||||
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
|
returned: success
|
||||||
for more information about preemptible VM instances.'
|
type: bool
|
||||||
returned: success
|
masterAuth:
|
||||||
type: bool
|
description:
|
||||||
masterAuth:
|
- The authentication information for accessing the master endpoint.
|
||||||
description:
|
returned: success
|
||||||
- The authentication information for accessing the master endpoint.
|
type: complex
|
||||||
returned: success
|
contains:
|
||||||
type: complex
|
username:
|
||||||
contains:
|
description:
|
||||||
username:
|
- The username to use for HTTP basic authentication to the master endpoint.
|
||||||
description:
|
returned: success
|
||||||
- The username to use for HTTP basic authentication to the master endpoint.
|
type: str
|
||||||
returned: success
|
password:
|
||||||
type: str
|
description:
|
||||||
password:
|
- The password to use for HTTP basic authentication to the master endpoint. Because
|
||||||
description:
|
the master endpoint is open to the Internet, you should create a strong password.
|
||||||
- The password to use for HTTP basic authentication to the master endpoint.
|
returned: success
|
||||||
Because the master endpoint is open to the Internet, you should create
|
type: str
|
||||||
a strong password.
|
clusterCaCertificate:
|
||||||
returned: success
|
description:
|
||||||
type: str
|
- Base64-encoded public certificate that is the root of trust for the cluster.
|
||||||
clusterCaCertificate:
|
returned: success
|
||||||
description:
|
type: str
|
||||||
- Base64-encoded public certificate that is the root of trust for the cluster.
|
clientCertificate:
|
||||||
returned: success
|
description:
|
||||||
type: str
|
- Base64-encoded public certificate used by clients to authenticate to the cluster
|
||||||
clientCertificate:
|
endpoint.
|
||||||
description:
|
returned: success
|
||||||
- Base64-encoded public certificate used by clients to authenticate to the
|
type: str
|
||||||
cluster endpoint.
|
clientKey:
|
||||||
returned: success
|
description:
|
||||||
type: str
|
- Base64-encoded private key used by clients to authenticate to the cluster endpoint.
|
||||||
clientKey:
|
returned: success
|
||||||
description:
|
type: str
|
||||||
- Base64-encoded private key used by clients to authenticate to the cluster
|
loggingService:
|
||||||
endpoint.
|
description:
|
||||||
returned: success
|
- 'The logging service the cluster should use to write logs. Currently available options: logging.googleapis.com
|
||||||
type: str
|
- the Google Cloud Logging service.'
|
||||||
loggingService:
|
- none - no logs will be exported from the cluster.
|
||||||
description:
|
- if left as an empty string,logging.googleapis.com will be used.
|
||||||
- 'The logging service the cluster should use to write logs. Currently available
|
returned: success
|
||||||
options: logging.googleapis.com - the Google Cloud Logging service.'
|
type: str
|
||||||
- none - no logs will be exported from the cluster.
|
monitoringService:
|
||||||
- if left as an empty string,logging.googleapis.com will be used.
|
description:
|
||||||
returned: success
|
- The monitoring service the cluster should use to write metrics.
|
||||||
type: str
|
- 'Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring
|
||||||
monitoringService:
|
service.'
|
||||||
description:
|
- none - no metrics will be exported from the cluster.
|
||||||
- The monitoring service the cluster should use to write metrics.
|
- if left as an empty string, monitoring.googleapis.com will be used.
|
||||||
- 'Currently available options: monitoring.googleapis.com - the Google Cloud
|
returned: success
|
||||||
Monitoring service.'
|
type: str
|
||||||
- none - no metrics will be exported from the cluster.
|
network:
|
||||||
- if left as an empty string, monitoring.googleapis.com will be used.
|
description:
|
||||||
returned: success
|
- The name of the Google Compute Engine network to which the cluster is connected.
|
||||||
type: str
|
If left unspecified, the default network will be used.
|
||||||
network:
|
- To ensure it exists and it is operations, configure the network using 'gcompute_network'
|
||||||
description:
|
resource.
|
||||||
- The name of the Google Compute Engine network to which the cluster is connected.
|
returned: success
|
||||||
If left unspecified, the default network will be used.
|
type: str
|
||||||
returned: success
|
clusterIpv4Cidr:
|
||||||
type: str
|
description:
|
||||||
privateClusterConfig:
|
- The IP address range of the container pods in this cluster, in CIDR notation (e.g.
|
||||||
description:
|
10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block
|
||||||
- Configuration for a private cluster.
|
in 10.0.0.0/8.
|
||||||
returned: success
|
returned: success
|
||||||
type: complex
|
type: str
|
||||||
contains:
|
addonsConfig:
|
||||||
enablePrivateNodes:
|
description:
|
||||||
description:
|
- Configurations for the various addons available to run in the cluster.
|
||||||
- Whether nodes have internal IP addresses only. If enabled, all nodes are
|
returned: success
|
||||||
given only RFC 1918 private addresses and communicate with the master
|
type: complex
|
||||||
via private networking.
|
contains:
|
||||||
returned: success
|
httpLoadBalancing:
|
||||||
type: bool
|
description:
|
||||||
enablePrivateEndpoint:
|
- Configuration for the HTTP (L7) load balancing controller addon, which makes it
|
||||||
description:
|
easy to set up HTTP load balancers for services in a cluster.
|
||||||
- Whether the master's internal IP address is used as the cluster endpoint.
|
returned: success
|
||||||
returned: success
|
type: complex
|
||||||
type: bool
|
contains:
|
||||||
masterIpv4CidrBlock:
|
disabled:
|
||||||
description:
|
description:
|
||||||
- The IP range in CIDR notation to use for the hosted master network. This
|
- Whether the HTTP Load Balancing controller is enabled in the cluster. When enabled,
|
||||||
range will be used for assigning internal IP addresses to the master or
|
it runs a small pod in the cluster that manages the load balancers.
|
||||||
set of masters, as well as the ILB VIP. This range must not overlap with
|
returned: success
|
||||||
any other ranges in use within the cluster's network.
|
type: bool
|
||||||
returned: success
|
horizontalPodAutoscaling:
|
||||||
type: str
|
description:
|
||||||
privateEndpoint:
|
- Configuration for the horizontal pod autoscaling feature, which increases or decreases
|
||||||
description:
|
the number of replica pods a replication controller has based on the resource usage
|
||||||
- The internal IP address of this cluster's master endpoint.
|
of the existing pods.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: complex
|
||||||
publicEndpoint:
|
contains:
|
||||||
description:
|
disabled:
|
||||||
- The external IP address of this cluster's master endpoint.
|
description:
|
||||||
returned: success
|
- Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. When enabled,
|
||||||
type: str
|
it ensures that a Heapster pod is running in the cluster, which is also used by
|
||||||
clusterIpv4Cidr:
|
the Cloud Monitoring service.
|
||||||
description:
|
returned: success
|
||||||
- The IP address range of the container pods in this cluster, in CIDR notation
|
type: bool
|
||||||
(e.g. 10.96.0.0/14). Leave blank to have one automatically chosen or specify
|
subnetwork:
|
||||||
a /14 block in 10.0.0.0/8.
|
description:
|
||||||
returned: success
|
- The name of the Google Compute Engine subnetwork to which the cluster is connected.
|
||||||
type: str
|
returned: success
|
||||||
addonsConfig:
|
type: str
|
||||||
description:
|
location:
|
||||||
- Configurations for the various addons available to run in the cluster.
|
description:
|
||||||
returned: success
|
- The list of Google Compute Engine locations in which the cluster's nodes should
|
||||||
type: complex
|
be located.
|
||||||
contains:
|
returned: success
|
||||||
httpLoadBalancing:
|
type: list
|
||||||
description:
|
endpoint:
|
||||||
- Configuration for the HTTP (L7) load balancing controller addon, which
|
description:
|
||||||
makes it easy to set up HTTP load balancers for services in a cluster.
|
- The IP address of this cluster's master endpoint.
|
||||||
returned: success
|
- The endpoint can be accessed from the internet at https://username:password@endpoint/ See
|
||||||
type: complex
|
the masterAuth property of this resource for username and password information.
|
||||||
contains:
|
returned: success
|
||||||
disabled:
|
type: str
|
||||||
description:
|
initialClusterVersion:
|
||||||
- Whether the HTTP Load Balancing controller is enabled in the cluster.
|
description:
|
||||||
When enabled, it runs a small pod in the cluster that manages the
|
- The software version of the master endpoint and kubelets used in the cluster when
|
||||||
load balancers.
|
it was first created. The version can be upgraded over time.
|
||||||
returned: success
|
returned: success
|
||||||
type: bool
|
type: str
|
||||||
horizontalPodAutoscaling:
|
currentMasterVersion:
|
||||||
description:
|
description:
|
||||||
- Configuration for the horizontal pod autoscaling feature, which increases
|
- The current software version of the master endpoint.
|
||||||
or decreases the number of replica pods a replication controller has based
|
returned: success
|
||||||
on the resource usage of the existing pods.
|
type: str
|
||||||
returned: success
|
currentNodeVersion:
|
||||||
type: complex
|
description:
|
||||||
contains:
|
- The current version of the node software components. If they are currently at multiple
|
||||||
disabled:
|
versions because they're in the process of being upgraded, this reflects the minimum
|
||||||
description:
|
version of all nodes.
|
||||||
- Whether the Horizontal Pod Autoscaling feature is enabled in the cluster.
|
returned: success
|
||||||
When enabled, it ensures that a Heapster pod is running in the cluster,
|
type: str
|
||||||
which is also used by the Cloud Monitoring service.
|
createTime:
|
||||||
returned: success
|
description:
|
||||||
type: bool
|
- The time the cluster was created, in RFC3339 text format.
|
||||||
subnetwork:
|
returned: success
|
||||||
description:
|
type: str
|
||||||
- The name of the Google Compute Engine subnetwork to which the cluster is connected.
|
nodeIpv4CidrSize:
|
||||||
returned: success
|
description:
|
||||||
type: str
|
- The size of the address space on each node for hosting containers.
|
||||||
endpoint:
|
- This is provisioned from within the container_ipv4_cidr range.
|
||||||
description:
|
returned: success
|
||||||
- The IP address of this cluster's master endpoint.
|
type: int
|
||||||
- The endpoint can be accessed from the internet at https://username:password@endpoint/
|
servicesIpv4Cidr:
|
||||||
See the masterAuth property of this resource for username and password information.
|
description:
|
||||||
returned: success
|
- The IP address range of the Kubernetes services in this cluster, in CIDR notation
|
||||||
type: str
|
(e.g. 1.2.3.4/29). Service addresses are typically put in the last /16 from the
|
||||||
initialClusterVersion:
|
container CIDR.
|
||||||
description:
|
returned: success
|
||||||
- The software version of the master endpoint and kubelets used in the cluster
|
type: str
|
||||||
when it was first created. The version can be upgraded over time.
|
currentNodeCount:
|
||||||
returned: success
|
description:
|
||||||
type: str
|
- The number of nodes currently in the cluster.
|
||||||
currentMasterVersion:
|
returned: success
|
||||||
description:
|
type: int
|
||||||
- The current software version of the master endpoint.
|
expireTime:
|
||||||
returned: success
|
description:
|
||||||
type: str
|
- The time the cluster will be automatically deleted in RFC3339 text format.
|
||||||
currentNodeVersion:
|
returned: success
|
||||||
description:
|
type: str
|
||||||
- The current version of the node software components. If they are currently
|
zone:
|
||||||
at multiple versions because they're in the process of being upgraded, this
|
description:
|
||||||
reflects the minimum version of all nodes.
|
- The zone where the cluster is deployed.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
createTime:
|
|
||||||
description:
|
|
||||||
- The time the cluster was created, in RFC3339 text format.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
nodeIpv4CidrSize:
|
|
||||||
description:
|
|
||||||
- The size of the address space on each node for hosting containers.
|
|
||||||
- This is provisioned from within the container_ipv4_cidr range.
|
|
||||||
returned: success
|
|
||||||
type: int
|
|
||||||
servicesIpv4Cidr:
|
|
||||||
description:
|
|
||||||
- The IP address range of the Kubernetes services in this cluster, in CIDR notation
|
|
||||||
(e.g. 1.2.3.4/29). Service addresses are typically put in the last /16 from
|
|
||||||
the container CIDR.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
currentNodeCount:
|
|
||||||
description:
|
|
||||||
- The number of nodes currently in the cluster.
|
|
||||||
returned: success
|
|
||||||
type: int
|
|
||||||
expireTime:
|
|
||||||
description:
|
|
||||||
- The time the cluster will be automatically deleted in RFC3339 text format.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
location:
|
|
||||||
description:
|
|
||||||
- The location where the cluster is deployed.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -401,9 +364,13 @@ import json
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone'])))
|
module = GcpModule(
|
||||||
|
argument_spec=dict(
|
||||||
|
zone=dict(required=True, type='str')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if not module.params['scopes']:
|
if 'scopes' not in module.params:
|
||||||
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
|
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
|
||||||
|
|
||||||
items = fetch_list(module, collection(module))
|
items = fetch_list(module, collection(module))
|
||||||
|
@ -411,12 +378,14 @@ def main():
|
||||||
items = items.get('clusters')
|
items = items.get('clusters')
|
||||||
else:
|
else:
|
||||||
items = []
|
items = []
|
||||||
return_value = {'items': items}
|
return_value = {
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
module.exit_json(**return_value)
|
module.exit_json(**return_value)
|
||||||
|
|
||||||
|
|
||||||
def collection(module):
|
def collection(module):
|
||||||
return "https://container.googleapis.com/v1/projects/{project}/locations/{location}/clusters".format(**module.params)
|
return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters".format(**module.params)
|
||||||
|
|
||||||
|
|
||||||
def fetch_list(module, link):
|
def fetch_list(module, link):
|
||||||
|
|
|
@ -226,7 +226,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
- name: create a node pool
|
- name: create a node pool
|
||||||
gcp_container_node_pool:
|
gcp_container_node_pool:
|
||||||
name: "test_object"
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
zone: us-central1-a
|
||||||
|
|
|
@ -18,247 +18,241 @@
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Documentation
|
# Documentation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
|
'status': ["preview"],
|
||||||
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: gcp_container_node_pool_facts
|
module: gcp_container_node_pool_facts
|
||||||
description:
|
description:
|
||||||
- Gather facts for GCP NodePool
|
- Gather facts for GCP NodePool
|
||||||
short_description: Gather facts for GCP NodePool
|
short_description: Gather facts for GCP NodePool
|
||||||
version_added: 2.8
|
version_added: 2.8
|
||||||
author: Google Inc. (@googlecloudplatform)
|
author: Google Inc. (@googlecloudplatform)
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
- requests >= 2.18.4
|
- requests >= 2.18.4
|
||||||
- google-auth >= 1.3.0
|
- google-auth >= 1.3.0
|
||||||
options:
|
options:
|
||||||
location:
|
zone:
|
||||||
description:
|
description:
|
||||||
- The location where the node pool is deployed.
|
- The zone where the node pool is deployed.
|
||||||
required: true
|
required: true
|
||||||
aliases:
|
cluster:
|
||||||
- region
|
description:
|
||||||
- zone
|
- The cluster this node pool belongs to.
|
||||||
version_added: 2.8
|
- 'This field represents a link to a Cluster resource in GCP. It can be specified
|
||||||
cluster:
|
in two ways. You can add `register: name-of-resource` to a gcp_container_cluster
|
||||||
description:
|
task and then set this cluster field to "{{ name-of-resource }}" Alternatively,
|
||||||
- The cluster this node pool belongs to.
|
you can set this cluster to a dictionary with the name key where the value is the
|
||||||
- 'This field represents a link to a Cluster resource in GCP. It can be specified
|
name of your Cluster.'
|
||||||
in two ways. First, you can place a dictionary with key ''name'' and value of
|
required: true
|
||||||
your resource''s name Alternatively, you can add `register: name-of-resource`
|
|
||||||
to a gcp_container_cluster task and then set this cluster field to "{{ name-of-resource
|
|
||||||
}}"'
|
|
||||||
required: true
|
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: " a node pool facts"
|
- name: a node pool facts
|
||||||
gcp_container_node_pool_facts:
|
gcp_container_node_pool_facts:
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: test_project
|
project: test_project
|
||||||
auth_kind: serviceaccount
|
auth_kind: serviceaccount
|
||||||
service_account_file: "/tmp/auth.pem"
|
service_account_file: "/tmp/auth.pem"
|
||||||
state: facts
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
items:
|
items:
|
||||||
description: List of items
|
description: List of items
|
||||||
returned: always
|
returned: always
|
||||||
type: complex
|
type: complex
|
||||||
contains:
|
contains:
|
||||||
name:
|
name:
|
||||||
description:
|
|
||||||
- The name of the node pool.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
config:
|
|
||||||
description:
|
|
||||||
- The node configuration of the pool.
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
contains:
|
|
||||||
machineType:
|
|
||||||
description:
|
|
||||||
- The name of a Google Compute Engine machine type (e.g.
|
|
||||||
- n1-standard-1). If unspecified, the default machine type is n1-standard-1.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
diskSizeGb:
|
|
||||||
description:
|
|
||||||
- Size of the disk attached to each node, specified in GB. The smallest
|
|
||||||
allowed disk size is 10GB. If unspecified, the default disk size is 100GB.
|
|
||||||
returned: success
|
|
||||||
type: int
|
|
||||||
oauthScopes:
|
|
||||||
description:
|
|
||||||
- The set of Google API scopes to be made available on all of the node VMs
|
|
||||||
under the "default" service account.
|
|
||||||
- 'The following scopes are recommended, but not required, and by default
|
|
||||||
are not included: U(https://www.googleapis.com/auth/compute) is required
|
|
||||||
for mounting persistent storage on your nodes.'
|
|
||||||
- U(https://www.googleapis.com/auth/devstorage.read_only) is required for
|
|
||||||
communicating with gcr.io (the Google Container Registry).
|
|
||||||
- If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring
|
|
||||||
are enabled, in which case their required scopes will be added.
|
|
||||||
returned: success
|
|
||||||
type: list
|
|
||||||
serviceAccount:
|
|
||||||
description:
|
|
||||||
- The Google Cloud Platform Service Account to be used by the node VMs.
|
|
||||||
If no Service Account is specified, the "default" service account is used.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
metadata:
|
|
||||||
description:
|
|
||||||
- The metadata key/value pairs assigned to instances in the cluster.
|
|
||||||
- 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes
|
|
||||||
in length. These are reflected as part of a URL in the metadata server.
|
|
||||||
Additionally, to avoid ambiguity, keys must not conflict with any other
|
|
||||||
metadata keys for the project or be one of the four reserved keys: "instance-template",
|
|
||||||
"kube-env", "startup-script", and "user-data" Values are free-form strings,
|
|
||||||
and only have meaning as interpreted by the image running in the instance.
|
|
||||||
The only restriction placed on them is that each value''s size must be
|
|
||||||
less than or equal to 32 KB.'
|
|
||||||
- The total size of all keys and values must be less than 512 KB.
|
|
||||||
- 'An object containing a list of "key": value pairs.'
|
|
||||||
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
|
|
||||||
returned: success
|
|
||||||
type: dict
|
|
||||||
imageType:
|
|
||||||
description:
|
|
||||||
- The image type to use for this node. Note that for a given image type,
|
|
||||||
the latest version of it will be used.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
labels:
|
|
||||||
description:
|
|
||||||
- 'The map of Kubernetes labels (key/value pairs) to be applied to each
|
|
||||||
node. These will added in addition to any default label(s) that Kubernetes
|
|
||||||
may apply to the node. In case of conflict in label keys, the applied
|
|
||||||
set may differ depending on the Kubernetes version -- it''s best to assume
|
|
||||||
the behavior is undefined and conflicts should be avoided. For more information,
|
|
||||||
including usage and the valid values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html)
|
|
||||||
An object containing a list of "key": value pairs.'
|
|
||||||
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
|
|
||||||
returned: success
|
|
||||||
type: dict
|
|
||||||
localSsdCount:
|
|
||||||
description:
|
|
||||||
- The number of local SSD disks to be attached to the node.
|
|
||||||
- 'The limit for this value is dependant upon the maximum number of disks
|
|
||||||
available on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits)
|
|
||||||
for more information.'
|
|
||||||
returned: success
|
|
||||||
type: int
|
|
||||||
tags:
|
|
||||||
description:
|
|
||||||
- The list of instance tags applied to all nodes. Tags are used to identify
|
|
||||||
valid sources or targets for network firewalls and are specified by the
|
|
||||||
client during cluster or node pool creation. Each tag within the list
|
|
||||||
must comply with RFC1035.
|
|
||||||
returned: success
|
|
||||||
type: list
|
|
||||||
preemptible:
|
|
||||||
description:
|
|
||||||
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
|
|
||||||
for more information about preemptible VM instances.'
|
|
||||||
returned: success
|
|
||||||
type: bool
|
|
||||||
initialNodeCount:
|
|
||||||
description:
|
|
||||||
- The initial node count for the pool. You must ensure that your Compute Engine
|
|
||||||
resource quota is sufficient for this number of instances. You must also have
|
|
||||||
available firewall and routes quota.
|
|
||||||
returned: success
|
|
||||||
type: int
|
|
||||||
version:
|
|
||||||
description:
|
|
||||||
- The version of the Kubernetes of this node.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
autoscaling:
|
|
||||||
description:
|
|
||||||
- Autoscaler configuration for this NodePool. Autoscaler is enabled only if
|
|
||||||
a valid configuration is present.
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
contains:
|
|
||||||
enabled:
|
|
||||||
description:
|
|
||||||
- Is autoscaling enabled for this node pool.
|
|
||||||
returned: success
|
|
||||||
type: bool
|
|
||||||
minNodeCount:
|
|
||||||
description:
|
|
||||||
- Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount.
|
|
||||||
returned: success
|
|
||||||
type: int
|
|
||||||
maxNodeCount:
|
|
||||||
description:
|
|
||||||
- Maximum number of nodes in the NodePool. Must be >= minNodeCount.
|
|
||||||
- There has to enough quota to scale up the cluster.
|
|
||||||
returned: success
|
|
||||||
type: int
|
|
||||||
management:
|
|
||||||
description:
|
|
||||||
- Management configuration for this NodePool.
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
contains:
|
|
||||||
autoUpgrade:
|
|
||||||
description:
|
|
||||||
- A flag that specifies whether node auto-upgrade is enabled for the node
|
|
||||||
pool. If enabled, node auto-upgrade helps keep the nodes in your node
|
|
||||||
pool up to date with the latest release version of Kubernetes.
|
|
||||||
returned: success
|
|
||||||
type: bool
|
|
||||||
autoRepair:
|
|
||||||
description:
|
|
||||||
- A flag that specifies whether the node auto-repair is enabled for the
|
|
||||||
node pool. If enabled, the nodes in this node pool will be monitored and,
|
|
||||||
if they fail health checks too many times, an automatic repair action
|
|
||||||
will be triggered.
|
|
||||||
returned: success
|
|
||||||
type: bool
|
|
||||||
upgradeOptions:
|
|
||||||
description:
|
|
||||||
- Specifies the Auto Upgrade knobs for the node pool.
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
contains:
|
|
||||||
autoUpgradeStartTime:
|
|
||||||
description:
|
|
||||||
- This field is set when upgrades are about to commence with the approximate
|
|
||||||
start time for the upgrades, in RFC3339 text format.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
description:
|
description:
|
||||||
description:
|
- The name of the node pool.
|
||||||
- This field is set when upgrades are about to commence with the description
|
returned: success
|
||||||
of the upgrade.
|
type: str
|
||||||
returned: success
|
config:
|
||||||
type: str
|
description:
|
||||||
cluster:
|
- The node configuration of the pool.
|
||||||
description:
|
returned: success
|
||||||
- The cluster this node pool belongs to.
|
type: complex
|
||||||
returned: success
|
contains:
|
||||||
type: dict
|
machineType:
|
||||||
location:
|
description:
|
||||||
description:
|
- The name of a Google Compute Engine machine type (e.g.
|
||||||
- The location where the node pool is deployed.
|
- n1-standard-1). If unspecified, the default machine type is n1-standard-1.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
|
diskSizeGb:
|
||||||
|
description:
|
||||||
|
- Size of the disk attached to each node, specified in GB. The smallest allowed disk
|
||||||
|
size is 10GB. If unspecified, the default disk size is 100GB.
|
||||||
|
returned: success
|
||||||
|
type: int
|
||||||
|
oauthScopes:
|
||||||
|
description:
|
||||||
|
- The set of Google API scopes to be made available on all of the node VMs under the
|
||||||
|
"default" service account.
|
||||||
|
- 'The following scopes are recommended, but not required, and by default are not
|
||||||
|
included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent
|
||||||
|
storage on your nodes.'
|
||||||
|
- U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating
|
||||||
|
with gcr.io (the Google Container Registry).
|
||||||
|
- If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are
|
||||||
|
enabled, in which case their required scopes will be added.
|
||||||
|
returned: success
|
||||||
|
type: list
|
||||||
|
serviceAccount:
|
||||||
|
description:
|
||||||
|
- The Google Cloud Platform Service Account to be used by the node VMs. If no Service
|
||||||
|
Account is specified, the "default" service account is used.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
metadata:
|
||||||
|
description:
|
||||||
|
- The metadata key/value pairs assigned to instances in the cluster.
|
||||||
|
- 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length.
|
||||||
|
These are reflected as part of a URL in the metadata server. Additionally, to avoid
|
||||||
|
ambiguity, keys must not conflict with any other metadata keys for the project or
|
||||||
|
be one of the four reserved keys: "instance-template", "kube-env", "startup-script",
|
||||||
|
and "user-data" Values are free-form strings, and only have meaning as interpreted
|
||||||
|
by the image running in the instance. The only restriction placed on them is that
|
||||||
|
each value''s size must be less than or equal to 32 KB.'
|
||||||
|
- The total size of all keys and values must be less than 512 KB.
|
||||||
|
- 'An object containing a list of "key": value pairs.'
|
||||||
|
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
|
||||||
|
returned: success
|
||||||
|
type: dict
|
||||||
|
imageType:
|
||||||
|
description:
|
||||||
|
- The image type to use for this node. Note that for a given image type, the latest
|
||||||
|
version of it will be used.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
labels:
|
||||||
|
description:
|
||||||
|
- 'The map of Kubernetes labels (key/value pairs) to be applied to each node.
|
||||||
|
These will added in addition to any default label(s) that Kubernetes may apply
|
||||||
|
to the node. In case of conflict in label keys, the applied set may differ
|
||||||
|
depending on the Kubernetes version -- it''s best to assume the behavior is
|
||||||
|
undefined and conflicts should be avoided. For more information, including
|
||||||
|
usage and the valid values, see:
|
||||||
|
U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object containing
|
||||||
|
a list of "key": value pairs.'
|
||||||
|
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
|
||||||
|
returned: success
|
||||||
|
type: dict
|
||||||
|
localSsdCount:
|
||||||
|
description:
|
||||||
|
- The number of local SSD disks to be attached to the node.
|
||||||
|
- 'The limit for this value is dependant upon the maximum number of disks available
|
||||||
|
on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for
|
||||||
|
more information.'
|
||||||
|
returned: success
|
||||||
|
type: int
|
||||||
|
tags:
|
||||||
|
description:
|
||||||
|
- The list of instance tags applied to all nodes. Tags are used to identify valid
|
||||||
|
sources or targets for network firewalls and are specified by the client during
|
||||||
|
cluster or node pool creation. Each tag within the list must comply with RFC1035.
|
||||||
|
returned: success
|
||||||
|
type: list
|
||||||
|
preemptible:
|
||||||
|
description:
|
||||||
|
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
|
||||||
|
for more inforamtion about preemptible VM instances.'
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
initialNodeCount:
|
||||||
|
description:
|
||||||
|
- The initial node count for the pool. You must ensure that your Compute Engine resource
|
||||||
|
quota is sufficient for this number of instances. You must also have available firewall
|
||||||
|
and routes quota.
|
||||||
|
returned: success
|
||||||
|
type: int
|
||||||
|
version:
|
||||||
|
description:
|
||||||
|
- The version of the Kubernetes of this node.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
autoscaling:
|
||||||
|
description:
|
||||||
|
- Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid
|
||||||
|
configuration is present.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
enabled:
|
||||||
|
description:
|
||||||
|
- Is autoscaling enabled for this node pool.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
minNodeCount:
|
||||||
|
description:
|
||||||
|
- Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount.
|
||||||
|
returned: success
|
||||||
|
type: int
|
||||||
|
maxNodeCount:
|
||||||
|
description:
|
||||||
|
- Maximum number of nodes in the NodePool. Must be >= minNodeCount.
|
||||||
|
- There has to enough quota to scale up the cluster.
|
||||||
|
returned: success
|
||||||
|
type: int
|
||||||
|
management:
|
||||||
|
description:
|
||||||
|
- Management configuration for this NodePool.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
autoUpgrade:
|
||||||
|
description:
|
||||||
|
- A flag that specifies whether node auto-upgrade is enabled for the node pool. If
|
||||||
|
enabled, node auto-upgrade helps keep the nodes in your node pool up to date with
|
||||||
|
the latest release version of Kubernetes.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
autoRepair:
|
||||||
|
description:
|
||||||
|
- A flag that specifies whether the node auto-repair is enabled for the node pool.
|
||||||
|
If enabled, the nodes in this node pool will be monitored and, if they fail health
|
||||||
|
checks too many times, an automatic repair action will be triggered.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
upgradeOptions:
|
||||||
|
description:
|
||||||
|
- Specifies the Auto Upgrade knobs for the node pool.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
autoUpgradeStartTime:
|
||||||
|
description:
|
||||||
|
- This field is set when upgrades are about to commence with the approximate start
|
||||||
|
time for the upgrades, in RFC3339 text format.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
description:
|
||||||
|
description:
|
||||||
|
- This field is set when upgrades are about to commence with the description of the
|
||||||
|
upgrade.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
cluster:
|
||||||
|
description:
|
||||||
|
- The cluster this node pool belongs to.
|
||||||
|
returned: success
|
||||||
|
type: dict
|
||||||
|
zone:
|
||||||
|
description:
|
||||||
|
- The zone where the node pool is deployed.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
'''
|
'''
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -273,9 +267,14 @@ import json
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone']), cluster=dict(required=True, type='dict')))
|
module = GcpModule(
|
||||||
|
argument_spec=dict(
|
||||||
|
zone=dict(required=True, type='str'),
|
||||||
|
cluster=dict(required=True, type='dict')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if not module.params['scopes']:
|
if 'scopes' not in module.params:
|
||||||
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
|
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
|
||||||
|
|
||||||
items = fetch_list(module, collection(module))
|
items = fetch_list(module, collection(module))
|
||||||
|
@ -283,13 +282,19 @@ def main():
|
||||||
items = items.get('nodePools')
|
items = items.get('nodePools')
|
||||||
else:
|
else:
|
||||||
items = []
|
items = []
|
||||||
return_value = {'items': items}
|
return_value = {
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
module.exit_json(**return_value)
|
module.exit_json(**return_value)
|
||||||
|
|
||||||
|
|
||||||
def collection(module):
|
def collection(module):
|
||||||
res = {'project': module.params['project'], 'location': module.params['location'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')}
|
res = {
|
||||||
return "https://container.googleapis.com/v1/projects/{project}/zones/{location}/clusters/{cluster}/nodePools".format(**res)
|
'project': module.params['project'],
|
||||||
|
'zone': module.params['zone'],
|
||||||
|
'cluster': replace_resource_dict(module.params['cluster'], 'name')
|
||||||
|
}
|
||||||
|
return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools".format(**res)
|
||||||
|
|
||||||
|
|
||||||
def fetch_list(module, link):
|
def fetch_list(module, link):
|
||||||
|
|
|
@ -18,75 +18,75 @@
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Documentation
|
# Documentation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
|
'status': ["preview"],
|
||||||
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: gcp_spanner_database_facts
|
module: gcp_spanner_database_facts
|
||||||
description:
|
description:
|
||||||
- Gather facts for GCP Database
|
- Gather facts for GCP Database
|
||||||
short_description: Gather facts for GCP Database
|
short_description: Gather facts for GCP Database
|
||||||
version_added: 2.8
|
version_added: 2.8
|
||||||
author: Google Inc. (@googlecloudplatform)
|
author: Google Inc. (@googlecloudplatform)
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
- requests >= 2.18.4
|
- requests >= 2.18.4
|
||||||
- google-auth >= 1.3.0
|
- google-auth >= 1.3.0
|
||||||
options:
|
options:
|
||||||
instance:
|
instance:
|
||||||
description:
|
description:
|
||||||
- The instance to create the database on.
|
- The instance to create the database on.
|
||||||
- 'This field represents a link to a Instance resource in GCP. It can be specified
|
- 'This field represents a link to a Instance resource in GCP. It can be specified
|
||||||
in two ways. First, you can place a dictionary with key ''name'' and value of
|
in two ways. You can add `register: name-of-resource` to a gcp_spanner_instance
|
||||||
your resource''s name Alternatively, you can add `register: name-of-resource`
|
task and then set this instance field to "{{ name-of-resource }}" Alternatively,
|
||||||
to a gcp_spanner_instance task and then set this instance field to "{{ name-of-resource
|
you can set this instance to a dictionary with the name key where the value is the
|
||||||
}}"'
|
name of your Instance.'
|
||||||
required: true
|
required: true
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: " a database facts"
|
- name: a database facts
|
||||||
gcp_spanner_database_facts:
|
gcp_spanner_database_facts:
|
||||||
instance: "{{ instance }}"
|
instance: "{{ instance }}"
|
||||||
project: test_project
|
project: test_project
|
||||||
auth_kind: serviceaccount
|
auth_kind: serviceaccount
|
||||||
service_account_file: "/tmp/auth.pem"
|
service_account_file: "/tmp/auth.pem"
|
||||||
state: facts
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
resources:
|
items:
|
||||||
description: List of resources
|
description: List of items
|
||||||
returned: always
|
returned: always
|
||||||
type: complex
|
type: complex
|
||||||
contains:
|
contains:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- A unique identifier for the database, which cannot be changed after the instance
|
- A unique identifier for the database, which cannot be changed after the instance
|
||||||
is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9].
|
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9].
|
||||||
returned: success
|
The final segment of the name must be between 6 and 30 characters in length.
|
||||||
type: str
|
returned: success
|
||||||
extraStatements:
|
type: str
|
||||||
description:
|
extraStatements:
|
||||||
- 'An optional list of DDL statements to run inside the newly created database.
|
description:
|
||||||
Statements can create tables, indexes, etc. These statements execute atomically
|
- 'An optional list of DDL statements to run inside the newly created database. Statements
|
||||||
with the creation of the database: if there is an error in any statement,
|
can create tables, indexes, etc. These statements execute atomically with the creation
|
||||||
the database is not created.'
|
of the database: if there is an error in any statement, the database is not created.'
|
||||||
returned: success
|
returned: success
|
||||||
type: list
|
type: list
|
||||||
instance:
|
instance:
|
||||||
description:
|
description:
|
||||||
- The instance to create the database on.
|
- The instance to create the database on.
|
||||||
returned: success
|
returned: success
|
||||||
type: dict
|
type: dict
|
||||||
'''
|
'''
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -101,9 +101,13 @@ import json
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = GcpModule(argument_spec=dict(instance=dict(required=True, type='dict')))
|
module = GcpModule(
|
||||||
|
argument_spec=dict(
|
||||||
|
instance=dict(required=True, type='dict')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if not module.params['scopes']:
|
if 'scopes' not in module.params:
|
||||||
module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin']
|
module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin']
|
||||||
|
|
||||||
items = fetch_list(module, collection(module))
|
items = fetch_list(module, collection(module))
|
||||||
|
@ -111,12 +115,17 @@ def main():
|
||||||
items = items.get('databases')
|
items = items.get('databases')
|
||||||
else:
|
else:
|
||||||
items = []
|
items = []
|
||||||
return_value = {'resources': items}
|
return_value = {
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
module.exit_json(**return_value)
|
module.exit_json(**return_value)
|
||||||
|
|
||||||
|
|
||||||
def collection(module):
|
def collection(module):
|
||||||
res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')}
|
res = {
|
||||||
|
'project': module.params['project'],
|
||||||
|
'instance': replace_resource_dict(module.params['instance'], 'name')
|
||||||
|
}
|
||||||
return "https://spanner.googleapis.com/v1/projects/{project}/instances/{instance}/databases".format(**res)
|
return "https://spanner.googleapis.com/v1/projects/{project}/instances/{instance}/databases".format(**res)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,79 +18,90 @@
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Documentation
|
# Documentation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
|
'status': ["preview"],
|
||||||
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: gcp_spanner_instance_facts
|
module: gcp_spanner_instance_facts
|
||||||
description:
|
description:
|
||||||
- Gather facts for GCP Instance
|
- Gather facts for GCP Instance
|
||||||
short_description: Gather facts for GCP Instance
|
short_description: Gather facts for GCP Instance
|
||||||
version_added: 2.8
|
version_added: 2.8
|
||||||
author: Google Inc. (@googlecloudplatform)
|
author: Google Inc. (@googlecloudplatform)
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
- requests >= 2.18.4
|
- requests >= 2.18.4
|
||||||
- google-auth >= 1.3.0
|
- google-auth >= 1.3.0
|
||||||
options: {}
|
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: " a instance facts"
|
- name: a instance facts
|
||||||
gcp_spanner_instance_facts:
|
gcp_spanner_instance_facts:
|
||||||
project: test_project
|
project: test_project
|
||||||
auth_kind: serviceaccount
|
auth_kind: serviceaccount
|
||||||
service_account_file: "/tmp/auth.pem"
|
service_account_file: "/tmp/auth.pem"
|
||||||
state: facts
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
resources:
|
items:
|
||||||
description: List of resources
|
description: List of items
|
||||||
returned: always
|
returned: always
|
||||||
type: complex
|
type: complex
|
||||||
contains:
|
contains:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- A unique identifier for the instance, which cannot be changed after the instance
|
- A unique identifier for the instance, which cannot be changed after the instance
|
||||||
is created. The name must be between 6 and 30 characters in length.
|
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9].
|
||||||
returned: success
|
The final segment of the name must be between 6 and 30 characters in length.
|
||||||
type: str
|
returned: success
|
||||||
config:
|
type: str
|
||||||
description:
|
config:
|
||||||
- The name of the instance's configuration (similar but not quite the same as
|
description:
|
||||||
a region) which defines defines the geographic placement and replication of
|
- A reference to the instance configuration.
|
||||||
your databases in this instance. It determines where your data is stored.
|
returned: success
|
||||||
Values are typically of the form `regional-europe-west1` , `us-central` etc.
|
type: str
|
||||||
- In order to obtain a valid list please consult the [Configuration section
|
displayName:
|
||||||
of the docs](U(https://cloud.google.com/spanner/docs/instances).)
|
description:
|
||||||
returned: success
|
- The descriptive name for this instance as it appears in UIs. Must be unique per
|
||||||
type: str
|
project and between 4 and 30 characters in length.
|
||||||
displayName:
|
returned: success
|
||||||
description:
|
type: str
|
||||||
- The descriptive name for this instance as it appears in UIs. Must be unique
|
nodeCount:
|
||||||
per project and between 4 and 30 characters in length.
|
description:
|
||||||
returned: success
|
- The number of nodes allocated to this instance.
|
||||||
type: str
|
returned: success
|
||||||
nodeCount:
|
type: int
|
||||||
description:
|
labels:
|
||||||
- The number of nodes allocated to this instance.
|
description:
|
||||||
returned: success
|
- Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources
|
||||||
type: int
|
into groups that reflect a customer's organizational needs and deployment strategies.
|
||||||
labels:
|
Cloud Labels can be used to filter collections of resources. They can be used to
|
||||||
description:
|
control how resource metrics are aggregated. And they can be used as arguments to
|
||||||
- 'An object containing a list of "key": value pairs.'
|
policy management rules (e.g. route, firewall, load balancing, etc.).
|
||||||
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
|
- 'Label keys must be between 1 and 63 characters long and must conform to the following
|
||||||
returned: success
|
regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.'
|
||||||
type: dict
|
- Label values must be between 0 and 63 characters long and must conform to the regular
|
||||||
|
expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
|
||||||
|
- No more than 64 labels can be associated with a given resource.
|
||||||
|
- See U(https://goo.gl/xmQnxf) for more information on and examples of labels.
|
||||||
|
- 'If you plan to use labels in your own code, please note that additional characters
|
||||||
|
may be allowed in the future. And so you are advised to use an internal label representation,
|
||||||
|
such as JSON, which doesn''t rely upon specific characters being disallowed. For
|
||||||
|
example, representing labels as the string: name + "_" + value would prove problematic
|
||||||
|
if we were to allow "_" in a future release.'
|
||||||
|
- 'An object containing a list of "key": value pairs.'
|
||||||
|
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
|
||||||
|
returned: success
|
||||||
|
type: dict
|
||||||
'''
|
'''
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -105,9 +116,12 @@ import json
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = GcpModule(argument_spec=dict())
|
module = GcpModule(
|
||||||
|
argument_spec=dict(
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if not module.params['scopes']:
|
if 'scopes' not in module.params:
|
||||||
module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin']
|
module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin']
|
||||||
|
|
||||||
items = fetch_list(module, collection(module))
|
items = fetch_list(module, collection(module))
|
||||||
|
@ -115,7 +129,9 @@ def main():
|
||||||
items = items.get('instances')
|
items = items.get('instances')
|
||||||
else:
|
else:
|
||||||
items = []
|
items = []
|
||||||
return_value = {'resources': items}
|
return_value = {
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
module.exit_json(**return_value)
|
module.exit_json(**return_value)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,78 +18,83 @@
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Documentation
|
# Documentation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
|
'status': ["preview"],
|
||||||
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: gcp_sql_database_facts
|
module: gcp_sql_database_facts
|
||||||
description:
|
description:
|
||||||
- Gather facts for GCP Database
|
- Gather facts for GCP Database
|
||||||
short_description: Gather facts for GCP Database
|
short_description: Gather facts for GCP Database
|
||||||
version_added: 2.8
|
version_added: 2.8
|
||||||
author: Google Inc. (@googlecloudplatform)
|
author: Google Inc. (@googlecloudplatform)
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
- requests >= 2.18.4
|
- requests >= 2.18.4
|
||||||
- google-auth >= 1.3.0
|
- google-auth >= 1.3.0
|
||||||
options:
|
options:
|
||||||
instance:
|
instance:
|
||||||
description:
|
description:
|
||||||
- The name of the Cloud SQL instance. This does not include the project ID.
|
- The name of the Cloud SQL instance. This does not include the project ID.
|
||||||
required: true
|
- 'This field represents a link to a Instance resource in GCP. It can be specified
|
||||||
|
in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task
|
||||||
|
and then set this instance field to "{{ name-of-resource }}" Alternatively, you
|
||||||
|
can set this instance to a dictionary with the name key where the value is the name
|
||||||
|
of your Instance.'
|
||||||
|
required: true
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: " a database facts"
|
- name: a database facts
|
||||||
gcp_sql_database_facts:
|
gcp_sql_database_facts:
|
||||||
instance: "{{ instance }}"
|
instance: "{{ instance }}"
|
||||||
project: test_project
|
project: test_project
|
||||||
auth_kind: serviceaccount
|
auth_kind: serviceaccount
|
||||||
service_account_file: "/tmp/auth.pem"
|
service_account_file: "/tmp/auth.pem"
|
||||||
state: facts
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
resources:
|
items:
|
||||||
description: List of resources
|
description: List of items
|
||||||
returned: always
|
returned: always
|
||||||
type: complex
|
type: complex
|
||||||
contains:
|
contains:
|
||||||
charset:
|
charset:
|
||||||
description:
|
description:
|
||||||
- The MySQL charset value.
|
- The MySQL charset value.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
collation:
|
collation:
|
||||||
description:
|
description:
|
||||||
- The MySQL collation value.
|
- The MySQL collation value.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The name of the database in the Cloud SQL instance.
|
- The name of the database in the Cloud SQL instance.
|
||||||
- This does not include the project ID or instance name.
|
- This does not include the project ID or instance name.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
instance:
|
instance:
|
||||||
description:
|
description:
|
||||||
- The name of the Cloud SQL instance. This does not include the project ID.
|
- The name of the Cloud SQL instance. This does not include the project ID.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: dict
|
||||||
'''
|
'''
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Imports
|
# Imports
|
||||||
################################################################################
|
################################################################################
|
||||||
from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest
|
from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict
|
||||||
import json
|
import json
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -98,9 +103,13 @@ import json
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = GcpModule(argument_spec=dict(instance=dict(required=True, type='str')))
|
module = GcpModule(
|
||||||
|
argument_spec=dict(
|
||||||
|
instance=dict(required=True, type='dict')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if not module.params['scopes']:
|
if 'scopes' not in module.params:
|
||||||
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']
|
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']
|
||||||
|
|
||||||
items = fetch_list(module, collection(module))
|
items = fetch_list(module, collection(module))
|
||||||
|
@ -108,12 +117,18 @@ def main():
|
||||||
items = items.get('items')
|
items = items.get('items')
|
||||||
else:
|
else:
|
||||||
items = []
|
items = []
|
||||||
return_value = {'resources': items}
|
return_value = {
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
module.exit_json(**return_value)
|
module.exit_json(**return_value)
|
||||||
|
|
||||||
|
|
||||||
def collection(module):
|
def collection(module):
|
||||||
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**module.params)
|
res = {
|
||||||
|
'project': module.params['project'],
|
||||||
|
'instance': replace_resource_dict(module.params['instance'], 'name')
|
||||||
|
}
|
||||||
|
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**res)
|
||||||
|
|
||||||
|
|
||||||
def fetch_list(module, link):
|
def fetch_list(module, link):
|
||||||
|
|
|
@ -18,337 +18,302 @@
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Documentation
|
# Documentation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
|
'status': ["preview"],
|
||||||
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: gcp_sql_instance_facts
|
module: gcp_sql_instance_facts
|
||||||
description:
|
description:
|
||||||
- Gather facts for GCP Instance
|
- Gather facts for GCP Instance
|
||||||
short_description: Gather facts for GCP Instance
|
short_description: Gather facts for GCP Instance
|
||||||
version_added: 2.8
|
version_added: 2.8
|
||||||
author: Google Inc. (@googlecloudplatform)
|
author: Google Inc. (@googlecloudplatform)
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
- requests >= 2.18.4
|
- requests >= 2.18.4
|
||||||
- google-auth >= 1.3.0
|
- google-auth >= 1.3.0
|
||||||
options: {}
|
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: " a instance facts"
|
- name: a instance facts
|
||||||
gcp_sql_instance_facts:
|
gcp_sql_instance_facts:
|
||||||
project: test_project
|
project: test_project
|
||||||
auth_kind: serviceaccount
|
auth_kind: serviceaccount
|
||||||
service_account_file: "/tmp/auth.pem"
|
service_account_file: "/tmp/auth.pem"
|
||||||
state: facts
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
resources:
|
items:
|
||||||
description: List of resources
|
description: List of items
|
||||||
returned: always
|
returned: always
|
||||||
type: complex
|
type: complex
|
||||||
contains:
|
contains:
|
||||||
backendType:
|
backendType:
|
||||||
description:
|
description:
|
||||||
- "* FIRST_GEN: First Generation instance. MySQL only."
|
- "* FIRST_GEN: First Generation instance. MySQL only."
|
||||||
- "* SECOND_GEN: Second Generation instance or PostgreSQL instance."
|
- "* SECOND_GEN: Second Generation instance or PostgreSQL instance."
|
||||||
- "* EXTERNAL: A database server that is not managed by Google."
|
- "* EXTERNAL: A database server that is not managed by Google."
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
connectionName:
|
connectionName:
|
||||||
description:
|
description:
|
||||||
- Connection name of the Cloud SQL instance used in connection strings.
|
- Connection name of the Cloud SQL instance used in connection strings.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
databaseVersion:
|
databaseVersion:
|
||||||
description:
|
description:
|
||||||
- The database engine type and version. For First Generation instances, can
|
- The database engine type and version. For First Generation instances, can be MYSQL_5_5,
|
||||||
be MYSQL_5_5, or MYSQL_5_6. For Second Generation instances, can be MYSQL_5_6
|
or MYSQL_5_6. For Second Generation instances, can be MYSQL_5_6 or MYSQL_5_7. Defaults
|
||||||
or MYSQL_5_7. Defaults to MYSQL_5_6.
|
to MYSQL_5_6.
|
||||||
- 'PostgreSQL instances: POSTGRES_9_6 The databaseVersion property can not be
|
- 'PostgreSQL instances: POSTGRES_9_6 The databaseVersion property can not be changed
|
||||||
changed after instance creation.'
|
after instance creation.'
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
failoverReplica:
|
failoverReplica:
|
||||||
description:
|
description:
|
||||||
- The name and status of the failover replica. This property is applicable only
|
- The name and status of the failover replica. This property is applicable only to
|
||||||
to Second Generation instances.
|
Second Generation instances.
|
||||||
returned: success
|
returned: success
|
||||||
type: complex
|
type: complex
|
||||||
contains:
|
contains:
|
||||||
available:
|
available:
|
||||||
description:
|
description:
|
||||||
- The availability status of the failover replica. A false status indicates
|
- The availability status of the failover replica. A false status indicates that the
|
||||||
that the failover replica is out of sync. The master can only failover
|
failover replica is out of sync. The master can only failover to the falover replica
|
||||||
to the failover replica when the status is true.
|
when the status is true.
|
||||||
returned: success
|
returned: success
|
||||||
type: bool
|
type: bool
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- The name of the failover replica. If specified at instance creation, a
|
|
||||||
failover replica is created for the instance. The name doesn't include
|
|
||||||
the project ID. This property is applicable only to Second Generation
|
|
||||||
instances.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
instanceType:
|
|
||||||
description:
|
|
||||||
- The instance type. This can be one of the following.
|
|
||||||
- "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a
|
|
||||||
master."
|
|
||||||
- "* ON_PREMISES_INSTANCE: An instance running on the customer's premises."
|
|
||||||
- "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica."
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
ipAddresses:
|
|
||||||
description:
|
|
||||||
- The assigned IP addresses for the instance.
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
contains:
|
|
||||||
ipAddress:
|
|
||||||
description:
|
|
||||||
- The IP address assigned.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
timeToRetire:
|
|
||||||
description:
|
|
||||||
- The due time for this IP to be retired in RFC 3339 format, for example
|
|
||||||
2012-11-15T16:19:00.094Z. This field is only available when the IP is
|
|
||||||
scheduled to be retired.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
type:
|
|
||||||
description:
|
|
||||||
- The type of this IP address. A PRIMARY address is an address that can
|
|
||||||
accept incoming connections. An OUTGOING address is the source address
|
|
||||||
of connections originating from the instance, if supported.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
ipv6Address:
|
|
||||||
description:
|
|
||||||
- The IPv6 address assigned to the instance. This property is applicable only
|
|
||||||
to First Generation instances.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
masterInstanceName:
|
|
||||||
description:
|
|
||||||
- The name of the instance which will act as master in the replication setup.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
maxDiskSize:
|
|
||||||
description:
|
|
||||||
- The maximum disk size of the instance in bytes.
|
|
||||||
returned: success
|
|
||||||
type: int
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- Name of the Cloud SQL instance. This does not include the project ID.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
region:
|
|
||||||
description:
|
|
||||||
- The geographical region. Defaults to us-central or us-central1 depending on
|
|
||||||
the instance type (First Generation or Second Generation/PostgreSQL).
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
replicaConfiguration:
|
|
||||||
description:
|
|
||||||
- Configuration specific to failover replicas and read replicas.
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
contains:
|
|
||||||
failoverTarget:
|
|
||||||
description:
|
|
||||||
- Specifies if the replica is the failover target. If the field is set to
|
|
||||||
true the replica will be designated as a failover replica.
|
|
||||||
- In case the master instance fails, the replica instance will be promoted
|
|
||||||
as the new master instance.
|
|
||||||
- Only one replica can be specified as failover target, and the replica
|
|
||||||
has to be in different zone with the master instance.
|
|
||||||
returned: success
|
|
||||||
type: bool
|
|
||||||
mysqlReplicaConfiguration:
|
|
||||||
description:
|
|
||||||
- MySQL specific configuration when replicating from a MySQL on-premises
|
|
||||||
master. Replication configuration information such as the username, password,
|
|
||||||
certificates, and keys are not stored in the instance metadata. The configuration
|
|
||||||
information is used only to set up the replication connection and is stored
|
|
||||||
by MySQL in a file named master.info in the data directory.
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
contains:
|
|
||||||
caCertificate:
|
|
||||||
description:
|
|
||||||
- PEM representation of the trusted CA's x509 certificate.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
clientCertificate:
|
|
||||||
description:
|
|
||||||
- PEM representation of the slave's x509 certificate .
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
clientKey:
|
|
||||||
description:
|
|
||||||
- PEM representation of the slave's private key. The corresponding public
|
|
||||||
key is encoded in the client's certificate.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
connectRetryInterval:
|
|
||||||
description:
|
|
||||||
- Seconds to wait between connect retries. MySQL's default is 60 seconds.
|
|
||||||
returned: success
|
|
||||||
type: int
|
|
||||||
dumpFilePath:
|
|
||||||
description:
|
|
||||||
- Path to a SQL dump file in Google Cloud Storage from which the slave
|
|
||||||
instance is to be created. The URI is in the form gs://bucketName/fileName.
|
|
||||||
Compressed gzip files (.gz) are also supported. Dumps should have
|
|
||||||
the binlog co-ordinates from which replication should begin. This
|
|
||||||
can be accomplished by setting --master-data to 1 when using mysqldump.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
masterHeartbeatPeriod:
|
|
||||||
description:
|
|
||||||
- Interval in milliseconds between replication heartbeats.
|
|
||||||
returned: success
|
|
||||||
type: int
|
|
||||||
password:
|
|
||||||
description:
|
|
||||||
- The password for the replication connection.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
sslCipher:
|
|
||||||
description:
|
|
||||||
- A list of permissible ciphers to use for SSL encryption.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
username:
|
|
||||||
description:
|
|
||||||
- The username for the replication connection.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
verifyServerCertificate:
|
|
||||||
description:
|
|
||||||
- Whether or not to check the master's Common Name value in the certificate
|
|
||||||
that it sends during the SSL handshake.
|
|
||||||
returned: success
|
|
||||||
type: bool
|
|
||||||
replicaNames:
|
|
||||||
description:
|
|
||||||
- The replicas of the instance.
|
|
||||||
returned: success
|
|
||||||
type: list
|
|
||||||
serviceAccountEmailAddress:
|
|
||||||
description:
|
|
||||||
- The service account email address assigned to the instance. This property
|
|
||||||
is applicable only to Second Generation instances.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
settings:
|
|
||||||
description:
|
|
||||||
- The user settings.
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
contains:
|
|
||||||
ipConfiguration:
|
|
||||||
description:
|
|
||||||
- The settings for IP Management. This allows to enable or disable the instance
|
|
||||||
IP and manage which external networks can connect to the instance. The
|
|
||||||
IPv4 address cannot be disabled for Second Generation instances.
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
contains:
|
|
||||||
ipv4Enabled:
|
|
||||||
description:
|
|
||||||
- Whether the instance should be assigned an IP address or not.
|
|
||||||
returned: success
|
|
||||||
type: bool
|
|
||||||
authorizedNetworks:
|
|
||||||
description:
|
|
||||||
- The list of external networks that are allowed to connect to the instance
|
|
||||||
using the IP. In CIDR notation, also known as 'slash' notation (e.g.
|
|
||||||
192.168.100.0/24).
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
contains:
|
|
||||||
expirationTime:
|
|
||||||
description:
|
|
||||||
- The time when this access control entry expires in RFC 3339 format,
|
|
||||||
for example 2012-11-15T16:19:00.094Z.
|
|
||||||
returned: success
|
|
||||||
type: str
|
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- An optional label to identify this entry.
|
- The name of the failover replica. If specified at instance creation, a failover
|
||||||
returned: success
|
replica is created for the instance. The name doesn't include the project ID. This
|
||||||
type: str
|
property is applicable only to Second Generation instances.
|
||||||
value:
|
returned: success
|
||||||
description:
|
type: str
|
||||||
- The whitelisted value for the access control list. For example,
|
instanceType:
|
||||||
to grant access to a client from an external IP (IPv4 or IPv6)
|
description:
|
||||||
address or subnet, use that address or subnet here.
|
- The instance type. This can be one of the following.
|
||||||
returned: success
|
- "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a master."
|
||||||
type: str
|
- "* ON_PREMISES_INSTANCE: An instance running on the customer's premises."
|
||||||
requireSsl:
|
- "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica."
|
||||||
description:
|
returned: success
|
||||||
- Whether the mysqld should default to 'REQUIRE X509' for users connecting
|
type: str
|
||||||
over IP.
|
ipAddresses:
|
||||||
returned: success
|
description:
|
||||||
type: bool
|
- The assigned IP addresses for the instance.
|
||||||
tier:
|
returned: success
|
||||||
description:
|
type: complex
|
||||||
- The tier or machine type for this instance, for example db-n1-standard-1.
|
contains:
|
||||||
For MySQL instances, this field determines whether the instance is Second
|
ipAddress:
|
||||||
Generation (recommended) or First Generation.
|
description:
|
||||||
returned: success
|
- The IP address assigned.
|
||||||
type: str
|
returned: success
|
||||||
availabilityType:
|
type: str
|
||||||
description:
|
timeToRetire:
|
||||||
- The availabilityType define if your postgres instance is run zonal or
|
description:
|
||||||
regional.
|
- The due time for this IP to be retired in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
|
||||||
returned: success
|
This field is only available when the IP is scheduled to be retired.
|
||||||
type: str
|
returned: success
|
||||||
backupConfiguration:
|
type: str
|
||||||
description:
|
type:
|
||||||
- The daily backup configuration for the instance.
|
description:
|
||||||
returned: success
|
- The type of this IP address. A PRIMARY address is an address that can accept incoming
|
||||||
type: complex
|
connections. An OUTGOING address is the source address of connections originating
|
||||||
contains:
|
from the instance, if supported.
|
||||||
enabled:
|
returned: success
|
||||||
description:
|
type: str
|
||||||
- Enable Autobackup for your instance.
|
ipv6Address:
|
||||||
returned: success
|
description:
|
||||||
type: bool
|
- The IPv6 address assigned to the instance. This property is applicable only to First
|
||||||
binaryLogEnabled:
|
Generation instances.
|
||||||
description:
|
returned: success
|
||||||
- Whether binary log is enabled. If backup configuration is disabled,
|
type: str
|
||||||
binary log must be disabled as well. MySQL only.
|
masterInstanceName:
|
||||||
returned: success
|
description:
|
||||||
type: bool
|
- The name of the instance which will act as master in the replication setup.
|
||||||
startTime:
|
returned: success
|
||||||
description:
|
type: str
|
||||||
- Define the backup start time in UTC (HH:MM) .
|
maxDiskSize:
|
||||||
returned: success
|
description:
|
||||||
type: str
|
- The maximum disk size of the instance in bytes.
|
||||||
settingsVersion:
|
returned: success
|
||||||
description:
|
type: int
|
||||||
- The version of instance settings. This is a required field for update
|
name:
|
||||||
method to make sure concurrent updates are handled properly. During update,
|
description:
|
||||||
use the most recent settingsVersion value for this instance and do not
|
- Name of the Cloud SQL instance. This does not include the project ID.
|
||||||
try to update this value.
|
returned: success
|
||||||
returned: success
|
type: str
|
||||||
type: int
|
region:
|
||||||
|
description:
|
||||||
|
- The geographical region. Defaults to us-central or us-central1 depending on the
|
||||||
|
instance type (First Generation or Second Generation/PostgreSQL).
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
replicaConfiguration:
|
||||||
|
description:
|
||||||
|
- Configuration specific to failover replicas and read replicas.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
failoverTarget:
|
||||||
|
description:
|
||||||
|
- Specifies if the replica is the failover target. If the field is set to true the
|
||||||
|
replica will be designated as a failover replica.
|
||||||
|
- In case the master instance fails, the replica instance will be promoted as the
|
||||||
|
new master instance.
|
||||||
|
- Only one replica can be specified as failover target, and the replica has to be
|
||||||
|
in different zone with the master instance.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
mysqlReplicaConfiguration:
|
||||||
|
description:
|
||||||
|
- MySQL specific configuration when replicating from a MySQL on-premises master. Replication
|
||||||
|
configuration information such as the username, password, certificates, and keys
|
||||||
|
are not stored in the instance metadata. The configuration information is used
|
||||||
|
only to set up the replication connection and is stored by MySQL in a file named
|
||||||
|
master.info in the data directory.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
caCertificate:
|
||||||
|
description:
|
||||||
|
- PEM representation of the trusted CA's x509 certificate.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
clientCertificate:
|
||||||
|
description:
|
||||||
|
- PEM representation of the slave's x509 certificate .
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
clientKey:
|
||||||
|
description:
|
||||||
|
- PEM representation of the slave's private key. The corresponsing public key is encoded
|
||||||
|
in the client's asf asd certificate.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
connectRetryInterval:
|
||||||
|
description:
|
||||||
|
- Seconds to wait between connect retries. MySQL's default is 60 seconds.
|
||||||
|
returned: success
|
||||||
|
type: int
|
||||||
|
dumpFilePath:
|
||||||
|
description:
|
||||||
|
- Path to a SQL dump file in Google Cloud Storage from which the slave instance is
|
||||||
|
to be created. The URI is in the form gs://bucketName/fileName. Compressed gzip
|
||||||
|
files (.gz) are also supported. Dumps should have the binlog co-ordinates from which
|
||||||
|
replication should begin. This can be accomplished by setting --master-data to 1
|
||||||
|
when using mysqldump.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
masterHeartbeatPeriod:
|
||||||
|
description:
|
||||||
|
- Interval in milliseconds between replication heartbeats.
|
||||||
|
returned: success
|
||||||
|
type: int
|
||||||
|
password:
|
||||||
|
description:
|
||||||
|
- The password for the replication connection.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
sslCipher:
|
||||||
|
description:
|
||||||
|
- A list of permissible ciphers to use for SSL encryption.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
username:
|
||||||
|
description:
|
||||||
|
- The username for the replication connection.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
verifyServerCertificate:
|
||||||
|
description:
|
||||||
|
- Whether or not to check the master's Common Name value in the certificate that it
|
||||||
|
sends during the SSL handshake.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
replicaNames:
|
||||||
|
description:
|
||||||
|
- The replicas of the instance.
|
||||||
|
returned: success
|
||||||
|
type: list
|
||||||
|
serviceAccountEmailAddress:
|
||||||
|
description:
|
||||||
|
- The service account email address assigned to the instance. This property is applicable
|
||||||
|
only to Second Generation instances.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
settings:
|
||||||
|
description:
|
||||||
|
- The user settings.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
ipConfiguration:
|
||||||
|
description:
|
||||||
|
- The settings for IP Management. This allows to enable or disable the instance IP
|
||||||
|
and manage which external networks can connect to the instance. The IPv4 address
|
||||||
|
cannot be disabled for Second Generation instances.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
ipv4Enabled:
|
||||||
|
description:
|
||||||
|
- Whether the instance should be assigned an IP address or not.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
authorizedNetworks:
|
||||||
|
description:
|
||||||
|
- The list of external networks that are allowed to connect to the instance using
|
||||||
|
the IP. In CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24).
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
expirationTime:
|
||||||
|
description:
|
||||||
|
- The time when this access control entry expires in RFC 3339 format, for example
|
||||||
|
2012-11-15T16:19:00.094Z.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- An optional label to identify this entry.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
value:
|
||||||
|
description:
|
||||||
|
- The whitelisted value for the access control list. For example, to grant access
|
||||||
|
to a client from an external IP (IPv4 or IPv6) address or subnet, use that address
|
||||||
|
or subnet here.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
requireSsl:
|
||||||
|
description:
|
||||||
|
- Whether the mysqld should default to 'REQUIRE X509' for users connecting over IP.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
tier:
|
||||||
|
description:
|
||||||
|
- The tier or machine type for this instance, for example db-n1-standard-1. For MySQL
|
||||||
|
instances, this field determines whether the instance is Second Generation (recommended)
|
||||||
|
or First Generation.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
settingsVersion:
|
||||||
|
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.
|
||||||
|
returned: success
|
||||||
|
type: int
|
||||||
'''
|
'''
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -363,9 +328,12 @@ import json
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = GcpModule(argument_spec=dict())
|
module = GcpModule(
|
||||||
|
argument_spec=dict(
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if not module.params['scopes']:
|
if 'scopes' not in module.params:
|
||||||
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']
|
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']
|
||||||
|
|
||||||
items = fetch_list(module, collection(module))
|
items = fetch_list(module, collection(module))
|
||||||
|
@ -373,7 +341,9 @@ def main():
|
||||||
items = items.get('items')
|
items = items.get('items')
|
||||||
else:
|
else:
|
||||||
items = []
|
items = []
|
||||||
return_value = {'resources': items}
|
return_value = {
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
module.exit_json(**return_value)
|
module.exit_json(**return_value)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,78 +18,78 @@
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Documentation
|
# Documentation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
|
'status': ["preview"],
|
||||||
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: gcp_sql_user_facts
|
module: gcp_sql_user_facts
|
||||||
description:
|
description:
|
||||||
- Gather facts for GCP User
|
- Gather facts for GCP User
|
||||||
short_description: Gather facts for GCP User
|
short_description: Gather facts for GCP User
|
||||||
version_added: 2.8
|
version_added: 2.8
|
||||||
author: Google Inc. (@googlecloudplatform)
|
author: Google Inc. (@googlecloudplatform)
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
- requests >= 2.18.4
|
- requests >= 2.18.4
|
||||||
- google-auth >= 1.3.0
|
- google-auth >= 1.3.0
|
||||||
options:
|
options:
|
||||||
instance:
|
instance:
|
||||||
description:
|
description:
|
||||||
- The name of the Cloud SQL instance. This does not include the project ID.
|
- The name of the Cloud SQL instance. This does not include the project ID.
|
||||||
- 'This field represents a link to a Instance resource in GCP. It can be specified
|
- 'This field represents a link to a Instance resource in GCP. It can be specified
|
||||||
in two ways. First, you can place a dictionary with key ''name'' and value of
|
in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task
|
||||||
your resource''s name Alternatively, you can add `register: name-of-resource`
|
and then set this instance field to "{{ name-of-resource }}" Alternatively, you
|
||||||
to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource
|
can set this instance to a dictionary with the name key where the value is the name
|
||||||
}}"'
|
of your Instance.'
|
||||||
required: true
|
required: true
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: " a user facts"
|
- name: a user facts
|
||||||
gcp_sql_user_facts:
|
gcp_sql_user_facts:
|
||||||
instance: "{{ instance }}"
|
instance: "{{ instance }}"
|
||||||
project: test_project
|
project: test_project
|
||||||
auth_kind: serviceaccount
|
auth_kind: serviceaccount
|
||||||
service_account_file: "/tmp/auth.pem"
|
service_account_file: "/tmp/auth.pem"
|
||||||
state: facts
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
resources:
|
items:
|
||||||
description: List of resources
|
description: List of items
|
||||||
returned: always
|
returned: always
|
||||||
type: complex
|
type: complex
|
||||||
contains:
|
contains:
|
||||||
host:
|
host:
|
||||||
description:
|
description:
|
||||||
- The host name from which the user can connect. For insert operations, host
|
- The host name from which the user can connect. For insert operations, host defaults
|
||||||
defaults to an empty string. For update operations, host is specified as part
|
to an empty string. For update operations, host is specified as part of the request
|
||||||
of the request URL. The host name cannot be updated after insertion.
|
URL. The host name cannot be updated after insertion.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The name of the user in the Cloud SQL instance.
|
- The name of the user in the Cloud SQL instance.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
instance:
|
instance:
|
||||||
description:
|
description:
|
||||||
- The name of the Cloud SQL instance. This does not include the project ID.
|
- The name of the Cloud SQL instance. This does not include the project ID.
|
||||||
returned: success
|
returned: success
|
||||||
type: dict
|
type: dict
|
||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- The password for the user.
|
- The password for the user.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
'''
|
'''
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -104,9 +104,13 @@ import json
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = GcpModule(argument_spec=dict(instance=dict(required=True, type='dict')))
|
module = GcpModule(
|
||||||
|
argument_spec=dict(
|
||||||
|
instance=dict(required=True, type='dict')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if not module.params['scopes']:
|
if 'scopes' not in module.params:
|
||||||
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']
|
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']
|
||||||
|
|
||||||
items = fetch_list(module, collection(module))
|
items = fetch_list(module, collection(module))
|
||||||
|
@ -114,12 +118,17 @@ def main():
|
||||||
items = items.get('items')
|
items = items.get('items')
|
||||||
else:
|
else:
|
||||||
items = []
|
items = []
|
||||||
return_value = {'resources': items}
|
return_value = {
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
module.exit_json(**return_value)
|
module.exit_json(**return_value)
|
||||||
|
|
||||||
|
|
||||||
def collection(module):
|
def collection(module):
|
||||||
res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')}
|
res = {
|
||||||
|
'project': module.params['project'],
|
||||||
|
'instance': replace_resource_dict(module.params['instance'], 'name')
|
||||||
|
}
|
||||||
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/users".format(**res)
|
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/users".format(**res)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,35 +15,35 @@
|
||||||
# Pre-test setup
|
# Pre-test setup
|
||||||
- name: delete a cluster
|
- name: delete a cluster
|
||||||
gcp_container_cluster:
|
gcp_container_cluster:
|
||||||
name: my-cluster
|
name: my-cluster
|
||||||
initial_node_count: 2
|
initial_node_count: 2
|
||||||
master_auth:
|
master_auth:
|
||||||
username: cluster_admin
|
username: cluster_admin
|
||||||
password: my-secret-password
|
password: my-secret-password
|
||||||
node_config:
|
node_config:
|
||||||
machine_type: n1-standard-4
|
machine_type: n1-standard-4
|
||||||
disk_size_gb: 500
|
disk_size_gb: 500
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: absent
|
state: absent
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
- name: create a cluster
|
- name: create a cluster
|
||||||
gcp_container_cluster:
|
gcp_container_cluster:
|
||||||
name: my-cluster
|
name: my-cluster
|
||||||
initial_node_count: 2
|
initial_node_count: 2
|
||||||
master_auth:
|
master_auth:
|
||||||
username: cluster_admin
|
username: cluster_admin
|
||||||
password: my-secret-password
|
password: my-secret-password
|
||||||
node_config:
|
node_config:
|
||||||
machine_type: n1-standard-4
|
machine_type: n1-standard-4
|
||||||
disk_size_gb: 500
|
disk_size_gb: 500
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is true
|
- name: assert changed is true
|
||||||
assert:
|
assert:
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- name: verify that cluster was created
|
- name: verify that cluster was created
|
||||||
gcp_container_cluster_facts:
|
gcp_container_cluster_facts:
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
@ -61,23 +61,23 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'my-cluster' in \"{{ results['items'] | map(attribute='name') | list }}\""
|
- results['items'] | length >= 1
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: create a cluster that already exists
|
- name: create a cluster that already exists
|
||||||
gcp_container_cluster:
|
gcp_container_cluster:
|
||||||
name: my-cluster
|
name: my-cluster
|
||||||
initial_node_count: 2
|
initial_node_count: 2
|
||||||
master_auth:
|
master_auth:
|
||||||
username: cluster_admin
|
username: cluster_admin
|
||||||
password: my-secret-password
|
password: my-secret-password
|
||||||
node_config:
|
node_config:
|
||||||
machine_type: n1-standard-4
|
machine_type: n1-standard-4
|
||||||
disk_size_gb: 500
|
disk_size_gb: 500
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is false
|
- name: assert changed is false
|
||||||
assert:
|
assert:
|
||||||
|
@ -86,19 +86,19 @@
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
- name: delete a cluster
|
- name: delete a cluster
|
||||||
gcp_container_cluster:
|
gcp_container_cluster:
|
||||||
name: my-cluster
|
name: my-cluster
|
||||||
initial_node_count: 2
|
initial_node_count: 2
|
||||||
master_auth:
|
master_auth:
|
||||||
username: cluster_admin
|
username: cluster_admin
|
||||||
password: my-secret-password
|
password: my-secret-password
|
||||||
node_config:
|
node_config:
|
||||||
machine_type: n1-standard-4
|
machine_type: n1-standard-4
|
||||||
disk_size_gb: 500
|
disk_size_gb: 500
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is true
|
- name: assert changed is true
|
||||||
assert:
|
assert:
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- name: verify that cluster was deleted
|
- name: verify that cluster was deleted
|
||||||
gcp_container_cluster_facts:
|
gcp_container_cluster_facts:
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
@ -116,23 +116,23 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'my-cluster' not in \"{{ results['items'] | map(attribute='name') | list }}\""
|
- results['items'] | length == 0
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: delete a cluster that does not exist
|
- name: delete a cluster that does not exist
|
||||||
gcp_container_cluster:
|
gcp_container_cluster:
|
||||||
name: my-cluster
|
name: my-cluster
|
||||||
initial_node_count: 2
|
initial_node_count: 2
|
||||||
master_auth:
|
master_auth:
|
||||||
username: cluster_admin
|
username: cluster_admin
|
||||||
password: my-secret-password
|
password: my-secret-password
|
||||||
node_config:
|
node_config:
|
||||||
machine_type: n1-standard-4
|
machine_type: n1-standard-4
|
||||||
disk_size_gb: 500
|
disk_size_gb: 500
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is false
|
- name: assert changed is false
|
||||||
assert:
|
assert:
|
||||||
|
|
|
@ -25,25 +25,25 @@
|
||||||
register: cluster
|
register: cluster
|
||||||
- name: delete a node pool
|
- name: delete a node pool
|
||||||
gcp_container_node_pool:
|
gcp_container_node_pool:
|
||||||
name: my-pool
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: absent
|
state: absent
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
- name: create a node pool
|
- name: create a node pool
|
||||||
gcp_container_node_pool:
|
gcp_container_node_pool:
|
||||||
name: my-pool
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is true
|
- name: assert changed is true
|
||||||
assert:
|
assert:
|
||||||
|
@ -51,8 +51,6 @@
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- name: verify that node_pool was created
|
- name: verify that node_pool was created
|
||||||
gcp_container_node_pool_facts:
|
gcp_container_node_pool_facts:
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
|
@ -64,18 +62,18 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'my-pool' in \"{{ results['items'] | map(attribute='name') | list }}\""
|
- results['items'] | length >= 1
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: create a node pool that already exists
|
- name: create a node pool that already exists
|
||||||
gcp_container_node_pool:
|
gcp_container_node_pool:
|
||||||
name: my-pool
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is false
|
- name: assert changed is false
|
||||||
assert:
|
assert:
|
||||||
|
@ -84,14 +82,14 @@
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
- name: delete a node pool
|
- name: delete a node pool
|
||||||
gcp_container_node_pool:
|
gcp_container_node_pool:
|
||||||
name: my-pool
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is true
|
- name: assert changed is true
|
||||||
assert:
|
assert:
|
||||||
|
@ -99,8 +97,6 @@
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- name: verify that node_pool was deleted
|
- name: verify that node_pool was deleted
|
||||||
gcp_container_node_pool_facts:
|
gcp_container_node_pool_facts:
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
|
@ -116,14 +112,14 @@
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: delete a node pool that does not exist
|
- name: delete a node pool that does not exist
|
||||||
gcp_container_node_pool:
|
gcp_container_node_pool:
|
||||||
name: my-pool
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
location: us-central1-a
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is false
|
- name: assert changed is false
|
||||||
assert:
|
assert:
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- results['items'] | length == 1
|
- results['items'] | length >= 1
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: create a subscription that already exists
|
- name: create a subscription that already exists
|
||||||
gcp_pubsub_subscription:
|
gcp_pubsub_subscription:
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- results['items'] | length == 1
|
- results['items'] | length >= 1
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: create a topic that already exists
|
- name: create a topic that already exists
|
||||||
gcp_pubsub_topic:
|
gcp_pubsub_topic:
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'webstore' in \"{{ results['items'] | map(attribute='name') | list }}\""
|
- results['items'] | length >= 1
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: create a database that already exists
|
- name: create a database that already exists
|
||||||
gcp_spanner_database:
|
gcp_spanner_database:
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'webstore' not in \"{{ results['items'] | map(attribute='name') | list }}\""
|
- results['items'] | length == 0
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: delete a database that does not exist
|
- name: delete a database that does not exist
|
||||||
gcp_spanner_database:
|
gcp_spanner_database:
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\""
|
- results['items'] | length >= 1
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: create a instance that already exists
|
- name: create a instance that already exists
|
||||||
gcp_spanner_instance:
|
gcp_spanner_instance:
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\""
|
- results['items'] | length == 0
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: delete a instance that does not exist
|
- name: delete a instance that does not exist
|
||||||
gcp_spanner_instance:
|
gcp_spanner_instance:
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\""
|
- results['items'] | length >= 1
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: create a database that already exists
|
- name: create a database that already exists
|
||||||
gcp_sql_database:
|
gcp_sql_database:
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\""
|
- results['items'] | length == 0
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: delete a database that does not exist
|
- name: delete a database that does not exist
|
||||||
gcp_sql_database:
|
gcp_sql_database:
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- results['resources'] | length >= 1
|
- results['items'] | length >= 1
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: create a instance that already exists
|
- name: create a instance that already exists
|
||||||
gcp_sql_instance:
|
gcp_sql_instance:
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- results['resources'] | length == 0
|
- results['items'] | length == 0
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: delete a instance that does not exist
|
- name: delete a instance that does not exist
|
||||||
gcp_sql_instance:
|
gcp_sql_instance:
|
||||||
|
|
|
@ -57,8 +57,6 @@
|
||||||
- "result.kind == 'sql#user'"
|
- "result.kind == 'sql#user'"
|
||||||
- name: verify that user was created
|
- name: verify that user was created
|
||||||
gcp_sql_user_facts:
|
gcp_sql_user_facts:
|
||||||
filters:
|
|
||||||
- name = test-user
|
|
||||||
instance: "{{ instance }}"
|
instance: "{{ instance }}"
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
@ -69,7 +67,7 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'test-user' in \"{{ results['items'] | map(attribute='name') | list }}\""
|
- results['items'] | length >= 1
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: create a user that already exists
|
- name: create a user that already exists
|
||||||
gcp_sql_user:
|
gcp_sql_user:
|
||||||
|
@ -106,8 +104,6 @@
|
||||||
- result.has_key('kind') == False
|
- result.has_key('kind') == False
|
||||||
- name: verify that user was deleted
|
- name: verify that user was deleted
|
||||||
gcp_sql_user_facts:
|
gcp_sql_user_facts:
|
||||||
filters:
|
|
||||||
- name = test-user
|
|
||||||
instance: "{{ instance }}"
|
instance: "{{ instance }}"
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue