Hi, I have two testing environments, located in different regions. Within each of those environments, among all the servers, there is a monitoring server. In one of my ansible roles I would like to be able to select the ip address of the relevant monitoring server. I thought that I could use a combination of hostvars, intersect and the relevant groups to be able to select the right server. An example of what I currently have is as follows:
hostvars[groups['test'] | intersect(groups[region]) | intersect(groups['monitoring_server']) | first].rax_addresses[network_name][0].addr In the above example, the variable 'region' could either be GIB, or LON. The 2 monitoring servers each exist in the test group and the monitoring_server group. They then each exist in a group which reflects the region they serve. I am expecting hostvars to return just one of the two servers - the one that is in all three of the groups. However, at the moment both servers are being returned. Have I misinterpreted how the intersect should work, or am I doing it wrong? Are there other ways to achieve what I'm attempting to do here? Thanks! Dan. -- 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/e1b76a2a-2d30-418b-8b47-5419d32bc9b4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
