diff options
author | Clément Delafargue <39330590+clementd-fretlink@users.noreply.github.com> | 2020-07-03 15:16:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-03 15:16:54 +0200 |
commit | 315c7f51af48b54719bd793d9d28a4bb396a926a (patch) | |
tree | a9e2e081805d89fa1b924d6b2f85be342fd0cc54 /tasks | |
parent | 90634ee04cc1a4ab983de6bf142f25978463bc4a (diff) | |
parent | 3d3287e0767d13b0a81e5936ce9376d58f42e34c (diff) | |
download | ansible-clever-315c7f51af48b54719bd793d9d28a4bb396a926a.tar.gz ansible-clever-315c7f51af48b54719bd793d9d28a4bb396a926a.tar.zst ansible-clever-315c7f51af48b54719bd793d9d28a4bb396a926a.zip |
Merge pull request #74 from clementd-fretlink/service-dependenciesv2.7
Service dependencies
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/addon.yml | 17 | ||||
-rw-r--r-- | tasks/deploy.yml | 6 | ||||
-rw-r--r-- | tasks/service-dep.yml | 17 |
3 files changed, 24 insertions, 16 deletions
diff --git a/tasks/addon.yml b/tasks/addon.yml index 328664d..1ee8eff 100644 --- a/tasks/addon.yml +++ b/tasks/addon.yml | |||
@@ -1,18 +1,4 @@ | |||
1 | - name: Gather addon information for {{ addon.name }} (clever --version < 1.5.0) | 1 | - name: Gather addon information for {{ addon.name }} |
2 | shell: > | ||
3 | set -o pipefail && | ||
4 | clever env | grep {{ addon.env_prefix }} | ||
5 | | sed -e 's/{{ addon.env_prefix }}_//' -e 's/=/: \"/' -e 's/$/\"/' | ||
6 | > {{ clever_app_confdir }}/{{ addon.name }}_env.yml | ||
7 | args: | ||
8 | chdir: "{{ clever_app_root }}" | ||
9 | executable: "bash" | ||
10 | environment: | ||
11 | CONFIGURATION_FILE: "{{ clever_login_file }}" | ||
12 | changed_when: False | ||
13 | when: clever_returned_version.stdout is version('1.5.0', '<') | ||
14 | |||
15 | - name: Gather addon information for {{ addon.name }} (clever --version >= 1.5.0) | ||
16 | shell: > | 2 | shell: > |
17 | set -o pipefail && | 3 | set -o pipefail && |
18 | clever env | grep {{ addon.env_prefix }} | 4 | clever env | grep {{ addon.env_prefix }} |
@@ -24,7 +10,6 @@ | |||
24 | environment: | 10 | environment: |
25 | CONFIGURATION_FILE: "{{ clever_login_file }}" | 11 | CONFIGURATION_FILE: "{{ clever_login_file }}" |
26 | changed_when: False | 12 | changed_when: False |
27 | when: clever_returned_version.stdout is version('1.5.0', '>=') | ||
28 | 13 | ||
29 | - name: Include addon var for {{ addon.name }} | 14 | - name: Include addon var for {{ addon.name }} |
30 | include_vars: | 15 | include_vars: |
diff --git a/tasks/deploy.yml b/tasks/deploy.yml index ae11921..8dda5e0 100644 --- a/tasks/deploy.yml +++ b/tasks/deploy.yml | |||
@@ -38,6 +38,12 @@ | |||
38 | MIN_FLAVOR: "{{ clever_scaling.flavor.min | default('') }}" | 38 | MIN_FLAVOR: "{{ clever_scaling.flavor.min | default('') }}" |
39 | MAX_FLAVOR: "{{ clever_scaling.flavor.max | default('') }}" | 39 | MAX_FLAVOR: "{{ clever_scaling.flavor.max | default('') }}" |
40 | 40 | ||
41 | - name: Configure service dependencies | ||
42 | include_tasks: service-dep.yml | ||
43 | vars: | ||
44 | service_dep: "{{ item }}" | ||
45 | with_items: "{{ clever_service_dependencies }}" | ||
46 | |||
41 | - name: Push Environment | 47 | - name: Push Environment |
42 | shell: "clever env import --json < {{ clever_app_confdir }}/env" | 48 | shell: "clever env import --json < {{ clever_app_confdir }}/env" |
43 | args: | 49 | args: |
diff --git a/tasks/service-dep.yml b/tasks/service-dep.yml new file mode 100644 index 0000000..67621f6 --- /dev/null +++ b/tasks/service-dep.yml | |||
@@ -0,0 +1,17 @@ | |||
1 | - name: Make sure addon {{ service_dep.addon_id }} is linked | ||
2 | shell: > | ||
3 | clever service link-addon {{ service_dep.addon_id }} | ||
4 | args: | ||
5 | chdir: "{{ clever_app_root }}" | ||
6 | environment: | ||
7 | CONFIGURATION_FILE: "{{ clever_login_file }}" | ||
8 | when: service_dep.addon_id is defined | ||
9 | |||
10 | - name: Make sure app {{ service_dep.app_id }} is linked | ||
11 | shell: > | ||
12 | clever service link-app {{ service_dep.app_id }} | ||
13 | args: | ||
14 | chdir: "{{ clever_app_root }}" | ||
15 | environment: | ||
16 | CONFIGURATION_FILE: "{{ clever_login_file }}" | ||
17 | when: service_dep.app_id is defined | ||