On this page
gce_pd - utilize GCE persistent disk resources
New in version 1.4.
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 (on host that executes module)
- python >= 2.6
- apache-libcloud >= 0.13.3, >= 0.17.0 if using JSON credentials
Options
parameter | required | default | choices | comments |
---|---|---|---|---|
credentials_file
(added in 2.1.0)
|
no |
path to the JSON file associated with the service account email
|
||
delete_on_termination
(added in 2.3)
|
no |
|
If yes, deletes the volume when instance is terminated
|
|
detach_only |
no | no |
|
do not destroy the disk, merely detach it from an instance
|
disk_type
(added in 1.9)
|
no | pd-standard |
|
type of disk provisioned
|
image
(added in 1.7)
|
no |
the source image to use for the disk
|
||
instance_name |
no |
instance name if you wish to attach or detach the disk
|
||
mode |
no | READ_ONLY |
|
GCE mount mode of disk, READ_ONLY (default) or READ_WRITE
|
name |
yes |
name of the disk
|
||
pem_file
(added in 1.6)
|
no |
path to the pem file associated with the service account email This option is deprecated. Use 'credentials_file'.
|
||
project_id
(added in 1.6)
|
no |
your GCE project ID
|
||
service_account_email
(added in 1.6)
|
no |
service account email
|
||
size_gb |
no | 10 |
whole integer size of disk (in GB) to create, default is 10 GB
|
|
snapshot
(added in 1.7)
|
no |
the source snapshot to use for the disk
|
||
state |
no | present |
|
desired state of the persistent disk
|
zone |
no | 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
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/gce_pd_module.html