I'd like access to compute engine instance metadata and labels I've set via the developer console for use in my ansible scripts. I'd like to be able to use these values like any other ansible gathered variable. Is that possible?



You should be able to use the GCE metadata by using gce-dynamic-inventory script.

You can access the instances with the dynamic inventory like this:

- name: Setup web servers
  hosts: tag_webserver

Follow the linked instructions on how to setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.