Skip to content

Instantly share code, notes, and snippets.

@dschier-wtd
Last active June 6, 2019 07:44
Show Gist options
  • Save dschier-wtd/b47aa0d4360b0c0db5d23076b918e562 to your computer and use it in GitHub Desktop.
Save dschier-wtd/b47aa0d4360b0c0db5d23076b918e562 to your computer and use it in GitHub Desktop.
# defaults/main.yml
config:
- name: alice
execStart: alice.sh
retains:
- name: blub
time: 12:00
value: 5
- name: blib
value: 6
# tasks/main.yml
- name: Loop all exec
template:
src: foo.j2
dest: "{{ item.name }}"
loop: "{{ config }}"
# templates/foo.j2
exec = {{ item.execStart }}
{% for i in item.retains %}
{{ i.name }} {{ i.time|default('00:00') }} {{ i.value }}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment