On this page
gcspanner - Create and Delete Instances/Databases on Spanner.
New in version 2.3.
Synopsis
- Create and Delete Instances/Databases on Spanner. See https://cloud.google.com/spanner/docs for an overview.
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 |
---|---|---|---|---|
database_name |
Name of database.
|
When database name is specified | str | mydatabase |
instance_id |
Name of instance.
|
Always | str | myinstance |
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 } } |
state |
The state of the instance or database. Value will be either 'absent' or 'present'.
|
Always | str | present |
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.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/gcspanner_module.html