Skip to content

Instantly share code, notes, and snippets.

@joejulian
Created April 24, 2017 17:15
Show Gist options
  • Save joejulian/2ed72873399cfd1cdb9177f5c24b0659 to your computer and use it in GitHub Desktop.
Save joejulian/2ed72873399cfd1cdb9177f5c24b0659 to your computer and use it in GitHub Desktop.
---
- name: foo
hosts: localhost
vars:
bar:
c:
b:
a: 1
tasks:
- name: bite me
set_fact:
deployment:
clusters:
- name: foo
value: 4
- name: bar
value: 6
- name: baz
value: 8
- name: make a list of clusters with the additional fact
set_fact:
temp: "{{ temp + [ item | combine(fubar, recursive=true) ] }}"
vars:
temp: []
fubar:
not_random_prefix: "12345"
with_items: "{{ deployment.clusters }}"
- name: Wassssuuuuuppppp
debug:
var: temp
- name: replace the old clusters list with the new one
set_fact:
deployment: "{{ deployment | combine(dict, recursive=true) }}"
vars:
dict:
clusters: "{{ temp }}"
- name: Wassssuuuuuppppp
debug:
var: deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment