From bc6b5cb5ad7dec5158e0005433b02a951daf9191 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 11 Apr 2018 00:30:58 +0200 Subject: Support executing custom scripts and provide mode to update just ADEI template --- playbooks/openshift-setup-templates.yml | 11 +++++++++++ roles/ands_kaas/tasks/do_project.yml | 6 ++++-- roles/ands_kaas/tasks/do_script.yml | 10 ++++++++++ roles/ands_kaas/tasks/ocscript.yml | 2 +- roles/ands_kaas/tasks/project.yml | 2 +- setup.sh | 16 ++++++++++++++++ setup/projects/adei/templates/60-adei.yml.j2 | 4 ++++ 7 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 playbooks/openshift-setup-templates.yml create mode 100644 roles/ands_kaas/tasks/do_script.yml diff --git a/playbooks/openshift-setup-templates.yml b/playbooks/openshift-setup-templates.yml new file mode 100644 index 0000000..d12b988 --- /dev/null +++ b/playbooks/openshift-setup-templates.yml @@ -0,0 +1,11 @@ +- import_playbook: maintain.yml + +- name: "Configure templates for {{ kaas_single_project }}" + hosts: masters + roles: + - { role: ands_kaas, subrole: script } + vars: + kaas_openshift_volumes: "{{ ands_openshift_volumes }}" + kaas_projects: "{{ ands_openshift_projects.keys() }}" + kaas_single_project: "{{ ands_configure_project }}" + kaas_script: [ "templates": "{{ ands_configure_template | default('*') }}" ] diff --git a/roles/ands_kaas/tasks/do_project.yml b/roles/ands_kaas/tasks/do_project.yml index 71a54ad..e64e9e3 100644 --- a/roles/ands_kaas/tasks/do_project.yml +++ b/roles/ands_kaas/tasks/do_project.yml @@ -5,7 +5,9 @@ - name: "Run OC script" include_tasks: ocscript.yml run_once: true - when: kaas_project_config.oc is defined + vars: + script: "{{ kaas_project_script }}" + when: kaas_project_script is defined - block: - name: Configure storage @@ -21,5 +23,5 @@ include_tasks: do_apps.yml run_once: true when: - - kaas_project_config.oc is undefined + - kaas_project_script is undefined diff --git a/roles/ands_kaas/tasks/do_script.yml b/roles/ands_kaas/tasks/do_script.yml new file mode 100644 index 0000000..7dc9dad --- /dev/null +++ b/roles/ands_kaas/tasks/do_script.yml @@ -0,0 +1,10 @@ +--- +- name: Ensure OpenShift template directory exists + file: path="{{ kaas_template_path }}" state="directory" mode=0755 owner=root group=root + +- name: "Run OC script" + include_tasks: ocscript.yml + run_once: true + vars: + script: "{{ kaas_script | default(kaas_project_script) }}" + diff --git a/roles/ands_kaas/tasks/ocscript.yml b/roles/ands_kaas/tasks/ocscript.yml index 6890f43..077e92b 100644 --- a/roles/ands_kaas/tasks/ocscript.yml +++ b/roles/ands_kaas/tasks/ocscript.yml @@ -2,7 +2,7 @@ - include_tasks: ocitem.yml # delegate_to: "{{ groups.masters[0] }}" run_once: true - with_items: "{{ kaas_project_config.oc }}" + with_items: "{{ script }}" loop_control: loop_var: ocitem \ No newline at end of file diff --git a/roles/ands_kaas/tasks/project.yml b/roles/ands_kaas/tasks/project.yml index 879f34a..2c05afd 100644 --- a/roles/ands_kaas/tasks/project.yml +++ b/roles/ands_kaas/tasks/project.yml @@ -63,4 +63,4 @@ kaas_project_gids: "{{ kaas_project_config.gids | default(kaas_openshift_gids) }}" kaas_project_uids: "{{ kaas_project_config.uids | default(kaas_openshift_uids) }}" kaas_blockvol_info: "{{ block_info }}" - \ No newline at end of file + kaas_project_script: "{{ kaas_project_config.oc | default(omit) }}" diff --git a/setup.sh b/setup.sh index 991b89e..add68a4 100755 --- a/setup.sh +++ b/setup.sh @@ -73,6 +73,22 @@ case "$action" in fi apply playbooks/openshift-setup-apps.yml --extra-vars "$vars" "$@" || exit 1 ;; + templates|project_templates) + [ -n "$1" ] || { usage 'project name should be specified...' ; exit 1; } + + vars="ands_configure_project=$1" + shift + + if [[ -n "$1" && ${1:0:1} != "-" ]]; then + vars="$vars ands_configure_template=$1" + shift + fi + apply playbooks/openshift-setup-templates.yml --extra-vars "$vars" "$@" || exit 1 + ;; + adei_template) + vars="ands_configure_project=adei ands_configure_template=60-adei.yml*" + apply playbooks/openshift-setup-templates.yml --extra-vars "$vars" "$@" || exit 1 + ;; openshift-masters) apply playbooks/openshift-add-masters.yml "$@" || exit 1 ;; diff --git a/setup/projects/adei/templates/60-adei.yml.j2 b/setup/projects/adei/templates/60-adei.yml.j2 index b3e6755..45bdfae 100644 --- a/setup/projects/adei/templates/60-adei.yml.j2 +++ b/setup/projects/adei/templates/60-adei.yml.j2 @@ -48,6 +48,8 @@ objects: kind: Route metadata: name: "{{ cfg.name }}" + annotations: + haproxy.router.openshift.io/timeout: "${haproxy_timeout}" labels: adei-type: "{{ pod_type }}" adei-name: "{{ name }}" @@ -213,6 +215,8 @@ parameters: - name: setup value: "autogen" description: "ADEI setup" + - name: haproxy_timeout + value: "30s" - name: continuous_caching value: "1" description: "Stop cachers if no work or poll the source continously" -- cgit v1.2.3