Tagging an instance is useful for organization as well as it is helpful while creating firewall rules. When we start using dynamic inventory, then tagging will be helpful in running playbooks against a certain set of instances tagged with a certain string.
Tagging an instance
How to do it...
Tagging an instance is straightforward using the gce_tag module:
- name: set tag for the instance
gce_tag:
instance_name: app
tags: http
zone: "{{ zone }}"
state: present
pem_file: "{{ credentials_file }}"
service_account_email: "{{ service_account_email }}"
project_id: "{{ project_id }}"
tags:
- recipe5
Here we have just tagged the instance as http. We can specify any number...