This repository has been 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
/
install-release.yaml
170 lines (149 loc) · 5.92 KB
/
install-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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
- name: "Prepare new hybris release on all environments"
any_errors_fatal: True
hosts: hybris
serial: "100%"
become: True
become_user: hybris
vars:
package_folder: "{{deployment_folder}}/{{package}}"
version_folder: "/opt/{{package}}"
config_folder: "{{version_folder}}/config"
package_config_folder: "{{package_folder}}/hybris/config/{{hcs_environment}}"
package_misc_folder: "{{package_folder}}/hybris/misc/{{hcs_environment}}"
version_misc_folder: "{{version_folder}}/data/misc"
tasks:
- name: test for available disk space
assert:
that:
- not {{ item.mount == '/NFS_DATA' and ( item.size_available|int < minimal_available_space|int ) }}
- not {{ item.mount == '/opt' and ( item.size_available|int < minimal_available_space|int ) }}
with_items: "{{ansible_mounts}}"
loop_control:
label: "{{item.mount}}"
- name: upload {{package}}.zip to {{deployment_folder}}
synchronize:
src: "{{hcs_artifact_folder}}/{{package}}.zip"
dest: "{{deployment_folder}}/"
archive: False
recursive: True
partial: True
when:
- inventory_hostname == ansible_play_hosts[0]
- hcs_artifact_folder is defined
become: False
- name: upload {{package}}.md5 to {{deployment_folder}}
synchronize:
src: "{{hcs_artifact_folder}}/{{package}}.md5"
dest: "{{deployment_folder}}/"
archive: False
recursive: True
partial: True
when:
- inventory_hostname == ansible_play_hosts[0]
- hcs_artifact_folder is defined
become: False
- name: "run package validation for {{package_folder}}.zip"
command: "bash -c '/opt/ytools/ypackagevalidator2/ypv2.sh -e {{hcs_environment}} {{package_folder}}.zip'"
when: inventory_hostname == ansible_play_hosts[0] #only run once (for the first backend node)
- name: "delete version {{package_folder}}"
file:
path: "{{package_folder}}"
state: absent
when: inventory_hostname == ansible_play_hosts[0] #only run once (for the first backend node)
become: True
become_user: root
- name: "unpack deployment package"
unarchive:
remote_src: yes
src: "{{package_folder}}.zip"
dest: "{{deployment_folder}}"
when: inventory_hostname == ansible_play_hosts[0] #only run once (for the first backend node)
- name: "reset {{version_folder}}"
file:
path: "{{version_folder}}"
state: absent
become: True
become_user: root
- name: "create {{version_folder}}"
file:
path: "{{version_folder}}"
state: directory
owner: hybris
group: hybris
become: True
become_user: root
- name: "unpack hybris"
unarchive:
remote_src: yes
src: "{{package_folder}}/hybris/bin/{{item}}"
dest: "{{version_folder}}"
with_items:
- hybrisServer-Platform.zip
- hybrisServer-AllExtensions.zip
- name: "move hybris folder content to package root"
shell: "mv -f {{version_folder}}/hybris/* {{version_folder}}"
- name: "remove empty hybris folder"
file:
path: "{{version_folder}}/hybris"
state: absent
- name: "link log folder"
file:
src: /var/log/hybris
dest: "{{version_folder}}/log"
state: link
- name: "create hybris/config folder"
file:
path: "{{version_folder}}/config/conf.d"
state: directory
#the master config folder contains the tomcat config, license etc ->
#mandatory for the deployment!!
- name: "copy hcs-managed hybris config from {{hcs_managed_hybris_config}}"
shell: "cp -rf {{hcs_managed_hybris_config}}/* {{version_folder}}/config"
- name: "copy customer config {{package_config_folder}}"
shell: "cp -nr {{package_config_folder}}/* {{version_folder}}/config"
- name: "setup hybris optional config folder"
command: "mv -f {{item.key}} {{config_folder}}/conf.d/{{item.value}}"
with_dict:
"{{config_folder}}/header.properties": "10-local.properties"
"{{config_folder}}/{{inventory_hostname_short}}.properties": "11-local.properties"
"{{config_folder}}/hybris.properties": "12-local.properties"
loop_control:
label: "move {{item.key}} to {{config_folder}}/conf.d/{{item.value}}"
- name: "link customer.properties to local.properties"
file:
src: "{{item}}"
dest: "{{config_folder}}/local.properties"
state: link
ignore_errors: True
with_items:
- "customer.properties"
- "customer.{{hcs_role}}.properties"
- name: "set hybris.optional.config.dir={{config_folder}}/conf.d in local.properties"
blockinfile:
path: "{{config_folder}}/local.properties"
follow: True
block: |
hybris.optional.config.dir={{config_folder}}/conf.d
- name: "check if localextensions.{{hcs_role}}.xml exists"
stat:
path: "{{config_folder}}/localextensions.{{hcs_role}}.xml"
register: st
- name: "link localextensions.{{hcs_role}}.xml to localextensions.xml (optional)"
file:
src: "localextensions.{{hcs_role}}.xml"
dest: "{{config_folder}}/localextensions.xml"
state: link
force: true
when: st.stat.isreg is defined and st.stat.isreg #is the file a regular file?
- name: "check if {{package_misc_folder}} exists"
stat:
path: "{{package_misc_folder}}"
register: misc
- name: "create {{version_misc_folder}} folder (optional)"
file:
path: "{{version_misc_folder}}"
state: directory
when: misc.stat.isdir is defined and misc.stat.isdir #is it a directory?
- name: "copy package misc folder to hybris/data/misc (optional)"
shell: "cp -rf {{package_misc_folder}}/* {{version_misc_folder}}"
when: misc.stat.isdir is defined and misc.stat.isdir #is it a directory?