Sharing ansible variable between plays
A value you set with set_fact
will be available between different plays. Keep in mind that set_fact are set for a specific host. Your first play is run against localhost so the fact is part of the localhosts variables. So it the following play you should be able to access it with a task like this.
- debug:
var: hostvars['localhost']['hostmap']