ANSIBLE.EC2_ELB(3)

NAME
ec2_elb - De-registers or registers instances from EC2 ELB(s)

DESCRIPTION

This module de-registers or registers an AWS EC2 instance from the ELs that it belongs to.

Returns fact "ec2_elbs" which is a list of elbs attached to the instance if state=absent is passed as an argument.

Will be marked changed when called only if there are ELBs found to operate on.

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.

ec2_elbs
    List of ELB names, required for registration. The ec2_elbs fact should be used if there was a previous de-register. (default: None)

instance_id
    EC2 Instance ID(required)

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

state
    register or deregister the instance(required)

wait
    Wait for instance registration or deregistration to complete successfully before returning. Choices: yes,no. (default: yes."
    # basic pre_task and post_task example
    pre_tasks:
      - name: Gathering ec2 facts
        ec2_facts:
      - name: Instance De-register
        local_action: ec2_elb
        args:
          instance_id: "{{ ansible_ec2_instance_id }}"
          state: 'absent'
    roles:
      - myrole
    post_tasks:
      - name: Instance Register
        local_action: ec2_elb
        args:
          instance_id: "{{ ansible_ec2_instance_id }}"
          ec2_elbs: "{{ item }}"
          state: 'present'
        with_items: ec2_elbs

AUTHOR
John Jarvis

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