salt.cloud.clouds.gce

Copyright 2013 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Google Compute Engine Module

The Google Compute Engine module. This module interfaces with Google Compute Engine. To authenticate to GCE, you will need to create a Service Account.

Setting up Service Account Authentication:
  • Go to the Cloud Console at: https://cloud.google.com/console.
  • Create or navigate to your desired Project.
  • Make sure Google Compute Engine service is enabled under the Services section.
  • Go to "APIs and auth" and then the "Registered apps" section.
  • Click the "REGISTER APP" button and give it a meaningful name.
  • Select "Web Application" and click "Register".
  • Select Certificate, then "Generate Certificate"
  • Copy the Email Address for inclusion in your /etc/salt/cloud file in the 'service_account_email_address' setting.
  • Download the Private Key
  • The key that you download is a PKCS12 key. It needs to be converted to the PEM format.
  • Convert the key using OpenSSL (the default password is 'notasecret'): C{openssl pkcs12 -in PRIVKEY.p12 -passin pass:notasecret -nodes -nocerts | openssl rsa -out ~/PRIVKEY.pem}
  • Add the full path name of the converted private key to your /etc/salt/cloud file as 'service_account_private_key' setting.
  • Consider using a more secure location for your private key.
Supported commands:
# Create a few instances fro profile_name in /etc/salt/cloud.profiles - salt-cloud -p profile_name inst1 inst2 inst3 # Delete an instance - salt-cloud -d inst1 # Look up data on an instance - salt-cloud -a show_instance inst2 # List available locations (aka 'zones') for provider 'gce' - salt-cloud --list-locations gce # List available instance sizes (aka 'machine types') for provider 'gce' - salt-cloud --list-sizes gce # List available images for provider 'gce' - salt-cloud --list-images gce
my-gce-config:
  # The Google Cloud Platform Project ID
  project: google.com:erjohnso
  # The Service ACcount client ID
  service_account_email_address: 1234567890@developer.gserviceaccount.com
  # The location of the private key (PEM format)
  service_account_private_key: /home/erjohnso/PRIVKEY.pem
  provider: gce
maintainer:Eric Johnson <erjohnso@google.com>
maturity:new
depends:libcloud >= 0.14.0-beta3
depends:pycrypto >= 2.1
salt.cloud.clouds.gce.avail_images(conn=None)

Return a dict of all available VM images on the cloud provider with relevant data

Note that for GCE, there are custom images within the project, but the generic images are in other projects. This returns a dict of images in the project plus images in 'debian-cloud' and 'centos-cloud' (If there is overlap in names, the one in the current project is used.)

salt.cloud.clouds.gce.avail_locations(conn=None, call=None)

Return a dict of all available VM locations on the cloud provider with relevant data

salt.cloud.clouds.gce.avail_sizes(conn=None)

Return a dict of available instances sizes (a.k.a machine types) and convert them to something more serializable.

salt.cloud.clouds.gce.create(vm_=None, call=None)

Create a single GCE instance from a data dict.

salt.cloud.clouds.gce.destroy(vm_name, call=None)

Call 'destroy' on the instance. Can be called with "-a destroy" or -d

salt.cloud.clouds.gce.get_configured_provider()

Return the first configured instance.

salt.cloud.clouds.gce.get_conn()

Return a conn object for the passed VM data

salt.cloud.clouds.gce.list_nodes(conn=None, call=None)

Return a list of the VMs that are on the provider

salt.cloud.clouds.gce.list_nodes_full(conn=None, call=None)

Return a list of the VMs that are on the provider, with all fields

salt.cloud.clouds.gce.list_nodes_select(conn=None, call=None)

Return a list of the VMs that are on the provider, with select fields

salt.cloud.clouds.gce.reboot(vm_name, call=None)

Call GCE 'reset' on the instance.

salt.cloud.clouds.gce.script(vm_)

Return the script deployment object

salt.cloud.clouds.gce.show_instance(vm_name, call=None)

Show the details of the existing instance.

Current Salt release: 2014.1.6

Docs for previous releases on salt.rtfd.org.

Table Of Contents

Previous topic

salt.cloud.clouds.ec2

Next topic

salt.cloud.clouds.gogrid

Upcoming SaltStack Events