I'm using the ec2_remote_facts module to get a list of instances based on
filters.
I want to create another list that contains the
ec2_facts.instances[0-n].private_ip
This is the logic I'm after
- name: Set server names address for webapp proxy server
set_fact:
servers[item]: "{{ ec2_facts.instances[item].private_ip_address }}"
with_sequence: "start=0 end={{ ec2_facts.instances|(length -1) }}"
but it doesn't work
"msg": "ERROR! 'list object' has no attribute u'0'"
I can manually set each fact
- name: Set server names address for webapp proxy server
set_fact:
servers: ["{{ ec2_facts.instances[0].private_ip_address }}", "{{
ec2_facts.instances[1].private_ip_address }}" ]
But this is not optimal as it doesn't work for variable length lists.
--
Steve
--
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/CA%2BemtqvBy93pj05M0m3g6Ozz0oC6PU3dGJsUqBS2%2BwS8nA2yow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.