]> git.immae.eu Git - github/fretlink/ansible-clever.git/blame - tasks/deploy.yml
Merge pull request #14 from paulrbr-fl/rename-syslog-server-var
[github/fretlink/ansible-clever.git] / tasks / deploy.yml
CommitLineData
f7dd5848 1- name: Configure Drain
23c0fc8a 2 when: syslog_server is defined or clever_syslog_server is defined
f7dd5848
GD
3 command: clever-set-drain.sh
4 environment:
23c0fc8a 5 SYSLOG_UDP_SERVER: "{{ clever_syslog_server | default(syslog_server) }}"
f7dd5848
GD
6 CONFIGURATION_FILE: "{{ clever_login_file }}"
7
8- name: Configure Domain
1157a45f 9 when: domain is defined or clever_domain is defined
f7dd5848
GD
10 command: clever-set-domain.sh
11 environment:
1157a45f 12 DOMAIN: "{{ clever_domain | default(domain) }}"
f7dd5848
GD
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 }}"
7485b189 19 changed_when: false
f7dd5848
GD
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"
7485b189
GD
24 tags:
25 - skip_ansible_lint
f7dd5848
GD
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"
19955c99
PB
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
7485b189
GD
45 tags:
46 - skip_ansible_lint
f7dd5848 47
d7d8a988 48- name: Watch deployment status
f7dd5848 49 command: clever-wait-deploy.sh
d7d8a988
FM
50 async: 900
51 poll: 0
52 register: long_command
f7dd5848
GD
53 environment:
54 CONFIGURATION_FILE: "{{ clever_login_file }}"
7485b189 55 changed_when: False
d7d8a988
FM
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