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