summaryrefslogtreecommitdiffstats
path: root/roles/ands_kaas/tasks/template.yml
blob: 625512338037dfbc2c59dd72471250a849b86397 (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
25
26
- name: "Populate template '{{ tmpl_name }}' in project '{{ kaas_project }}' for application '{{ appname | default('kaas') }}'"
  template: src="{{ item }}" dest="{{ kaas_template_path }}/{{ dest_name }}" owner=root group=root mode="0644"
  register: result
  vars:
    default_name: "{{ item | basename | regex_replace('\\.j2','') }}"
    dest_name: "{{ yml_name | default(default_name) }}"
  with_first_found:
    - paths:
        - "{{ role_path }}/templates/"
        - "{{ kaas_project_path }}/templates/"
      files:
        - "{{ tmpl_name }}"

- name: "Configure KaaS resources defined in {{ tmpl_name }}"
  include_role: name="openshift_resource"
  vars: 
    default_name: "{{ tmpl_name | basename | regex_replace('\\.j2','') }}"
    dest_name: "{{ yml_name | default(default_name) }}"
    template: "{{ dest_name }}"
    template_path: "{{ kaas_template_path }}"
    project: "{{ kaas_namespace | default(kaas_project) }}"
    recreate: "{{ result is changed | ternary (delete | default(true) | ternary(true, false), false) }}"
    replace: "{{ result is changed | ternary (delete | default(true) | ternary(false, true), false) }}"

# alternatively load template
# TODO