Skip to content

Instantly share code, notes, and snippets.

@vascoosx
Last active January 5, 2017 16:11
Show Gist options
  • Save vascoosx/4fe2fa1ba8cc644ce93402ae41ed201f to your computer and use it in GitHub Desktop.
Save vascoosx/4fe2fa1ba8cc644ce93402ae41ed201f to your computer and use it in GitHub Desktop.
incrementally add facts
---
- hosts: all
connection: local
tasks:
- name: check
local_action: debug msg={{ item.name }}
with_items:
- "{{ files }}"
- name: register data
set_fact:
file_details: "{{ file_details|default({}) | combine( {item.name: { 'revision' : item.revision }} ) }}"
with_items:
- "{{ files }}"
- name: see dict
debug: msg="{{ file_details[item.name] }}"
with_items:
- "{{ files }}"
- name: register second data
set_fact:
file_details2: "{{ file_details[item.name] | combine( { 'path' : item.location }) }}"
with_items:
- "{{ files }}"
- name: check registration
debug: msg="{{ file_details2 }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment