gce_pd – utilize GCE persistent disk resources

Synopsis

  • This module can create and destroy unformatted GCE persistent disks https://developers.google.com/compute/docs/disks#persistentdisks. It also supports attaching and detaching disks from running instances. Full install/configuration instructions for the gce* modules can be found in the comments of ansible/test/gce_tests.py.

Requirements

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

  • python >= 2.6

  • apache-libcloud >= 0.13.3, >= 0.17.0 if using JSON credentials

Parameters

Parameter Choices/Defaults Comments
credentials_file
-
path to the JSON file associated with the service account email
delete_on_termination
boolean
    Choices:
  • no ←
  • yes
If yes, deletes the volume when instance is terminated
detach_only
boolean
    Choices:
  • no ←
  • yes
do not destroy the disk, merely detach it from an instance
disk_type
-
    Choices:
  • pd-standard ←
  • pd-ssd
type of disk provisioned
image
-
the source image to use for the disk
instance_name
-
instance name if you wish to attach or detach the disk
mode
-
    Choices:
  • READ_WRITE
  • READ_ONLY ←
GCE mount mode of disk, READ_ONLY (default) or READ_WRITE
name
- / required
name of the disk
pem_file
-
path to the pem file associated with the service account email This option is deprecated. Use 'credentials_file'.
project_id
-
your GCE project ID
service_account_email
-
service account email
size_gb
-
Default:
10
whole integer size of disk (in GB) to create, default is 10 GB
snapshot
-
the source snapshot to use for the disk
state
-
    Choices:
  • active
  • present ←
  • absent
  • deleted
desired state of the persistent disk
zone
-
Default:
"us-central1-b"
zone in which to create the disk

Examples

# Simple attachment action to an existing instance
- local_action:
    module: gce_pd
    instance_name: notlocalhost
    size_gb: 5
    name: pd

Status

Authors

Hint

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