From e41e21f6d0f5ca7aace86bf60e8b503bb20fdcd5 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 15 Aug 2019 06:57:07 +0200 Subject: Support BuildConfig in ands_kaas role --- roles/ands_kaas/tasks/do_app.yml | 13 +++++++++++++ roles/ands_kaas/tasks/do_apps.yml | 6 +++--- roles/ands_kaas/tasks/project.yml | 2 ++ roles/ands_kaas/tasks/template.yml | 4 ++-- roles/ands_kaas/tasks/templates.yml | 3 ++- 5 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 roles/ands_kaas/tasks/do_app.yml (limited to 'roles/ands_kaas/tasks') diff --git a/roles/ands_kaas/tasks/do_app.yml b/roles/ands_kaas/tasks/do_app.yml new file mode 100644 index 0000000..556a421 --- /dev/null +++ b/roles/ands_kaas/tasks/do_app.yml @@ -0,0 +1,13 @@ +- name: "Process KaaS App builders" + include_tasks: "template.yml" + run_once: true + vars: + tmpl_name: "40-kaas-app-builders.yml.j2" + yml_name: ternary ( '80-' + (appname | default('kaas')) + '-builder.yml' + +- name: "Process KaaS App pods" + include_tasks: "template.yml" + run_once: true + vars: + tmpl_name: "50-kaas-app-pods.yml.j2" + yml_name: ternary ( '90-' + (appname | default('kaas')) + '.yml' diff --git a/roles/ands_kaas/tasks/do_apps.yml b/roles/ands_kaas/tasks/do_apps.yml index 0e49981..382eb3c 100644 --- a/roles/ands_kaas/tasks/do_apps.yml +++ b/roles/ands_kaas/tasks/do_apps.yml @@ -1,5 +1,5 @@ - name: "Process KaaS apps" - include_tasks: "template.yml" + include_tasks: "app.yml" run_once: true with_dict: "{{ kaas_project_apps | default({}) }}" loop_control: @@ -16,5 +16,5 @@ delete: "{{ options.delete | default(true) }}" instantiate: "{{ appitem.value.instantiate | default(false) }}" load: "{{ app.load | default(false) }}" - pods: "{{ app.pods }}" - tmpl_name: "50-kaas-pods.yml.j2" + pods: "{{ app.pods | default({}) }}" + builders: "{{ app.builders | default({}) }}" diff --git a/roles/ands_kaas/tasks/project.yml b/roles/ands_kaas/tasks/project.yml index 0376477..f1c596b 100644 --- a/roles/ands_kaas/tasks/project.yml +++ b/roles/ands_kaas/tasks/project.yml @@ -15,6 +15,7 @@ vars: var_empty: pods: {} + builders: {} var_name: "var_{{kaas_project}}_config" when: hostvars[inventory_hostname][var_name] is not defined @@ -58,6 +59,7 @@ kaas_project_config: "{{ hostvars[inventory_hostname][var_name] }}" kaas_project_volumes: "{{ kaas_project_config.volumes | default(kaas_project_config.extra_volumes | default({}) | combine(kaas_openshift_volumes)) }}" kaas_project_local_volumes: "{{ kaas_project_config.local_volumes | default({}) }}" + kaas_project_builders: "{{ kaas_project_config.builders | default({}) }}" kaas_project_pods: "{{ kaas_project_config.pods | default({}) }}" kaas_project_apps: "{{ kaas_project_config.apps | default({}) }}" kaas_project_gids: "{{ kaas_project_config.gids | default(kaas_openshift_gids) }}" diff --git a/roles/ands_kaas/tasks/template.yml b/roles/ands_kaas/tasks/template.yml index 89c30e0..73cf1c4 100644 --- a/roles/ands_kaas/tasks/template.yml +++ b/roles/ands_kaas/tasks/template.yml @@ -3,7 +3,7 @@ register: result vars: default_name: "{{ item | basename | regex_replace('\\.j2','') }}" - dest_name: "{{ (appname is defined) | ternary ( '90-' + (appname | default('')) + '.yml', default_name ) }}" + dest_name: "{{ yml_name | default(default_name) }}" with_first_found: - paths: - "{{ role_path }}/templates/" @@ -16,7 +16,7 @@ when: instantiate == true vars: default_name: "{{ tmpl_name | basename | regex_replace('\\.j2','') }}" - dest_name: "{{ (appname is defined) | ternary ( '90-' + (appname | default('')) + '.yml', default_name ) }}" + dest_name: "{{ yml_name | default(default_name) }}" template: "{{ dest_name }}" template_path: "{{ kaas_template_path }}" project: "{{ kaas_namespace | default(kaas_project) }}" diff --git a/roles/ands_kaas/tasks/templates.yml b/roles/ands_kaas/tasks/templates.yml index 4417cf3..07b71ea 100644 --- a/roles/ands_kaas/tasks/templates.yml +++ b/roles/ands_kaas/tasks/templates.yml @@ -4,7 +4,7 @@ command: "echo {{ item | quote }}" register: results changed_when: false - when: (kaas_project_pods | length > 0) or not (item | regex_search('kaas-pods')) + when: not (item | regex_search('kaas-app')) or ((kaas_project_pods | length > 0) and (item | regex_search('kaas-app-pods'))) or ((kaas_project_builders | length > 0) and (item | regex_search('kaas-app-builders'))) with_fileglob: - "{{ role_path }}/templates/{{ kaas_template_glob | default('*') }}.j2" - "{{ kaas_project_path }}/templates/{{ kaas_template_glob | default('*') }}.j2" @@ -22,6 +22,7 @@ instantiate: true load: false pods: "{{ kaas_project_pods }}" + builders: "{{ kaas_project_builders }}" loop_control: loop_var: tmpl_name -- cgit v1.2.3