Documentation

gcspanner - Create and Delete Instances/Databases on Spanner.

New in version 2.3.

Synopsis

Requirements (on host that executes module)

  • python >= 2.6
  • google-auth >= 0.5.0
  • google-cloud-spanner >= 0.23.0

Options

parameter required default choices comments
configuration
yes
Configuration the instance should use. Examples are us-central1, asia-east1 and europe-west1.
database_name
no
Name of database contained on the instance.
force_instance_delete
no
To delete an instance, this argument must exist and be true (along with state being equal to absent).
instance_display_name
no
Name of Instance to display. If not specified, instance_id will be used instead.
instance_id
yes
GCP spanner instance name.
node_count
no
Number of nodes in the instance. If not specified while creating an instance, node_count will be set to 1.
state
no present
State of the instance or database (absent, present). Applies to the most granular resource. If a database_name is specified we remove it. If only instance_id is specified, that is what is removed.

Examples

# Create instance.
gcspanner:
  instance_id: "{{ instance_id }}"
  configuration: "{{ configuration }}"
  state: present
  node_count: 1

# Create database.
gcspanner:
  instance_id: "{{ instance_id }}"
  configuration: "{{ configuration }}"
  database_name: "{{ database_name }}"
  state: present

# Delete instance (and all databases)
gcspanner:
  instance_id: "{{ instance_id }}"
  configuration: "{{ configuration }}"
  state: absent
  force_instance_delete: yes

Return Values

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

name description returned type sample
instance_id
Name of instance.
Always str myinstance
database_name
Name of database.
When database name is specified str mydatabase
state
The state of the instance or database. Value will be either 'absent' or 'present'.
Always str present
previous_values
List of dictionaries containing previous values prior to update.
When an instance update has occurred and a field has been modified. dict 'previous_values': { 'instance': { 'instance_display_name': 'my-instance', 'node_count': 1 } }
updated
Boolean field to denote an update has occurred.
When an update has occurred. bool True


Notes

Note

  • Changing the configuration on an existing instance is not supported.

Status

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

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.