summaryrefslogtreecommitdiffstats
path: root/roles/ands_kaas/tasks/templates.yml
blob: e1612bcc4011d1309f0ad40bf1993517066611dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
---
# Sorting is not enforeced
- name: "Find KaaS templates"
  command: "echo {{ item | quote }}"
  register: results
  changed_when: false
  with_fileglob:
    - "{{ role_path }}/templates/{{ kaas_template_glob | default('*') }}.j2"
    - "{{ kaas_project_path }}/templates/{{ kaas_template_glob | default('*') }}.j2"

#- debug: msg="{{ results }}"

- name: "Sort and execute KaaS templates"
  include_tasks: "template.yml"
#  delegate_to: "{{ groups.masters[0] }}"
  run_once: true
  with_items: "{{ sorted_tmpl }}"
  vars:
    sorted_tmpl: "{{ (results.results[0] is defined) | ternary (results | json_query('results[*].stdout_lines') | sum(start=[]) | map('basename') | sort | unique, []) }}"
  loop_control:
    loop_var: tmpl_name