New in version 2.3.
- python >= 2.6
- apache-libcloud >= 0.13.3, >= 0.17.0 if using JSON credentials, >= 0.20.0 if using preemptible option
parameter | required | default | choices | comments |
---|---|---|---|---|
automatic_restart |
no | Defines whether the instance should be automatically restarted when it is terminated by Compute Engine. | ||
can_ip_forward |
no | Set to True to allow instance to send/receive non-matching src/dst packets. | ||
credentials_file |
no | path to the JSON file associated with the service account email | ||
description |
no | description of instance template | ||
disk_auto_delete |
no | True | Indicate that the boot disk should be deleted when the Node is deleted. | |
disk_type |
no | pd-standard | Specify a pd-standard disk or pd-ssd for an SSD disk. | |
disks |
no | a list of persistent disks to attach to the instance; a string value gives the name of the disk; alternatively, a dictionary value can define 'name' and 'mode' ('READ_ONLY' or 'READ_WRITE'). The first entry will be the boot disk (which must be READ_WRITE). | ||
external_ip |
no | ephemeral | The external IP address to use. If ephemeral , a new non-static address will be used. If None , then no external address will be used. To use an existing static IP address specify adress name. | |
image |
no | The image to use to create the instance. Cannot specify both both image and source. | ||
image_family |
no | The image family to use to create the instance. If image has been used image_family is ignored. Cannot specify both image and source. | ||
metadata |
no | a hash/dictionary of custom data for the instance; '{"key":"value", ...}' | ||
name |
yes | The name of the GCE instance template. | ||
network |
no | default | The network to associate with the instance. | |
nic_gce_struct |
no | Support passing in the GCE-specific formatted networkInterfaces[] structure. | ||
pem_file |
no | path to the pem file associated with the service account email This option is deprecated. Use 'credentials_file'. | ||
preemptible |
no | Defines whether the instance is preemptible. | ||
project_id |
no | your GCE project ID | ||
service_account_email |
no | service account email | ||
service_account_permissions |
no |
|
service account permissions (see https://cloud.google.com/sdk/gcloud/reference/compute/instances/create, --scopes section for detailed information) | |
size |
no | f1-micro | The desired machine type for the instance template. | |
source |
no | A source disk to attach to the instance. Cannot specify both image and source. | ||
state |
no | present |
|
The desired state for the instance template. |
subnetwork |
no | The Subnetwork resource name for this instance. | ||
tags |
no | a comma-separated list of tags to associate with the instance |
# Usage - name: create instance template named foo gce_instance_template: name: foo size: n1-standard-1 image_family: ubuntu-1604-lts state: present project_id: "your-project-name" credentials_file: "/path/to/your-key.json" service_account_email: "your-sa@your-project-name.iam.gserviceaccount.com" # Example Playbook - name: Compute Engine Instance Template Examples hosts: localhost vars: service_account_email: "your-sa@your-project-name.iam.gserviceaccount.com" credentials_file: "/path/to/your-key.json" project_id: "your-project-name" tasks: - name: create instance template gce_instance_template: name: my-test-instance-template size: n1-standard-1 image_family: ubuntu-1604-lts state: present project_id: "{{ project_id }}" credentials_file: "{{ credentials_file }}" service_account_email: "{{ service_account_email }}" - name: delete instance template gce_instance_template: name: my-test-instance-template size: n1-standard-1 image_family: ubuntu-1604-lts state: absent project_id: "{{ project_id }}" credentials_file: "{{ credentials_file }}" service_account_email: "{{ service_account_email }}"
Note
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is community maintained without core committer oversight.
For more information on what this means please read Module Support
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.