This repository was archived by the owner on Feb 16, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathactivate-release.yaml
82 lines (73 loc) · 2.39 KB
/
activate-release.yaml
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
- name: "Activate {{package}} on {{hcs_environment}}"
gather_facts: False
any_errors_fatal: True
hosts: hybris
serial: "100%"
become: True
vars:
version_folder: "/opt/{{package}}"
run_update: "{{ (update is defined and update|bool) or False }}"
update_config_file: "{{version_folder}}/data/misc/update.json"
tasks:
- name: "Sanity Check: is {{version_folder}} is available?"
stat:
path: "{{version_folder}}"
register: version_stat
- name: "Fail on missing version folder"
fail:
msg: "{{version_folder}} does not exist on {{inventory_hostname}}"
when: not (version_stat.stat.isdir is defined and version_stat.stat.isdir)
- name: "Stop hybris"
service:
name: hybris
state: stopped
- name: "link new version"
file:
src: "{{version_folder}}"
dest: "/opt/hybris"
owner: hybris
group: hybris
state: link
- name: "update tomcate config for {{package}}"
shell: >-
. ./setantenv.sh;
ant deploy
args:
chdir: "/opt/hybris/bin/platform"
become: True
become_user: hybris
- name: "check for {{update_config_file}}"
stat:
path: "{{update_config_file}}"
register: st
when:
- run_update
- inventory_hostname == ansible_play_hosts[0] #only run for the first backend node
# run ant updatesystem:
# - for tenant master
# - maybe with a config file
# - without unnecessarily building the platform
# - and without starting cronjobs
# - and pipe the output to a log file for traceability
- name: "run updatesystem"
shell: >-
. ./setantenv.sh;
ant updatesystem
-Dtenant=master
{{"-DconfigFile=" + update_config_file if (st.stat.isreg is defined and st.stat.isreg) else "" }}
-Dde.hybris.platform.ant.production.skip.build=true
-Dcronjob.timertask.loadonstartup=false
> /opt/hybris/log/update-running-system-$(date +%Y-%m-%dT%H-%M-%S).log 2>&1
args:
chdir: "/opt/hybris/bin/platform"
become: True
become_user: hybris
async: 900 #15min
poll: 30 #seconds
when:
- run_update
- inventory_hostname == ansible_play_hosts[0] #run only once (for the first backend node)
- name: "Start hybris"
service:
name: hybris
state: started