Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms


gce (2) Versions 0.1.0

LWRPs for managing GCE resources

cookbook 'gce', '= 0.1.0'
cookbook 'gce', '= 0.1.0', :supermarket
knife supermarket install gce
knife supermarket download gce
Quality -%

Google Compute Engine Cookbook LWRP


This cookbook provides libraries, resources and providers to configure and manage Google Compute Enginge components. The currently supported GCE resources are:

  • disks (disk)
  • firewalls (firewall)
  • instances (instance)
  • lb forwarding rules (lb_forwardingrule)
  • lb health checks (lb_healthcheck)
  • lb target pools (lb_targetpool)
  • metadata (metadata)
  • networks (network)
  • snapshots (snapshot)
  • tags (tags)


Requires fog ruby gem to interact with GCP.

Authorizing Setup

In order to use the Google Compute Engine cookbook with your servers, you will first need to authorize its use of the Google Compute Engine API. Authorization to use any of Google's Cloud service API's utilizes an OAuth 2.0 Service account. Once your project has been created, log in to the Google Developers Console and select your project. Next select APIs & auth then Credentials. Create a new "Client ID" and specify "Service account". This will generate a new public/private key pair.

    % knife data bag show gce service_account
      "google_project_id": "my-gce-project",
      "google_client_email": "",
      "google_key_location": "/home/user/.my-gce-project-private-key.p12"

This can be loaded in a recipe with:

    gce = data_bag_item("gce", "service_account")

And to access the values:



Download and install as you would other cookbooks.

From the Chef Community Site

knife cookbook site install gce

Using Librarian-Chef

Librarian-Chef Librarian is a framework for writing bundlers, which are tools that resolve, fetch, install, and isolate a project's dependencies, in Ruby.

To use the Opscode platform version:

    echo "cookbook 'gce'" >> Cheffile
    librarian-chef install

To use the Git version:

    echo "cookbook 'gce', :git => ''" >> Cheffile
    librarian-chef install



The default recipe installs the fog ruby gem, which this cookbook requires in order to work with the GCE API. Make sure that the google-compute-engine recipe is in the node or role run_list before any resources from this cookbook are used.

    "run_list": [


The cookbook has a library module, Google::Gce, which can be included where necessary:

  include Google::Gce

Resources and Providers

This cookbook provides a resource and corresponding provider.


Manage GCE persistent disk with this resource.


  • create - create a new disk.
  • delete - delete a disk.
  • attach - attach the specified disk. (NOT YET IMPLEMENTED)
  • detach - detach the specified volume. (NOT YET IMPLEMENTED)

Attribute Parameters:


  • create - create a new firewall.
  • delete - delete a firewall.


  • create - create a new instance.
  • delete - delete a instance.


  • create - create a new forwarding rule.
  • delete - delete a forwarding rule.


  • create - create a new healthcheck.
  • delete - delete a healthcheck.


  • create - create a new targetpool.
  • add_instance - add instance to targetpool.
  • add_healthcheck - add healthcheck to targetpool.
  • remove_instance - remove instance from a targetpool.
  • remove_healthcheck - remove healthcheck from a targetpool.
  • delete - delete a targetpool.


  • set - set instance metadata.
  • delete - delete instance metadata.


  • create - create a new network.
  • delete - delete a network.


  • create - create a new snapshot.
  • delete - delete a snapshot.


  • set - set instance tags.
  • delete - delete instance tags.



This will create a new instance.

    gce_instance "my-gce-instance" do
      machine_type "n1-standard-1"
      zone_name "us-central1-a"
      boot_disk_image "debian-7-wheezy-v20140318"
      service_account_scopes ["compute", "", "devstorage.full_control"]
      auto_restart true
      on_host_maintenance "MIGRATE"
      action :create

License and Authors

Copyright 2014, Google, Inc.

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.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

No quality metric results found