aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks/restart.yml
blob: 1c520321e36f4c8a50dec525c75660de13ae3343 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
- name: Get current HEAD commit revision
  command: "git rev-parse HEAD" # noqa 303
  register: git_head_revision
  args:
    chdir: "{{ clever_app_root }}"
  changed_when: false

- name: Restart app on Clever-Cloud
  shell: "clever restart --commit {{ git_head_revision.stdout_lines | first }}"
  args:
    chdir: "{{ clever_app_root }}"
  environment:
    CONFIGURATION_FILE: "{{ clever_login_file }}"
  async: 300 # 5 minutes
  poll: 0
  ignore_errors: true
  register: clever_deploy
  tags:
    - skip_ansible_lint

- name: Wait up to 5 minutes for restart completion
  async_status:
    jid: "{{ clever_deploy.ansible_job_id }}"
  register: job_result
  until: job_result.finished
  ignore_errors: true
  delay: 30
  retries: 10 # 5 minutes (10 * 30 secs delay)