It's quite frustrating that the 'rds_subnet_group' produces too few debug 
info:
< TASK: debug var=rds_sg_creation >
 --------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


ok: [localhost] => {
    "rds_sg_creation": {
        "changed": false, 
        "invocation": {
            "module_args": "", 
            "module_name": "rds_subnet_group"
        }
    }
}


On Thursday, 25 September 2014 14:20:41 UTC+2, Timo Ahokas wrote:
>
> Found the answer luckily by searching the groups. 
>
> Documented here if someone stumbles on the same thing (no need for 
> with_items):
>
> subnets: "{{ vpc.subnets | map(attribute='id') | list}}"
>
> On 25 September 2014 11:36, Timo Ahokas <[email protected] <javascript:>> 
> wrote:
>
>> Hi,
>>
>> I'm trying to use the rds_subnet_group module to create a subnet group 
>> with all the subnets defined in my VPC, but I'm having trouble finding a 
>> way of using the subnet ids from a registered vpc variable.
>>
>> So, first I create a VPC & register the response:
>>
>>   - name: Create VPC
>>     local_action: 
>>       module: ec2_vpc
>>       state: present
>>       subnets: ...
>>       route_tables: ...
>>     register: vpc
>>
>> This works well and the result looks like:
>>
>> TASK: [debug var=vpc] 
>> ********************************************************* 
>> ok: [localhost] => {
>>     "vpc": {
>>         "changed": true, 
>>         "invocation": {
>>             "module_args": "", 
>>             "module_name": "ec2_vpc"
>>         }, 
>>         "subnets": [
>>             {
>>                 "az": "eu-west-11", 
>>                 "cidr": "10.55.81.0/24", 
>>                 "id": "subnet-d1d21ea6", 
>>                 "resource_tags": {
>>                     "Environment": "test", 
>>                     "Name": "test_euw1a_app", 
>>                 }
>>             },
>>             { ... } ] }
>>
>> Now I'd like to use the subnet ids (subnets.id) in this response when 
>> creating a RDS subnet with all of them attached:
>>
>>   - name: Create DB subnet group 
>>     local_action:
>>       module: rds_subnet_group
>>       state: present
>>       name: "rds-sg"
>>       description: "rds-sg"
>>       subnets: 
>>         - "{{ item.id }}"
>>     with_items: vpc.subnets
>>
>> The problem is that if I have the with_item on the same level of 
>> local_action it seems to make N calls to rds_subnet_group (each with one of 
>> the ids) with fail with:
>> msg: DB Subnet Group doesn't meet availability zone coverage requirement. 
>> Please add subnets to cover at least 2 availability zones. Current 
>> coverage: 1
>>
>> So I'd like to add all the subnets in one go (single call with all subnet 
>> ids defined for the "subnets" parameter). With_items doesn't seem to work 
>> when it's nested on the same level with the other params (subnets/state) - 
>> instead I get the error: 
>> fatal: [localhost -> 127.0.0.1] => One or more undefined variables: 
>> 'item' is undefined
>>
>> What would be the best way to use all the vpc.subnets.id values in a 
>> list and supply those to rds_subnet_group.subnets in one go?
>>
>> Best regards,
>> Timo
>>
>>
>>  -- 
>> 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/5a4543b8-d054-4c14-99a6-965ffb41d582%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/5a4543b8-d054-4c14-99a6-965ffb41d582%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/1ad8000d-54d7-4ca7-b812-1c083dfa8d6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to