Since I have been recently experimenting with OpenBSD 6.6 on Google Cloud Compute, I put together a small bootstrap script to help with new deployments to GCP. It is still in it’s infant stages, but so far it will deploy a couple different scripts on top of the typical basic findelabs OpenBSD bootstrap.
This bootstrap script is stored in the same place as all other bootstraps on findelab’s openbsd-ansible-deploy repo. Now the idea would be to first create an image for GCP based on this article. The before-mentioned bootstrap script would then be set within the metadata of any new VM created.
The basic GCP bootstrap script sets up a very basic OpenBSD install:
# Bootstrap the system ftp -V -o - https://github.com/findelabs/openbsd-ansible-deploy/raw/master/bootstraps/bootstrap_raw.sh | sh # Extra variables for playbook extra_vars="\ role_sysctl_task=gcp_sysctl" # Run playbook cd /root/git/openbsd-ansible-deploy/ && ansible-playbook install.yml --tags=users,system,sysctl,gcp --extra-vars="$extra_vars"
That first script that is loaded, bootstrap_raw.sh, first initializes the server in preparation for running an ansible playbook. These steps are required as OpenBSD does not have the required packages installed by default:
# Setup installurl echo "http://ftp.openbsd.org/pub/OpenBSD/" > /etc/installurl # Install git export PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -p) && pkg_add -I git ansible # Make git folder mkdir /root/git cd /root/git # Clone playbook if [ -d /root/git/openbsd-ansible-deploy ] then cd /root/git/openbsd-ansible-deploy && git pull else git clone https://github.com/findelabs/openbsd-ansible-deploy.git fi
Has been tested on OpenBSD 6.6