Dear ansible users,

I try to write a paybook where I first get a host name from a host, then 
would like to do thinks on this host name.

Here is a try:

---
- name: Get VM inventory
  hosts: "{{vm}}"
  gather_facts: False
  tasks:
    - debug: msg="{{hostvars[vm]['cluster']}}"

- name: Get free hypervisor
  hosts: '{{hostvars[vm]["cluster"]}}'
  gather_facts: False
  tasks:
    - debug: msg='{{hostvars[vm]["cluster"]}}'


Which I call with ansible-playbook myplaybook.yml -e vm=foo

debug on "Get VM inventory" print the right cluster name
"Get free hypervisor" doesn't match any host. Thought if I force the 
cluster name in hosts, the debug properly display the vm cluster name.


Is this unsupported? A syntax error?

-- 
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/4c666f90-ed5e-4997-a565-bd4a1fb24e17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to