gce_pd - utilize GCE persistent disk resources

Author:Eric Johnson <erjohnso@google.com>

Synopsis

New in version 1.4.

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.

Options

parameter required default choices comments
detach_only no no
  • yes
  • no
do not destroy the disk, merely detach it from an instance
image no
    the source image to use for the disk (added in Ansible 1.7)
    instance_name no
      instance name if you wish to attach or detach the disk
      mode no READ_ONLY
      • READ_WRITE
      • READ_ONLY
      GCE mount mode of disk, READ_ONLY (default) or READ_WRITE
      name yes
        name of the disk
        pem_file no
          path to the pem file associated with the service account email (added in Ansible 1.6)
          project_id no
            your GCE project ID (added in Ansible 1.6)
            service_account_email no
              service account email (added in Ansible 1.6)
              size_gb no 10
                whole integer size of disk (in GB) to create, default is 10 GB
                snapshot no
                  the source snapshot to use for the disk (added in Ansible 1.7)
                  state no present
                  • active
                  • present
                  • absent
                  • deleted
                  desired state of the persistent disk
                  zone no us-central1-b
                    zone in which to create the disk

                    Note

                    Requires libcloud

                    Examples


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

                    Table Of Contents

                    Previous topic

                    gce_net - create/destroy GCE networks and firewall rules

                    Next topic

                    glance_image - Add/Delete images from glance