gcp_spanner_instance - Creates a GCP Instance

New in version 2.7.

Synopsis

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.6
  • requests >= 2.18.4
  • google-auth >= 1.3.0

Parameters

Parameter Choices/Defaults Comments
auth_kind
required
    Choices:
  • machineaccount
  • serviceaccount
  • application
The type of credential used.
config
A reference to the instance configuration.
display_name
required
The descriptive name for this instance as it appears in UIs. Must be unique per project and between 4 and 30 characters in length.
labels
Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources into groups that reflect a customer's organizational needs and deployment strategies. Cloud Labels can be used to filter collections of resources. They can be used to control how resource metrics are aggregated. And they can be used as arguments to policy management rules (e.g. route, firewall, load balancing, etc.).
Label keys must be between 1 and 63 characters long and must conform to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
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 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" }.
name
A unique identifier for the instance, which cannot be changed after the instance is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]. The final segment of the name must be between 6 and 30 characters in length.
node_count
The number of nodes allocated to this instance.
project Default:
None
The Google Cloud Platform project to use.
scopes
Array of scopes to be used.
service_account_email
An optional service account email address if machineaccount is selected and the user does not wish to use the default email.
service_account_file
The path of a Service Account JSON file if serviceaccount is selected as type.
state
    Choices:
  • present ←
  • absent
Whether the given object should exist in GCP

Notes

Note

  • For authentication, you can set service_account_file using the GCP_SERVICE_ACCOUNT_FILE env variable.
  • For authentication, you can set service_account_email using the GCP_SERVICE_ACCOUNT_EMAIL env variable.
  • For authentication, you can set auth_kind using the GCP_AUTH_KIND env variable.
  • For authentication, you can set scopes using the GCP_SCOPES env variable.
  • Environment variables values will only be used if the playbook values are not set.
  • The service_account_email and service_account_file options are mutually exclusive.

Examples

- name: create a instance
  gcp_spanner_instance:
      name: "test_object"
      display_name: My Spanner Instance
      node_count: 2
      labels:
        cost_center: ti-1700004
      config: regional-us-central1
      project: "test_project"
      auth_kind: "service_account"
      service_account_file: "/tmp/auth.pem"
      state: present

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
config
str
success
A reference to the instance configuration.

display_name
str
success
The descriptive name for this instance as it appears in UIs. Must be unique per project and between 4 and 30 characters in length.

labels
dict
success
Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources into groups that reflect a customer's organizational needs and deployment strategies. Cloud Labels can be used to filter collections of resources. They can be used to control how resource metrics are aggregated. And they can be used as arguments to policy management rules (e.g. route, firewall, load balancing, etc.).
Label keys must be between 1 and 63 characters long and must conform to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
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 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" }.

name
str
success
A unique identifier for the instance, which cannot be changed after the instance is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]. The final segment of the name must be between 6 and 30 characters in length.

node_count
int
success
The number of nodes allocated to this instance.



Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Google Inc. (@googlecloudplatform)

Hint

If you notice any issues in this documentation you can edit this document to improve it.