ansible.builtin.gce_pd (v2.9.27) — module

utilize GCE persistent disk resources

| "added in version" 1.4 of ansible.builtin"

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

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

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.
# 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

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

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

image:
    description:
    - the source image to use for the disk
    version_added: '1.7'
    version_added_collection: ansible.builtin

state:
    choices:
    - active
    - present
    - absent
    - deleted
    default: present
    description:
    - desired state of the persistent disk

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

pem_file:
    description:
    - path to the pem file associated with the service account email This option is deprecated.
      Use 'credentials_file'.
    version_added: '1.6'
    version_added_collection: ansible.builtin

snapshot:
    description:
    - the source snapshot to use for the disk
    version_added: '1.7'
    version_added_collection: ansible.builtin

disk_type:
    choices:
    - pd-standard
    - pd-ssd
    default: pd-standard
    description:
    - type of disk provisioned
    version_added: '1.9'
    version_added_collection: ansible.builtin

project_id:
    description:
    - your GCE project ID
    version_added: '1.6'
    version_added_collection: ansible.builtin

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

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

credentials_file:
    description:
    - path to the JSON file associated with the service account email
    version_added: 2.1.0
    version_added_collection: ansible.builtin

delete_on_termination:
    default: 'no'
    description:
    - If C(yes), deletes the volume when instance is terminated
    type: bool
    version_added: '2.3'
    version_added_collection: ansible.builtin

service_account_email:
    description:
    - service account email
    version_added: '1.6'
    version_added_collection: ansible.builtin