]> git.immae.eu Git - github/fretlink/ansible-clever.git/blob - tasks/deploy.yml
Merge pull request #31 from paulrbr-fl/fix-tags
[github/fretlink/ansible-clever.git] / tasks / deploy.yml
1 - name: Configure Drain
2 when: syslog_server is defined or clever_syslog_server is defined
3 command: clever-set-drain.sh
4 args:
5 chdir: "{{ clever_app_root }}"
6 environment:
7 SYSLOG_UDP_SERVER: "{{ clever_syslog_server | default(syslog_server) }}"
8 CONFIGURATION_FILE: "{{ clever_login_file }}"
9
10 - name: Configure Domain
11 when: domain is defined or clever_domain is defined
12 command: clever-set-domain.sh
13 args:
14 chdir: "{{ clever_app_root }}"
15 environment:
16 DOMAIN: "{{ clever_domain | default(domain) }}"
17 CONFIGURATION_FILE: "{{ clever_login_file }}"
18
19 - name: Push Environment
20 shell: "clever env import < {{ clever_app_confdir }}/env"
21 args:
22 chdir: "{{ clever_app_root }}"
23 environment:
24 CONFIGURATION_FILE: "{{ clever_login_file }}"
25 changed_when: false
26
27 #TODO: Improve ssh-key validation
28 - name: Accept Clever-Cloud servers
29 shell: "ssh-keyscan -H push-par-clevercloud-customers.services.clever-cloud.com >> ~/.ssh/known_hosts"
30 tags:
31 - skip_ansible_lint
32
33 - name: Push to Clever-Cloud to trigger deployment
34 command: "git push --force git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/{{ clever_app }}.git HEAD:refs/heads/master"
35 args:
36 chdir: "{{ clever_app_root }}"
37 register: clever_git_push
38 ignore_errors: true
39 tags:
40 - skip_ansible_lint
41
42 - name: First time push to Clever-Cloud needs a full git clone
43 command: "git fetch --unshallow"
44 args:
45 chdir: "{{ clever_app_root }}"
46 when:
47 - clever_git_push is failed
48 - clever_git_push.stderr is search("shallow update not allowed")
49 tags:
50 - skip_ansible_lint
51
52 - name: Push to Clever-Cloud to trigger deployment
53 command: "git push --force git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/{{ clever_app }}.git HEAD:refs/heads/master"
54 args:
55 chdir: "{{ clever_app_root }}"
56 when: clever_git_push is failed
57 tags:
58 - skip_ansible_lint
59
60 - name: Watch deployment status
61 command: "clever-wait-deploy.sh"
62 args:
63 chdir: "{{ clever_app_root }}"
64 async: 900
65 poll: 0
66 register: long_command
67 environment:
68 CONFIGURATION_FILE: "{{ clever_login_file }}"
69 changed_when: False
70
71 # Waits up to 15 minutes
72 - name: Wait for deployment completion
73 async_status:
74 jid: "{{ long_command.ansible_job_id }}"
75 register: job_result
76 until: job_result.finished
77 delay: 30
78 retries: 30