community.general.gce_img (0.1.1) — module

utilize GCE image resources

Authors: Tom Melendez (@supertom)

preview | supported by community

Install collection

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


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

This module can create and delete GCE private images from gzipped compressed tarball containing raw disk data or from existing detached disks in any zone. U(https://cloud.google.com/compute/docs/images)


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create an image named test-image from the disk 'test-disk' in zone us-central1-a.
- gce_img:
    name: test-image
    source: test-disk
    zone: us-central1-a
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create an image named test-image from a tarball in Google Cloud Storage.
- gce_img:
    name: test-image
    source: https://storage.googleapis.com/bucket/path/to/image.tgz
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Alternatively use the gs scheme
- gce_img:
    name: test-image
    source: gs://bucket/path/to/image.tgz
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Delete an image named test-image.
- gce_img:
    name: test-image
    state: absent

Inputs

    
name:
    description:
    - the name of the image to create or delete
    required: true

zone:
    default: us-central1-a
    description:
    - the zone of the disk specified by source

state:
    choices:
    - present
    - absent
    default: present
    description:
    - desired state of the image

family:
    description:
    - an optional family name

source:
    description:
    - the source disk or the Google Cloud Storage URI to create the image from

timeout:
    default: 180
    description:
    - timeout for the operation

pem_file:
    description:
    - path to the pem file associated with the service account email

project_id:
    description:
    - your GCE project ID

description:
    description:
    - an optional description

service_account_email:
    description:
    - service account email