summaryrefslogtreecommitdiffstats
path: root/roles/ands_kaas/tasks/templates.yml
blob: 2de4fad668dfbffb9bd0a184545523c3b7f761d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
---
# Sorting is not enforeced
- name: "Find KaaS templates"
  command: "echo {{ item | quote }}"
  register: results
  changed_when: false
  when: (kaas_project_config.pods | default([]) | length > 0) or not (item | regex_search('kaas-pods')) 
  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