Note
This plugin is part of the community.google collection (version 1.0.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.google.
To use it in a playbook, specify: community.google.gce_tag.
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| instance_name string | The name of the GCE instance to add/remove tags. Required if instance_pattern is not specified. | |
| instance_pattern string | The pattern of GCE instance names to match for adding/removing tags. Full-Python regex is supported. See https://docs.python.org/2/library/re.html for details. If instance_name is not specified, this field is required. | |
| pem_file path | Path to the PEM file associated with the service account email. | |
| project_id string | Your GCE project ID. | |
| service_account_email string | Service account email. | |
| state string |
| Desired state of the tags. |
| tags list / elements=string / required | Comma-separated list of tags to add or remove. | |
| zone string | Default: "us-central1-a" | The zone of the disk specified by source. |
Note
- name: Add tags to instance
community.google.gce_tag:
instance_name: staging-server
tags: http-server,https-server,staging
zone: us-central1-a
state: present
- name: Remove tags from instance in default zone (us-central1-a)
community.google.gce_tag:
instance_name: test-server
tags: foo,bar
state: absent
- name: Add tags to instances in zone that match pattern
community.google.gce_tag:
instance_pattern: test-server-*
tags: foo,bar
zone: us-central1-a
state: present
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/google/gce_tag_module.html