Skip to content

Instantly share code, notes, and snippets.

@prandelicious
Created March 23, 2018 13:27
Show Gist options
  • Save prandelicious/27f83918745609731a20b00376dd44ba to your computer and use it in GitHub Desktop.
Save prandelicious/27f83918745609731a20b00376dd44ba to your computer and use it in GitHub Desktop.
[Ansible] Write output of several hosts into a single list/display
- hosts: mygroup
gather_facts: false
tasks:
- shell: date
register: date_res
changed_when: false
- debug:
msg: "{{ ansible_play_hosts | map('extract', hostvars, 'date_res') | map(attribute='stdout') | list }}"
run_once: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment