That's not a datacenter issue - you can have two VMs with the same name in 
the same datacenter but VMWare does not recommend this - 
https://kb.vmware.com/s/article/2108769

vmware_guest_facts has a "name_match" parameter "If multiple virtual 
machines matching the name, use the first or last found." (see 
https://docs.ansible.com/ansible/latest/modules/vmware_guest_facts_module.html#vmware-guest-facts-module)
 
to cater for this but in my opinion (I support over 20,000 vms), you should 
probably really aim to have unique names.



On Tuesday, 27 August 2019 18:10:45 UTC+1, Kai Stian Olstad wrote:
>
> On 27.08.2019 14:38, MKPhil wrote: 
> > I ask because I've written a module, based on vmware_guest_find, that 
> > returns the Datacenter for a given VM and VCenter, which I can then feed 
> in 
> > to the other "official" modules. My module uses the built-in function 
> > "get_parent_datacenter" (defined in 
> > 
> https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/vmware.py)
>  
>
> > so I'm not inventing anything particularly new. My point is that if I, 
> an 
> > amateur Python coder at best, can do this, why can't the official 
> modules 
> > do it by default?  Is there some reason for the current behaviour that I 
> am 
> > missing? 
>
> If I have two VM both called hostA, one in datacenter-north and one in 
> datacenter-south, which one do you choose? 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/2015fdb4-7118-4059-9139-adda89466403%40googlegroups.com.

Reply via email to