Documentation

gcspanner - Create and Delete Instances/Databases on Spanner

New in version 2.3.

Synopsis

Requirements

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

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

Parameters

Parameter Choices/Defaults Comments
configuration
required
Configuration the instance should use.
Examples are us-central1, asia-east1 and europe-west1.
database_name
Name of database contained on the instance.
force_instance_delete
bool
    Choices:
  • no ←
  • yes
To delete an instance, this argument must exist and be true (along with state being equal to absent).
instance_display_name
Name of Instance to display.
If not specified, instance_id will be used instead.
instance_id
required
GCP spanner instance name.
node_count Default:
1
Number of nodes in the instance.
state
    Choices:
  • absent
  • present ←
State of the instance or database. 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.

Notes

Note

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

Examples

- name: Create instance
  gcspanner:
    instance_id: '{{ instance_id }}'
    configuration: '{{ configuration }}'
    state: present
    node_count: 1

- name: Create database
  gcspanner:
    instance_id: '{{ instance_id }}'
    configuration: '{{ configuration }}'
    database_name: '{{ database_name }}'
    state: present

- name: 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, the following are the fields unique to this module:

Key Returned Description
database_name
str
When database name is specified
Name of database.

Sample:
mydatabase
instance_id
str
Always
Name of instance.

Sample:
myinstance
previous_values
dict
When an instance update has occurred and a field has been modified.
List of dictionaries containing previous values prior to update.

Sample:
'previous_values': { 'instance': { 'instance_display_name': 'my-instance', 'node_count': 1 } }
state
str
Always
The state of the instance or database. Value will be either 'absent' or 'present'.

Sample:
present
updated
bool
When an update has occurred.
Boolean field to denote an update has occurred.

Sample:
True


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

Hint

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