ANSIBLE.EC2_AMI(3)

NAME
ec2_ami - create or destroy an image in ec2, return imageid

DESCRIPTION

Creates or deletes ec2 images. This module has a dependency on python-boto >= 2.5

OPTIONS

aws_access_key
    AWS access key. If not set then the value of the AWS_ACCESS_KEY environment variable is used.

aws_secret_key
    AWS secret key. If not set then the value of the AWS_SECRET_KEY environment variable is used.

delete_snapshot
    Whether or not to deleted an AMI while deregistering it.

description
    An optional human-readable string describing the contents and purpose of the AMI.

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

image_id
    Image ID to be deregistered.

instance_id
    instance id of the image to create

name
    The name of the new image to create

no_reboot
    An optional flag indicating that the bundling process should not attempt to shutdown the instance before bundling. If this flag is True, the responsibility of maintaining file system integrity is left to the owner of the instance. Choices: yes,no.

region
    The AWS region to use. Must be specified if ec2_url is not used. If not specified then the value of the EC2_REGION environment variable, if any, is used.

state
    create or deregister/delete image (default: present)

wait
    wait for the AMI to be in state 'available' before returning. Choices: yes,no. (default: no)

wait_timeout
    how long before wait gives up, in seconds (default: 300)."
    # Basic AMI Creation
    - local_action:
        module: ec2_ami
        aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx
        aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        instance_id: i-xxxxxx
        wait: yes
        name: newtest
      register: instance
    # Basic AMI Creation, without waiting
    - local_action:
        module: ec2_ami
        aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx
        aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        region: xxxxxx
        instance_id: i-xxxxxx
        wait: no
        name: newtest
      register: instance
    # Deregister/Delete AMI
    - local_action:
        module: ec2_ami
        aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx
        aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        region: xxxxxx
        image_id: ${instance.image_id}
        delete_snapshot: True
        state: absent
    # Deregister AMI
    - local_action:
        module: ec2_ami
        aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx
        aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        region: xxxxxx
        image_id: ${instance.image_id}
        delete_snapshot: False
        state: absent

AUTHOR
Evan Duffield <eduffield@iacquire.com>

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