Here is the sequence broken down, it's not intuitive at all unfortunately looking at the playbook (I should have added more comments to the example)

>  pre_tasks:
>    - name: Gathering ec2 facts 
>      ec2_facts: 
>    - name: Gathering ELB facts
>      local_action: ec2_elb_facts

These two modules "ec2_facts" and "ec2_elb_facts" are invoked in the pre_tasks and give us the following facts which are variables that can be used in the playbook:

* `$elbs` which is ` { '<instanceid-1>': [ <elb1>, <elb2>, .. ], <instanceid-2>... } ` Where elb1, elb2 are the elbs attached to the instance.
* `$ansible_ec2_instance_id` which is the current instance that operations are being run on

The way the command is invoked is as follows:

>    - local_action: command util/elb_reg.py -e {{ ",".join(elbs[ansible_ec2_instance_id]) }} -i {{ ansible_ec2_instance_id }} deregister

Where -e is the list of elbs that the current instances belong to and -i is the instance
"active_elbs" are the elbs that are passed in.

>   - local_action: command util/elb_reg.py -e {{ ",".join(elbs[ansible_ec2_instance_id]) }} -i {{ ansible_ec2_instance_id }} register

Register will pass in the same elb list and the same instance id to add it back to the pool