Create a FreeBSD GCE instance with salt-cloud
-
Assuming we have a working command line such as this:
Terminal window gcloud compute instances create my-freebsd-host --image freebsd-10-3-release-amd64 --image-project=freebsd-org-cloud-dev -
First we have to find the URI of the public image:
Terminal window gcloud compute images list --project freebsd-org-cloud-dev --uri --regexp freebsd-10-3-release-amd64…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:
Terminal window sudo nano /etc/salt/cloud.profiles.d/my-freebsd-host.confmy-freebsd-host:image: "https://www.googleapis.com/compute/v1/projects/freebsd-org-cloud-dev/global/images/freebsd-10-3-release-amd64"size: n1-standard-2location: europe-west1-bnetwork: defaultprovider: gcessh_username: freebsd
Note to self: remember to escape the URI string using quotation marks ;-)
Summary
Section titled “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.