aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'tasks')
-rw-r--r--tasks/main.yml9
-rw-r--r--tasks/restart.yml22
2 files changed, 31 insertions, 0 deletions
diff --git a/tasks/main.yml b/tasks/main.yml
index 3c59c90..002dc9c 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -24,13 +24,22 @@
24 24
25- name: Deploy app 25- name: Deploy app
26 import_tasks: deploy.yml 26 import_tasks: deploy.yml
27 when: not clever_restart_only is defined or not clever_restart_only
27 tags: 28 tags:
28 - clever 29 - clever
29 - clever-deploy 30 - clever-deploy
30 31
31- name: Post deploy tasks 32- name: Post deploy tasks
32 import_tasks: post_deploy.yml 33 import_tasks: post_deploy.yml
34 when: not clever_restart_only is defined or not clever_restart_only
33 tags: 35 tags:
34 - clever 36 - clever
35 - clever-deploy 37 - clever-deploy
36 - clever-env 38 - clever-env
39
40- name: Restart app
41 import_tasks: restart.yml
42 when: clever_restart_only is defined and clever_restart_only
43 tags:
44 - clever
45 - clever-restart
diff --git a/tasks/restart.yml b/tasks/restart.yml
new file mode 100644
index 0000000..e2a8891
--- /dev/null
+++ b/tasks/restart.yml
@@ -0,0 +1,22 @@
1---
2- name: Restart app on Clever-Cloud
3 shell: "clever restart"
4 args:
5 chdir: "{{ clever_app_root }}"
6 environment:
7 CONFIGURATION_FILE: "{{ clever_login_file }}"
8 async: 300 # 5 minutes
9 poll: 0
10 ignore_errors: true
11 register: clever_deploy
12 tags:
13 - skip_ansible_lint
14
15- name: Wait up to 5 minutes for restart completion
16 async_status:
17 jid: "{{ clever_deploy.ansible_job_id }}"
18 register: job_result
19 until: job_result.finished
20 ignore_errors: true
21 delay: 30
22 retries: 10 # 5 minutes (10 * 30 secs delay)