I'd like to have a list of networks in a variable in group_vars/all, 
something like

internal-networks:
- 10.2.3.0/24
- 10.3.4.0/24

and ideally reference it in a later variable setting, say in 
host_vars/aws-vpc-foo:

security_groups:
  default:
    rules:
    - { proto: all, group_name: default }
    - { proto: all, cidr_ip: 10.2.3.0/24 }
    - { proto: all, cidr_ip: 10.3.4.0/24 }

I'd like to generate those last two elements from internal-networks, but 
I'm struggling with how to do this. security_groups['default']['rules'] is 
later passed to the ec2_group module in a playbook, like

- name: configure security groups
  local_action:
    module: ec2_group
    ...
    rules: '{{ item.value.rules | default(None) }}'
  with_dict: '{{ security_groups | default({}) }}'

I'm trying to not have to repeat the list of internal networks in many 
places. (It's longer than the two elements in my example.) Does anyone have 
any suggestions?

Thanks!

--Bret

-- 
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/2a0b8c83-d379-4f5d-85d4-b9e69197f7c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to