hostvars are not available to the play, only extra vars.

you can do this by using group_by: to set a new group, which the 2nd
play references

#Play1
...

- hosts: all
  gather_facts: false
  tasks:
     - group_by: key=new_group
       when: inventory_hostname in
hostvars['127.0.0.1']['second_play_hosts'].stdout_lines

#Play2
hosts: new_group
remote_user: some_user
tasks:
     - name: random task
       shell: echo "Hi"


though the comments might be off by 1 now.
-- 
Brian Coca

-- 
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/CAJ5XC8kyaZs96aykCVLfNFuXYFS%3D8cCrp28XWbpTgj1GvTnrfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to