W3cubDocs

/Ansible

gce_tag - add or remove tag(s) to/from GCE instance

New in version 2.0.

Synopsis

This module can add or remove tags https://cloud.google.com/compute/docs/instances/#tags to/from GCE instance.

Requirements (on host that executes module)

  • python >= 2.6
  • apache-libcloud

Options

parameter required default choices comments
instance_name
yes
the name of the GCE instance to add/remove tags
pem_file
no
path to the pem file associated with the service account email
project_id
no
your GCE project ID
service_account_email
no
service account email
state
no present
  • present
  • absent
desired state of the tags
tags
yes
comma-separated list of tags to add or remove
zone
no us-central1-a
the zone of the disk specified by source

Examples

# Add tags 'http-server', 'https-server', 'staging' to instance name 'staging-server' in zone us-central1-a.
- gce_tag:
    instance_name: staging-server
    tags: http-server,https-server,staging
    zone: us-central1-a
    state: present

# Remove tags 'foo', 'bar' from instance 'test-server' in default zone (us-central1-a)
- gce_tag:
    instance_name: test-server
    tags: foo,bar
    state: absent

This is an Extras Module

For more information on what this means please read Extras Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/gce_tag_module.html