gcp-packer-ansible

This example uses the packer ansible provisioner to create a GCP compute image.

Setup

[1] Create docker container

docker build -t centos7-ansible .

[2] Export environment variables, using a relative path for GOOGLE_APPLICATION_CREDENTIALS

export GOOGLE_APPLICATION_CREDENTIALS=./keys/service_account.json
export GCP_PROJECT=PROJECT_ID

Test playbook

[1] Test playbook inside docker container

./docker-test.sh

Create image

[1] Start docker ansible control node

./docker-run.sh

[2] Create packer image

packer build centos.json