Create a FreeBSD GCE instance with salt-cloud
When creating a Google Compute Engine instance from a publicly shared image which is not in your own project nor one of the default projects - such as FreeBSD - the image-project can be specified on the gcloud command line. Here's how to do the same when using salt-cloud instead of gcloud:
Assuming we have a working command line such as this:
First we have to find the URI of the public image:
…which gives the following URI in this case:
Now the URI can be used in a salt-cloud profile instead of the image name, for example:
Note to self: remember to escape the URI string using quotation marks ;-)
Summary
When an instance is created from an image using either gcloud compute instance create
or salt-cloud -p profile create
, both utilities search for the image in the same project as the instance as well as the “well-known image projects”, which are “centos-cloud, coreos-cloud, debian-cloud, google-containers, opensuse-cloud, rhel-cloud, suse-cloud, ubuntu-os-cloud, windows-cloud”.
gcloud
let’s you use images from other projects by specifying the --image-project
parameter, while salt-cloud
does not (presumably because libcloud does not support it either, this Apache library is used by salt-cloud
under the hood). However, by using gcloud
to find the URI of the public image we want to use, we can get salt-cloud
to use any publicly available image for our instances.
Kudos to Agam for pointing me at the freebsd-org-cloud-dev image repository in the first place.