Chef and Google

[edit on GitHub]

Google Cloud Platform is a suite of cloud computing services that run on the same infrastructure that Google uses internally for its end-user products, such as Google Search and YouTube. Alongside a set of management tools, it provides a series of modular cloud services including computing, data storage, data analytics, and machine learning. This page outlines the different tools that can be used to integrate Chef with the Google Cloud Platform.

knife-google

[GitHub]

This plugin gives knife the ability to create, bootstrap, and manage Google Compute Engine (GCE) instances.

Authentication and Authorization

knife-google relies on the Google Auth Library to handle authentication to the Google Cloud API. The auth library expects to find a JSON credentials file located under ~/.config/gcloud/application_default_credentials.json.

The easiest way to create this is to download and install the Google Cloud SDK and run the gcloud auth application-default login command, which will create the credentials file for you.

If you already have a file you’d like to use that is in a different location, set the GOOGLE_APPLICATION_CREDENTIALS environment variable with the full path to that file.

These are the necessary settings for your config.rb file:

knife[:gce_project] = 'my-test-project'
knife[:gce_zone]    = 'us-east1-b'

Usage Examples

Create a server:

knife google server create test-instance-1 --gce-image centos-7-v20160219 \
--gce-machine-type n1-standard-2 --gce-public-ip ephemeral --connection-user myuser \
--identity-file /Users/myuser/.ssh/google_compute_engine

Delete multiple servers:

knife google server delete my-instance-1 my-instance-2 --purge

List all servers:

knife google server list

kitchen-google

[GitHub]

A test kitchen driver for Google Cloud Platform.

Usage Examples

The following is a basic kitchen.yml example:

---driver:name:gceproject:mycompany-testzone:us-east1-cemail:[email protected]tags:- devteam- test-kitchenservice_account_scopes:- devstorage.read_write- userinfo.emailprovisioner:name:chef_zerotransport:username:chefuserplatforms:- name:centos-7driver:image_project:centos-cloudimage_name:centos-7-v20170124- name:ubuntu-16.04driver:image_project:ubuntu-os-cloudimage_family:ubuntu-1604-lts- name:windowsdriver:image_project:windows-cloudimage_name:windows-server-2012-r2-dc-v20170117disk_size:50suites:- name:defaultrun_list:- recipe[COOKBOOK::default]attributes:

© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/google/