community.general.gce_pd (1.3.14) — module

utilize GCE persistent disk resources

Authors: Eric Johnson (@erjohnso) <erjohnso@google.com>

Install collection

Install with ansible-galaxy collection install community.general:==1.3.14


Add to requirements.yml

  collections:
    - name: community.general
      version: 1.3.14

Description

This module can create and destroy unformatted GCE persistent disks U(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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Simple attachment action to an existing instance
  local_action:
    module: gce_pd
    instance_name: notlocalhost
    size_gb: 5
    name: pd

Inputs

    
mode:
    choices:
    - READ_WRITE
    - READ_ONLY
    default: READ_ONLY
    description:
    - GCE mount mode of disk, READ_ONLY (default) or READ_WRITE
    type: str

name:
    description:
    - name of the disk
    required: true
    type: str

zone:
    default: us-central1-b
    description:
    - zone in which to create the disk
    type: str

image:
    description:
    - the source image to use for the disk
    type: str

state:
    default: present
    description:
    - desired state of the persistent disk
    - 'Available choices are: C(active), C(present), C(absent), C(deleted).'
    type: str

size_gb:
    default: '10'
    description:
    - whole integer size of disk (in GB) to create, default is 10 GB
    type: str

pem_file:
    description:
    - path to the pem file associated with the service account email This option is deprecated.
      Use 'credentials_file'.
    type: path

snapshot:
    description:
    - the source snapshot to use for the disk
    type: str

disk_type:
    default: pd-standard
    description:
    - Specify a C(pd-standard) disk or C(pd-ssd) for an SSD disk.
    type: str

project_id:
    description:
    - your GCE project ID
    type: str

detach_only:
    description:
    - do not destroy the disk, merely detach it from an instance
    type: bool

image_family:
    description:
    - The image family to use to create the instance. If I(image) has been used I(image_family)
      is ignored. Cannot specify both I(image) and I(source).
    type: str

instance_name:
    description:
    - instance name if you wish to attach or detach the disk
    type: str

credentials_file:
    description:
    - path to the JSON file associated with the service account email
    type: path

external_projects:
    description:
    - A list of other projects (accessible with the provisioning credentials) to be searched
      for the image.
    type: list

delete_on_termination:
    description:
    - If C(yes), deletes the volume when instance is terminated
    type: bool

service_account_email:
    description:
    - service account email
    type: str