ANSIBLE.EC2_TAG(3)

NAME
ec2_tag - create and remove tag(s) to ec2 resources.

DESCRIPTION

Creates and removes tags from any EC2 resource. The resource is referenced by its resource id (e.g. an instance being i-XXXXXXX). It is designed to be used with complex args (tags), see the examples. This module has a dependency on python-boto.

OPTIONS

aws_access_key
    AWS access key. If not set then the value of the AWS_ACCESS_KEY environment variable is used. (default: None)

aws_secret_key
    AWS secret key. If not set then the value of the AWS_SECRET_KEY environment variable is used. (default: None)

ec2_url
    Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Must be specified if region is not used. If not set then the value of the EC2_URL environment variable, if any, is used.

region
    region in which the resource exists.

resource
    The EC2 resource id.(required)

state
    Whether the tags should be present or absent on the resource.(required).

EXAMPLES
# Basic example of adding tag(s)
tasks:
- name: tag a resource
  local_action: ec2_tag resource=vol-XXXXXX region=eu-west-1 state=present
  args:
    tags:
      Name: ubervol
      env: prod
# Playbook example of adding tag(s) to spawned instances
tasks:
- name: launch some instances
  local_action: ec2 keypair={{ keypair }} group={{ security_group }} instance_type={{ instance_type }} image={{ image_id }} wait=true region=eu-west-1
  register: ec2
- name: tag my launched instances
  local_action: ec2_tag resource={{ item.id }} region=eu-west-1 state=present
  with_items: ec2.instances
  args:
    tags:
      Name: webserver
      env: prod

AUTHOR
Lester Wade

SEE ALSO
ansible(1), http://ansible.github.com/modules.html#ec2-tag