--- - hosts: all become: yes roles: - base_setup - hosts: localhost connection: local gather_facts: false tasks: - name: Display all generated passwords debug: msg: | Generated Passwords: {% for host in groups['all'] %} {% if hostvars[host]['generated_password'] is defined %} Host: {{ host }} Password: {{ hostvars[host]['generated_password'] }} {% endif %} {% endfor %}