Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ansible party in the [Google] clouds


Published on

A small demo on how to run Ansible playbooks against Google Cloud instances

Published in: Software
  • Be the first to comment

Ansible party in the [Google] clouds

  1. 1. Esther Lozano | @esloho
  2. 2. Set up the place: GCE - Create project and add instances in Google Cloud Engine - Check the first steps tutorial for VM instances - Add ssh public key to project - Compute engine → Metadata → SSH keys - Test ssh connection from your local - Create service key and download it (i.e. ansible_service_account.json) - IAM & admin → Service account → Create key - Place it into your ansible project - Install gcloud in your local machine (optional)
  3. 3. Manage invitations: Ansible - Copy from contrib/inventory files gce.ini and into your inventory - Download from - Create - Use absolute path or relative to playbook execution for ansible_service_account.json - Indicate absolute path of in gce.ini - pip install apache-libcloud - Test the gce connection - $ inventory/ --list - $ ansible all -u esloho -i inventory/ -m ping
  4. 4. Party! - Run your playbooks as usual - $ ansible-playbook -i inventory monitoring.yml - Select hosts by network tag from your gce instances - hosts: tag_mongo - hosts: all:!tag_http_server - Host configuration (host_vars, --limit, hosts…) by instance name - Possible to combine static inventory and dynamic
  5. 5. Some party favors - Ansible documentation for GCE - Managing SSH keys in GCE - Service account keys and permissions - Github repository of this demo