summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-04-11 00:30:58 +0200
committerSuren A. Chilingaryan <csa@suren.me>2018-04-11 00:30:58 +0200
commitbc6b5cb5ad7dec5158e0005433b02a951daf9191 (patch)
treeb3125932ed468aac2b34124fe4be361a8de7fbe7
parent5a15f65db3dfb245919bdd534e93bd711db2eb60 (diff)
downloadands-bc6b5cb5ad7dec5158e0005433b02a951daf9191.tar.gz
ands-bc6b5cb5ad7dec5158e0005433b02a951daf9191.tar.bz2
ands-bc6b5cb5ad7dec5158e0005433b02a951daf9191.tar.xz
ands-bc6b5cb5ad7dec5158e0005433b02a951daf9191.zip
Support executing custom scripts and provide mode to update just ADEI template
-rw-r--r--playbooks/openshift-setup-templates.yml11
-rw-r--r--roles/ands_kaas/tasks/do_project.yml6
-rw-r--r--roles/ands_kaas/tasks/do_script.yml10
-rw-r--r--roles/ands_kaas/tasks/ocscript.yml2
-rw-r--r--roles/ands_kaas/tasks/project.yml2
-rwxr-xr-xsetup.sh16
-rw-r--r--setup/projects/adei/templates/60-adei.yml.j24
7 files changed, 47 insertions, 4 deletions
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"