Looked recently. Ended up using boto's elbadmin and cutting the output up.

command: elbadmin -r eu-west-1 list

On Wednesday, April 15, 2015 at 3:01:13 PM UTC+1, Alex Leonhardt wrote:
>
> Hi,
>
> Since there's no reply - possible to get someone at ansible to check / 
> comment ? It seems similar to a question regarding VPCs that was recently 
> asked and also has no answers yet?
>
> In fact, when creating the ELBs, can I keep a local list of them thats 
> being produced by the playbook, if I can't get it dynamically?
>
> Thanks!
> Alex
>  
> On Mon, 13 Apr 2015 13:12 Alex Leonhardt <[email protected] 
> <javascript:>> wrote:
>
>> Hi,
>>
>> I'm trying to get a list of ELBs to then use that to add new instances 
>> that I create to these ELBs, but am not successful - the ec2_elbs is always 
>> empty when checking. I'm currently trying the basic example that's meant to 
>> add new instances to a ELB, however, I try to do this without knowing the 
>> ELBs name(s). Is that even possible ? If so, it'd be great if there was a 
>> link to a doc or blog or something on who to get that list of ELBs ? 
>>
>> Example: 
>>
>>
>> - hosts: tag_Name_Demo:&tag_Svc_Apache
>>   gather_facts: true
>>   user: ec2-user
>>
>>  # basic pre_task and post_task example
>>  pre_tasks:
>>  - name: Gathering ec2 facts
>>    action: ec2_facts
>>
>>  - name: Instance De-register
>>    local_action:
>>      module: ec2_elb
>>      region: eu-west-1
>>      instance_id: "{{ ansible_ec2_instance_id }}"
>>      state: 'absent'
>>
>>
>> tasks:
>>
>>  - name: install httpd
>>    sudo: yes
>>    yum: name=httpd state=present
>>
>>  - name: ensure httpd is running
>>    sudo: yes
>>    service: name=httpd state=started
>>
>>  - name: Check NTP service
>>    sudo: yes
>>    service: name=ntpd state=started
>>
>>
>> post_tasks:
>>  - debug: msg="{{ item }}"
>>    with_items: ec2_elbs
>>
>>  - name: Instance Register
>>    local_action:
>>      module: ec2_elb
>>      region: eu-west-1
>>      instance_id: "{{ ansible_ec2_instance_id }}"
>>      ec2_elbs: "{{ item }}"
>>      state: 'present'
>>      wait: yes
>>      ignore_errors: yes
>>    with_items: ec2_elbs
>>
>>
>>
>>
>>
>> The output i get : 
>>
>>
>>
>> PLAY [tag_Name_Demo:&tag_Svc_Apache] 
>> ******************************************
>>
>> GATHERING FACTS 
>> ***************************************************************
>> ok: [52.17.75.238]
>> ok: [52.17.52.33]
>>
>> TASK: [Gathering ec2 facts] 
>> ***************************************************
>> ok: [52.17.75.238]
>> ok: [52.17.52.33]
>>
>> TASK: [Instance De-register] 
>> **************************************************
>> ok: [52.17.75.238 -> 127.0.0.1]
>> ok: [52.17.52.33 -> 127.0.0.1]
>>
>> TASK: [install httpd] 
>> *********************************************************
>> ok: [52.17.52.33]
>> ok: [52.17.75.238]
>>
>> TASK: [ensure httpd is running] 
>> ***********************************************
>> ok: [52.17.75.238]
>> ok: [52.17.52.33]
>>
>> TASK: [Check NTP service] 
>> *****************************************************
>> ok: [52.17.52.33]
>> ok: [52.17.75.238]
>>
>> TASK: [debug msg="{{ item }}"] 
>> ************************************************
>> skipping: [52.17.52.33]
>> skipping: [52.17.75.238]
>>
>> TASK: [Instance Register] 
>> *****************************************************
>> skipping: [52.17.52.33]
>> skipping: [52.17.75.238]
>>
>> PLAY RECAP 
>> ********************************************************************
>> 52.17.52.33                : ok=6    changed=0    unreachable=0   
>>  failed=0
>> 52.17.75.238               : ok=6    changed=0    unreachable=0   
>>  failed=0
>>  
>>
>> Maybe I'm missing the obvious .. the creation of the ELBs is done in a 
>> separate play as I want to be able to run the two plays, create environment 
>> and create instances, separately. But maybe I can't do that, so your advice 
>> would be very useful :) !
>>
>> Thanks!
>> Alex
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/a86de61f-7782-4fd9-b332-6ee83e9a381b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/a86de61f-7782-4fd9-b332-6ee83e9a381b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/098cd092-edfc-472c-8be9-4bea312fe7b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to