On Tue, 31 Mar 2015 07:13 -0700, Adrian Paraschiv
<[email protected]> wrote:
> Hi,
> 
> I tried with hostvars:
> 
> {{ hostvars.LBL.db.stdout }};"
> {{ hostvars['LBL']['db'] }}
> {{ hostvars['LBL']['db']['stdout'] }}
> 
> but it says:
> 
> in get_variables raise Exception("host not found: %s" % hostname) 
> Exception: host not found: LBL
> And LBL is defined, after all I'm running the first role on LBL and it's
> ok.
> I'm using: ansible-1.8.4-1.el6.noarch

Working example:

---
- name: test hostvars host1
  hosts: host1
  tasks:
    - command: "ls /bin"
      register: ls_out

- name: test hostvars host2
  hosts: host2
  tasks:
    - debug:
        var: "{{ hostvars['host1']['ls_out']['stdout'] }}"


Giovanni

-- 
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/1427813783.641973.247586413.4AE626EB%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to