Test boilerplate for Ansible role(s) for GCP IaaS scenarios. For more detail
- ansible client
- ansible.cfg file and enable gcp_compute plugin
- service account and gcp account
Playbook based project structure in Ansible projects.
If you are using role based project structure
your project folder
- ansible.cfg
- hosts
- requirements.yaml Installs roles under ~/.ansible
- provision.yaml to run roles w/ your valid vars
- configuration.yaml to run roles w/ your valid vars
inside ~/.ansible folder
- role1
- role2
- ..
- Install Ansible cli on your local w/
brew install ansible
, then checkansible --version
- Configure gcloud cli on your local. This will create
.ssh/google_compute_engine
- Create service account manually as ansible and give
roles/admin
role, or Do automatically - Edit
ansible.cfg
and changeremote_user
value - Edit
provision.yaml
file and changevars.general.project
value
- Run
ansible-galaxy install -r requirements.yaml --force
to get related roles - For provisioning, Run
ansible-playbook provision.yaml
- Edit
hosts
file, manually. Align network Tags in GCP and host grouping. - For configuration, Run,
ansible-playbook configuration.yaml -i hosts
.