yes. Exactly .. I did set_fact on a remote_host and try to re-call the value of the variable in the localhost.
*So to access in the 2nd play you need to go through hostvars:{{hostvasr['server1']['reg_name']* Do you mean I have to use like below? - name: print the collected hostname debug: msg: "{{hostvars['server1']['reg_name'] }}" On Thursday, September 21, 2023 at 7:53:22 PM UTC+5:30 Brian Coca wrote: > You are confusing scopes, `set_fact` is PER HOST, not a global. So you > defined the variable on server1 but are trying to read it from > 127.0.0.1. > > So to access in the 2nd play you need to go through hostvars: > {{hostvasr['server1']['reg_name'] > -- > ---------- > 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5d7389a8-f596-4868-a439-88f5de5fb48en%40googlegroups.com.