summaryrefslogtreecommitdiffstats
path: root/roles/openshift_resource/tasks/main.yml
blob: af071f98a38bc9d070d6073cefc503986840f409 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
---
- block:
  - name: "Read template {{ template }}"
    command: cat '{{template_path}}/{{template}}'
    changed_when: false
    register: results

  - name: Parse JSON templates
    set_fact: tmpl="{{ results.stdout | from_json }}"
    when: template.find(".json") != -1

  - name: Parse YaML templates
    set_fact: tmpl="{{ results.stdout | from_yaml }}"
    when: template.find(".json") == -1

  - include_tasks: template.yml
    when: (tmpl.kind == "Template") and (tmpl.parameters is not defined)

  - include_tasks: resource.yml
    when: (tmpl.parameters is defined) or (tmpl.kind != "Template")
 
  run_once: true