generated from VeeamHub/veeamhub-template
-
Notifications
You must be signed in to change notification settings - Fork 20
/
vbr_upgrade.yml
325 lines (322 loc) · 14.4 KB
/
vbr_upgrade.yml
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
---
# vbr_upgrade tasks file for veeamhub.veeam_vas
- name: Checking OS for pending reboots
pending_reboot_check:
register: precheck
- name: Is there an existing pending reboot?
fail:
msg: "This Windows server requires a reboot prior to beginning the Veeam Backup & Replication install. After rebooting this server, you can proceed with the installation."
when:
- precheck.pending_reboot | bool
- name: Checking to see if Veeam Backup & Replication Server is installed
veeam_software_check:
name: "Veeam Backup & Replication Server"
register: software
- name: Is Veeam Backup & Replication Server installed?
fail:
msg: "Veeam Backup & Replication Server must be installed on this server in order to upgrade it."
when: not (software.installed | bool)
- name: Including version-specific variables
include_vars:
file: "vars/vbr_v{{ version }}.yml"
- name: Ensure Veeam services are running
ansible.windows.win_shell: |
Get-Service veeam* | Start-Service -ErrorAction SilentlyContinue
# PRE-UPGRADE TASKS
- name: Enable Cloud Connect Maintenance Mode
veeam_vbr_cloud_connect_maintenance:
state: enable
when: cloud_connect | bool
- name: VBR ISO Tasks
include_tasks: mount_iso.yml
- name: Print Upgrade Configuration
debug:
msg:
- "ISO Drive Letter: '{{ source }}'"
- "Upgrade Logs Folder: '{{ destination }}logs'"
- "Version: {{ version }}"
- "Download ISO?: {{ iso_download }}"
- "ISO Source: {{ iso_url }}"
- "ISO File Destination: {{ destination }}{{ destination_iso_file }}"
- "Use license?: {{ license }}"
- "License Source: {{ source_license }}"
- "License File Destination: {{ destination }}{{ destination_license_file }}"
- name: Create logs directory
ansible.windows.win_file:
path: "{{ destination }}logs"
state: directory
- name: Copy license file
ansible.windows.win_copy:
src: "{{ source_license }}"
dest: "{{ destination }}{{ destination_license_file }}"
when: license | bool
- name: Start adhoc VBR configuration backup job
veeam_vbr_config_backup:
state: adhoc
- name: Stopping and disabling all backup jobs
veeam_vbr_upgrade_job_prep:
state: disable
jobs_file: "{{ vbr_jobs_file }}"
when: not (cloud_connect | bool)
register: jobs
- name: Print Backup Jobs backup file name
debug:
var: jobs
when: not (cloud_connect | bool)
- name: Stopping all Veeam services prior to upgrade
ansible.windows.win_shell: |
Stop-Process -Name "Veeam.Backup.Shell" -Force -ErrorAction SilentlyContinue
Get-Service veeam* | Stop-Service
- name: .NET Framework
include_tasks: install_net_framework.yml
- name: Looking for .NET Core Runtime in Veeam ISO
ansible.windows.win_find:
paths: "{{ source }}Redistr\\x64"
patterns: dotnet-runtime-.*
recurse: no
file_type: file
use_regex: true
ignore_errors: yes
register: file
when: version | int >= 11
- name: Install Microsoft .NET Core Runtime
ansible.windows.win_package:
path: "{{ file.files[0].path }}"
product_id: Install .NET Core Runtime
state: present
arguments: '/install /quiet /norestart /log "{{ destination }}logs\\dotnet-runtime-x.x.x-win-x64.log"'
when: version | int >= 11
- name: Looking for ASP.NET Core Shared Framework in Veeam ISO
ansible.windows.win_find:
paths: "{{ source }}Redistr\\x64"
patterns: aspnetcore-runtime-.*
recurse: no
file_type: file
use_regex: true
ignore_errors: yes
register: file
when: version | int >= 11
- name: Install Microsoft ASP.NET Core Shared Framework
ansible.windows.win_package:
path: "{{ file.files[0].path }}"
product_id: Install ASP.NET Core Runtime
state: present
arguments: '/install /quiet /norestart /log "{{ destination }}logs\\aspnetcore-runtime-x.x.x-win-x64.log"'
when: version | int >= 11
- name: Install Microsoft Visual C++ Redistributable
ansible.windows.win_package:
path: "{{ source }}Redistr\\x64\\vc_redist.x64.exe"
product_id: Install C++ Framework
state: present
arguments: '/install /quiet /norestart /log "{{ destination }}logs\\vc_redist.x64.log"'
ignore_errors: yes
when: version | int >= 11
# UPGRADING VEEAM SOFTWARE
- name: Upgrade Veeam Backup Catalog (v12+)
ansible.windows.win_package:
path: "{{ source }}Catalog\\VeeamBackupCatalog64.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamBackupCatalog64.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_LICENSING_POLICY="1" ACCEPT_REQUIRED_SOFTWARE="1" ACCEPT_THIRDPARTY_LICENSES="1"'
register: win_package_vbr_catalog
when: version | int >= 12
- name: Upgrade Veeam Backup Catalog (v11-)
ansible.windows.win_package:
path: "{{ source }}Catalog\\VeeamBackupCatalog64.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamBackupCatalog64.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
register: win_package_vbr_catalog
when: version | int <= 11
- name: Upgrade Veeam Backup & Replication Server with license (v12+)
ansible.windows.win_package:
path: "{{ source }}Backup\\Server.x64.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\BackupServer.log" ACCEPT_LICENSING_POLICY="1" ACCEPT_REQUIRED_SOFTWARE="1" ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1" VBR_LICENSE_FILE="{{ destination }}{{ destination_license_file }}" VBR_AUTO_UPGRADE="1"'
when:
- version | int >= 12
- license | bool
register: win_package_vbr_server
- name: Upgrade Veeam Backup & Replication Server without license (v12+)
ansible.windows.win_package:
path: "{{ source }}Backup\\Server.x64.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\BackupServer.log" ACCEPT_LICENSING_POLICY="1" ACCEPT_REQUIRED_SOFTWARE="1" ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1" VBR_AUTO_UPGRADE="1"'
when:
- version | int >= 12
- not license | bool
register: win_package_vbr_server
- name: Upgrade Veeam Backup & Replication Server with license (v11-)
ansible.windows.win_package:
path: "{{ source }}Backup\\Server.x64.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\BackupServer.log" /norestart /qn" ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1" VBR_LICENSE_FILE="{{ destination }}{{ destination_license_file }}" VBR_AUTO_UPGRADE="YES"'
when:
- version | int <= 11
- license | bool
- name: Upgrade Veeam Backup & Replication Server without license (v11-)
ansible.windows.win_package:
path: "{{ source }}Backup\\Server.x64.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\BackupServer.log" /norestart /qn" ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1" VBR_AUTO_UPGRADE="YES"'
when:
- version | int <= 11
- not license | bool
- name: Upgrade Veeam Backup & Replication Console (v12+)
ansible.windows.win_package:
path: "{{ source }}Backup\\Shell.x64.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\Shell.x64.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_LICENSING_POLICY="1" ACCEPT_REQUIRED_SOFTWARE="1" ACCEPT_THIRDPARTY_LICENSES="1"'
register: win_package_vbr_console
when: version | int >= 12
- name: Upgrade Veeam Backup & Replication Console (v11-)
ansible.windows.win_package:
path: "{{ source }}Backup\\Shell.x64.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\Shell.x64.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
register: win_package_vbr_console
when: version | int <= 11
- name: Upgrade Veeam Explorer for ActiveDirectory
ansible.windows.win_package:
path: "{{ source }}Explorers\\VeeamExplorerForActiveDirectory.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamExplorerForActiveDirectory.log" /norestart /qn ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Upgrade Veeam Explorer for Exchange
ansible.windows.win_package:
path: "{{ source }}Explorers\\VeeamExplorerForExchange.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamExplorerForExchange.log" /norestart /qn ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Upgrade Veeam Explorer for Oracle
ansible.windows.win_package:
path: "{{ source }}Explorers\\VeeamExplorerForOracle.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamExplorerForOracle.log" /norestart /qn ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Upgrade Veeam Explorer for Postres
ansible.windows.win_package:
path: "{{ source }}Explorers\\VeeamExplorerForPostgreSQL.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamExplorerForPostgreSQL.log" /norestart /qn ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"'
when: version | int >= 12
- name: Upgrade Veeam Explorer for SharePoint
ansible.windows.win_package:
path: "{{ source }}Explorers\\VeeamExplorerForSharePoint.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamExplorerForSharePoint.log" /norestart /qn ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Upgrade Veeam Explorer for SQL
ansible.windows.win_package:
path: "{{ source }}Explorers\\VeeamExplorerForSQL.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamExplorerForSQL.log" /norestart /qn ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Upgrade Veeam Explorer for Microsoft Teams
ansible.windows.win_package:
path: "{{ source }}Explorers\\VeeamExplorerForTeams.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamExplorerForTeams.log" /norestart /qn ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"'
when: version | int >= 11
- name: Upgrade Veeam Distribution Service
ansible.windows.win_package:
path: "{{ source }}Packages\\VeeamDistributionSvc.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamDistributionSvc.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Upgrade Veeam Installer Service
ansible.windows.win_package:
path: "{{ source }}Packages\\VeeamInstallerSvc.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamInstallerSvc.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Upgrade Veeam Plug-ins for Enterprise Applications Redistributable
ansible.windows.win_package:
path: "{{ source }}Packages\\DbPluginRedist.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\DbPluginRedist.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
when: version | int >= 12
- name: Upgrade Veeam Agent for Linux Redistributable
ansible.windows.win_package:
path: "{{ source }}Packages\\VALRedist.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VALRedist.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Upgrade Veeam Agent for MacOS Redistributable
ansible.windows.win_package:
path: "{{ source }}Packages\\VAMRedist.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VAMRedist.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
when: version | int >= 11
- name: Upgrade Veeam Agent for Microsoft Windows Redistributable
ansible.windows.win_package:
path: "{{ source }}Packages\\VAWRedist.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VAWRedist.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Looking for Veeam Agent for Unix Redistributable
ansible.windows.win_stat:
path: "{{ source }}Packages\\VAURedist.msi"
register: file
- name: Upgrade Veeam Agent for Unix Redistributable
ansible.windows.win_package:
path: "{{ source }}Packages\\VAURedist.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VAURedist.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
when: file.stat.exists
- name: Upgrade Veeam Mount Service
ansible.windows.win_package:
path: "{{ source }}Packages\\VeeamMountService.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamMountService.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Upgrade Veeam Backup Transport
ansible.windows.win_package:
path: "{{ source }}Packages\\VeeamTransport.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamTransport.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Upgrade Veeam Backup vPowerNFS
ansible.windows.win_package:
path: "{{ source }}Packages\\VPowerNFS.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VPowerNFS.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
- name: Checking to see if Veeam Backup Cloud Gateway is installed
veeam_software_check:
name: "Veeam Backup Cloud Gateway"
register: software
- name: Upgrade Veeam Backup Cloud Gateway
ansible.windows.win_package:
path: "{{ source }}Packages\\VeeamGateSvc.msi"
state: present
arguments: '/L*v "{{ destination }}logs\\VeeamGateSvc.log" /norestart /qn ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"'
when: software.installed | bool
- name: Finding file(s) in '{{ source }}Updates' directory
ansible.windows.win_find:
paths: "{{ source }}Updates"
recurse: no
file_type: file
ignore_errors: yes
register: file
- name: Does VBR need to be patched?
set_fact:
patch: "{{ file.matched }}"
- name: Setting patch filename
set_fact:
patch_file: "{{ file.files[0].filename }}"
when: patch | bool
- name: Including VBR patch tasks
include_tasks: vbr_patch.yml
when: patch | bool
# POST-UPGRADE TASKS
- name: Starting all Veeam services to kick off upgrade of repo/proxy servers
ansible.windows.win_shell: |
Get-Service veeam* | Where-Object {$_.Name -ne "VeeamMBPDeploymentService"} | Start-Service
- name: Disable Cloud Connect Maintenance Mode
veeam_vbr_cloud_connect_maintenance:
state: disable
when: cloud_connect | bool
- name: Enabling all backup jobs in specified file
veeam_vbr_upgrade_job_prep:
state: enable
jobs_file: "{{ vbr_jobs_file }}"
when: not (cloud_connect | bool)
- name: Stopping all Veeam services (this may take a while)
ansible.windows.win_shell: |
if (-Not (Get-Module -ListAvailable -Name Veeam.Backup.PowerShell)){Add-PSSnapin -PassThru VeeamPSSnapIn -ErrorAction Stop | Out-Null}
Get-VBRJob | Stop-VBRJob | Out-Null
Get-Service veeam* | Stop-Service
- name: Unmount ISO
community.windows.win_disk_image:
image_path: "{{ destination }}{{ destination_iso_file }}"
state: absent
- name: Rebooting server now to complete upgrade
ansible.windows.win_reboot:
msg: Reboot initiated by Ansible to complete VBR upgrade