前言
Veeam VAS v10 很快就要发布了,在不久以前的 v10 RTM 发布后,有许多 Veeam 的合作伙伴都在问关于如何利用 Ansible 自动化部署Veeam v10 的问题,大部分 Partner 是 Playbook 跑不通,经过分析,其原因也是比较多样性的。但大家的心声基本围绕着能否在上次做的 Ansible 环境的基础上不更改任何配置,只需要进行 Playbook 的文件替换就可以实现新的v10的安装。
在这里我给大家制作了 Veeam VAS v10 的 Playbook for Ansible, 也就是VBR + Veeam One 的 Playbook 希望对大家有所帮助。
本文主要内容
-
- Ansible 基本知识与安装配置
-
- Ansible 自动化部署环境准备环境准备
-
- 连通性测试,win-ping
-
- VBR 的自动化安装
- 4.1 VBR Playbook 的结构
- 4.2 VBR Playbook 的YAML文件
- 4.3 VBR Playbook 的执行过程
- 4.4 VBR Playbook 的执行结果
-
- Veeam One 的自动化安装
- 5.1 Veeam One Playbook 避坑技巧
- 5.2 Veeam One Playbook 的结构
- 5.3 Veeam One Playbook 的YAML文件
- 5.4 Veeam One Playbook 的执行过程
- 5.5 查看 Veeam One Playbook 的执行结果
- 参考书籍与推荐阅读
1. Ansible 基本知识与安装配置
在上一期的Veeam 自动化部署中,我已经阐述了如果进行 Ansible 的安装与配置 、Veeam 的静默安装模式 , 详情请参阅如下文档,也欢迎随时和我讨论
利用 Ansible 自动化部署 Veeam Backup & Replication 9.5U4b
https://www.jianshu.com/p/879f30c9c465
2. Ansible 自动化部署环境准备
2.1 配置 Ansible 的 Inventory文件,定义hosts
此处为了简便,我们使用Ansible默认的inventory文件,/etc/ansible/hosts
[VBR]
172.16.60.133
[VBR:vars]
ansible_connection=winrm
ansible_user="Administrator"
#ansible_ssh_pass=!vault | $ANSIBLE_VAULT;1.1;AES256
ansible_ssh_port=5985
ansible_winrm_server_cert_validation=ignore
ansible_winrm_transport=ntlm
2.2 执行对象--Windows 服务器的部署
在我们的环境中,Windows是我们自动化安装VBR的服务器。 为了使 Windows Server 准备授予 WinRM 访问权限,我使用了以下脚本使我们环境可以快速的Ready!
ConfigureRemotingForAnsible.ps1 脚本,您可以前往Ansible社区的Github下载,脚本执行如下
ConfigureRemotingForAnsible.ps1
PS C:\Users\Administrator\Desktop\code> .\ConfigRemotingForAnsiable.ps1 -Verbose
VERBOSE: Verifying WinRM service.
VERBOSE: PS Remoting is already enabled.
VERBOSE: SSL listener is already active.
VERBOSE: Basic auth is already enabled.
VERBOSE: Firewall rule already exists to allow WinRM HTTPS.
VERBOSE: HTTP: Enabled | HTTPS: Enabled
VERBOSE: PS Remoting has been successfully configured for Ansible.
PS C:\Users\Administrator\Desktop\code>
3. 连通性测试,win-ping
Ansible 有一个非常好的工具win-ping,专门用来测试与Windows的Host定义是不是可以联通。详情可以参照,Asible的手册。
[《Ansible 用户手册》] (https://https://docs.ansible.com/ansible/2.5/user_guide/quickstart.html)
[root@localhost ~]# ansible VBR -m win_ping --vault-password-file vault_pass.txt
172.16.60.133 | SUCCESS => {
"changed": false,
"ping": "pong"
}
4. 编写 Ansible Playbook 进行自动化编排
4.1 VBR Playbook 的描述
我们用以下结构表示 VBR Installation Playbook 4个阶段与主要系统活动,这将其写到README中,帮助系统管理员对这个Yaml文件的描述一目了然,值得注意的是,用于Veeam数据处理的数据库已经升级到了SQL 2016 Express SP2
Veeam VBR v10 Setup Play Book/
|-- 1. Esttablish System Enrironment/
| |-- 1.1 Install 2012 System CLR Types
| |-- 1.2 Install 2012 Shared management objects
|
|-- 2. Create Local User/
| |-- 2.1 Create Local Service and RunAs User
| |-- 2.2 Create Local SQL User
|
|-- 3. Esttablish System Enrironment/
| |-- 3.1 Install SQL 2016 Express SP2
|
|-- 4. VBR Installation/
|-- 4.1 Install VBR Catalog
|-- 4.2 Install VBR Server
|-- 4.3 Install VBR Console
|-- 4.4 install VBR Explorer for ActiveDirectory
|-- 4.5 Install VBR Explorer for Exchange
|-- 4.6 Install VBR Explorer for Oracle
|-- 4.7 Install VBR Explorer for SharePoint
|-- 4.8 Install VBR Explorer for SQL
4.2 VBR Playbook的YAML文件
Playbook中的所有预定义应答,请参考Veeam的手册,在这里我们定义的服务器名为VBR,这与真实的主机名已经解偶,Playbook 中继承了 win_package Ansible 模块,这可以自动处理参数中所需的大多数转义。在软件源的定义中,我给出了最简单的路径,您可以按照需求进行定义,
# Veeam v10 Setup Task File
- name: VBR v10 Setup
hosts: VBR
gather_facts: yes
vars:
vbr_source: "D:\\"
sql_username: "svc_sql"
sql_userpassword: "Start123"
sql_sapassword: "Start123"
vbr_username: "svc_vbr"
vbr_userpassword: "Start123"
tasks:
- name: Pre - Install 2012 System CLR Types
win_package:
path: "{{ vbr_source }}Redistr\\x64\\SQLSysClrTypes.msi"
state: present
tags: pre
- name: Pre - Install 2012 Shared management objects
win_package:
path: "{{ vbr_source }}Redistr\\x64\\SharedManagementObjects.msi"
state: present
- name: Pre - Create Local Service and RunAs User
win_user:
name: "{{ vbr_username }}"
password: "{{ vbr_userpassword }}"
password_never_expires: yes
state: present
groups:
- Administrators
tags: pre
- name: SQL - Create Local SQL User
win_user:
name: "{{ sql_username }}"
password: "{{ sql_userpassword }}"
password_never_expires: yes
state: present
groups:
- Users
tags: pre
- name: SQL - Install SQL Express 2016 SP2
win_package:
path: "{{ vbr_source }}Redistr\\x64\\SqlExpress\\2016SP2\\SQLEXPR_x64_ENU.exe"
product_id: SQL 2016 Express
arguments:
- '/q'
- '/ACTION=Install'
- '/IACCEPTSQLSERVERLICENSETERMS'
- '/FEATURES=SQL'
- '/INSTANCENAME=VEEAMSQL2016'
- '/SQLSVCACCOUNT={{ sql_username }}'
- '/SQLSVCPASSWORD={{ sql_userpassword }}'
- '/SECURITYMODE=SQL'
- '/SAPWD={{ sql_sapassword }}'
- '/ADDCURRENTUSERASSQLADMIN'
- '/UPDATEENABLED=0'
- '/TCPENABLED=1'
- '/NPENABLED=1'
become: yes
become_flags: logon_type=batch
vars:
ansible_become_method: runas
ansible_become_user: "{{ vbr_username }}"
ansible_become_pass: "{{ vbr_userpassword }}"
tags: sql
- name: Install VBR Catalog
win_package:
path: "{{ vbr_source }}Catalog\\VeeamBackupCatalog64.msi"
state: present
arguments:
- 'VBRC_SERVICE_ACCOUNT_TYPE=1'
- 'ACCEPT_THIRDPARTY_LICENSES=1'
tags: vbr
- name: Install VBR Server
win_package:
path: "{{ vbr_source }}Backup\\Server.x64.msi"
state: present
arguments: "VBR_SERVICE_ACCOUNT_TYPE=1 VBR_SQLSERVER_AUTHENTICATION=1 VBR_SQLSERVER_SERVER=(local)\\VEEAMSQL2016 VBR_SQLSERVER_USERNAME=sa VBR_SQLSERVER_PASSWORD={{ sql_sapassword }} ACCEPT_THIRDPARTY_LICENSES=1 ACCEPTEULA=YES"
tags: vbr
- name: Install VBR Console
win_package:
path: "{{ vbr_source }}Backup\\Shell.x64.msi"
state: present
arguments:
- 'ACCEPTEULA=YES'
- 'ACCEPT_THIRDPARTY_LICENSES=1'
tags: vbr
- name: Install VBR Explorer for ActiveDirectory
win_package:
path: "{{ vbr_source }}Explorers\\VeeamExplorerForActiveDirectory.msi"
state: present
arguments:
- 'ACCEPT_EULA=1'
- 'ACCEPT_THIRDPARTY_LICENSES=1'
tags: vbr
- name: Install VBR Explorer for Exchange
win_package:
path: "{{ vbr_source }}Explorers\\VeeamExplorerForExchange.msi"
state: present
arguments:
- 'ACCEPT_EULA=1'
- 'ACCEPT_THIRDPARTY_LICENSES=1'
tags: vbr
- name: Install VBR Explorer for Oracle
win_package:
path: "{{ vbr_source }}Explorers\\VeeamExplorerForOracle.msi"
state: present
arguments:
- 'ACCEPT_EULA=1'
- 'ACCEPT_THIRDPARTY_LICENSES=1'
tags: vbr
- name: Install VBR Explorer for SharePoint
win_package:
path: "{{ vbr_source }}Explorers\\VeeamExplorerForSharePoint.msi"
state: present
arguments:
- 'ACCEPT_EULA=1'
- 'ACCEPT_THIRDPARTY_LICENSES=1'
tags: vbr
- name: Install VBR Explorer for SQL
win_package:
path: "{{ vbr_source }}Explorers\\VeeamExplorerForSQL.msi"
state: present
arguments:
- 'ACCEPT_EULA=1'
- 'ACCEPT_THIRDPARTY_LICENSES=1'
tags: vbr
4.3 VBR Playbook 的执行过程
[root@localhost ~]# ansible-playbook ./Veeam_setup.yml --vault-password-file vault_pass.txt
PLAY [VBR Community Edition Setup] *******************************************************************************
TASK [Gathering Facts] *******************************************************************************************
ok: [172.16.60.133]
TASK [Pre - Install 2012 System CLR Types] ***********************************************************************
changed: [172.16.60.133]
TASK [Pre - Install 2012 Shared management objects] **************************************************************
changed: [172.16.60.133]
TASK [SQL - Create Local SQL User] *******************************************************************************
ok: [172.16.60.133]
TASK [SQL - Install SQL 2016 Express] ****************************************************************************
changed: [172.16.60.133]
TASK [Install VBR Catalog] ***************************************************************************************
changed: [172.16.60.133]
TASK [Install VBR Server] ****************************************************************************************
changed: [172.16.60.133]
TASK [Install VBR Console] ***************************************************************************************
changed: [172.16.60.133]
TASK [Install VBR Explorer for ActiveDirectory] ******************************************************************
changed: [172.16.60.133]
TASK [Install VBR Explorer for Exchange] *************************************************************************
changed: [172.16.60.133]
TASK [Install VBR Explorer for Oracle] ***************************************************************************
changed: [172.16.60.133]
TASK [Install VBR Explorer for SharePoint] ***********************************************************************
changed: [172.16.60.133]
TASK [Install VBR Explorer for SQL] ******************************************************************************
changed: [172.16.60.133]
TASK [Install VBR Update 4b] *************************************************************************************
changed: [172.16.60.133]
PLAY RECAP *******************************************************************************************************
172.16.60.133 : ok=14 changed=12 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
4.4 查看 VBR Playbook 的执行结果
此时,可以看到服务器的上我们需要的服务都已经启动
PS C:\Users\Administrator> Get-service Veeam*
Status Name DisplayName
------ ---- -----------
Running VeeamBackupSvc Veeam Backup Service
Running VeeamBrokerSvc Veeam Broker Service
Running VeeamCatalogSvc Veeam Guest Catalog Service
Running VeeamCloudSvc Veeam Cloud Connect Service
Running VeeamDeploySvc Veeam Installer Service
Running VeeamDistributi... Veeam Distribution Service
Running VeeamMountSvc Veeam Mount Service
Running VeeamNFSSvc Veeam vPower NFS Service
Running VeeamTransportSvc Veeam Data Mover Service
PS C:\Users\Administrator> Get-service SQL*
Status Name DisplayName
------ ---- -----------
Stopped SQLAgent$VEEAMS... SQL Server Agent (VEEAMSQL2016)
Running SQLBrowser SQL Server Browser
Running SQLTELEMETRY$VE... SQL Server CEIP service (VEEAMSQL2016)
Running SQLWriter SQL Server VSS Writer
5. Veeam One 安装
5.1 Veeam One 自动化安装避坑技巧
关于 0x800f0950 错误
有些同学遇到的问题是在 Veeam One 自动化安装的过程中,执行失败报 0x800f0950 错误 这是由于系统中的NET framework 3.5 Feature 启用失败所导致的。具体原因大都是在系统中找不到 sources/sxs,关于这一点不是本文讨论的主要内容。请参考如下方法与链接。
fatal: [172.16.60.133]: FAILED! => {"changed": false, "msg": "Failed to install Windows Feature: The request to add or remove features on the specified server failed.\r\nInstallation of one or more roles, role services, or features failed. Error: 0x800f0950\n"}
PLAY RECAP *****************************************************************************************************************************
172.16.60.133 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
利用 DISM 启用 NET framework 3.5
C:\Users\Administrator>Dism /online /enable-feature /featurename:NetFX3 /All /Source:E:sources/sxs /LimitAccess
Deployment Image Servicing and Management tool
Version: 10.0.17763.1
Image Version: 10.0.17763.1
Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.
5.2 Veeam One Playbook 的描述
我们用以下结构表示 Veeam One Installation Playbook 4个阶段与主要系统活动,这将其写到README中,帮助系统管理员对这个Yaml文件的描述一目了然。
Veeam One v10 Setup Play Book/
|-- 1. Config firewall/
| |-- 1.1 Reporter Console
| |-- 1.2 Business View
| |-- 1.3 Veeam One Agent
| |-- 1.4 Server SMB
|
|-- 2. Create Local User/
| |-- 2.1 Veeam One Service User
| |-- 2.2 SQL Service User
|
|-- 3. Esttablish System Enrironment/
| |-- 3.1 Install 2012 System CLR Types
| |-- 3.2 Install 2012 Shared management objects
| |-- 3.3 Install XML Parser
| |-- 3.4 Install SQL Native Client
| |-- 3.5 Install ReportViewer
| |-- 3.6 Install IIS
| |-- 3.7 Install SQL 2016 Express
|
|-- 4. Veeam One Installation/
|-- 4.1 Install ONE Monitor Server
|-- 4.2 Install ONE Reporter Server
|-- 4.3 Install ONE Reporter Web UI
|-- 4.4 Install ONE Monitor Client
|-- 4.5 Install ONE Agent
5.3 Veeam One Playbook 的YAML文件
以下是 Veeam One Play for Ansible 的YAML文件 供大家参考,在对yaml进行编辑的时候需要细心,注意缩进。
# Veeam v10 Veeam One Setup
- name: Veeam One v10 Setup
hosts: VBR
gather_facts: yes
vars:
one_source: "D:\\"
sql_username: "svc_sql"
sql_userpassword: !vault |
$ANSIBLE_VAULT;1.1;AES256
sql_sapassword: !vault |
$ANSIBLE_VAULT;1.1;AES256
one_username: "svc_vbr"
one_userpassword: !vault |
$ANSIBLE_VAULT;1.1;AES256
tasks:
- name: Pre - Enable firewall
win_firewall:
state: enabled
profiles:
- Domain
- Private
- Public
- name: Pre - Configure firewall rule "Reporter Console"
win_firewall_rule:
name: VeeamONE_ReporterConsole
localport: 1239
action: allow
direction: in
protocol: tcp
state: present
enabled: yes
- name: Pre - Configure firewall rule "Business View"
win_firewall_rule:
name: VeeamONE_BusinessView
localport: 1340
action: allow
direction: in
protocol: tcp
state: present
enabled: yes
- name: Pre - Configure firewall rule "Agent"
win_firewall_rule:
name: VeeamONE_Agent
localport: 2805
action: allow
direction: in
protocol: tcp
state: present
enabled: yes
- name: Pre - Configure firewall rule "Server SMB"
win_firewall_rule:
name: VeeamONE_ServerSMB
localport: 445
action: allow
direction: in
protocol: tcp
state: present
enabled: yes
- name: Pre - Create Local Veeam ONE Service User
win_user:
name: "{{ one_username }}"
password: "{{ one_userpassword }}"
password_never_expires: yes
state: present
groups:
- Administrators
- name: Pre - Create Local SQL Service User
win_user:
name: "{{ sql_username }}"
password: "{{ sql_userpassword }}"
password_never_expires: yes
state: present
groups:
- Users
- name: Pre - Install 2012 System CLR Types
win_package:
path: "{{ one_source }}Redistr\\x64\\SQLSysClrTypes.msi"
state: present
- name: Pre - Install 2012 Shared management objects
win_package:
path: "{{ one_source }}Redistr\\x64\\SharedManagementObjects.msi"
state: present
- name: Pre - Install XML Parser
win_package:
path: "{{ one_source }}Redistr\\x64\\msxml6_x64.msi"
state: present
- name: Pre - Install SQL Native Client
win_package:
path: "{{ one_source }}Redistr\\x64\\sqlncli.msi"
state: present
arguments: "IACCEPTSQLNCLILICENSETERMS=YES"
- name: Pre - Install ReportViewer
win_package:
path: "{{ one_source }}Redistr\\ReportViewer.msi"
state: present
- name: Pre - Install IIS
win_feature:
name: Web-Server
state: present
include_sub_features: yes
include_management_tools: yes
- name: Pre - Install SQL 2016 Express
win_package:
path: "{{ one_source }}Redistr\\x64\\SqlExpress\\2016SP2\\SQLEXPR_x64_ENU.exe"
product_id: SQL 2016 Express
arguments:
- '/q'
- '/ACTION=Install'
- '/IACCEPTSQLSERVERLICENSETERMS'
- '/FEATURES=SQL'
- '/INSTANCENAME=VEEAMSQL2016'
- '/SQLSVCACCOUNT={{ sql_username }}'
- '/SQLSVCPASSWORD={{ sql_userpassword }}'
- '/SECURITYMODE=SQL'
- '/SAPWD={{ sql_sapassword }}'
- '/ADDCURRENTUSERASSQLADMIN'
- '/UPDATEENABLED=0'
- '/TCPENABLED=1'
- '/NPENABLED=1'
become: yes
become_flags: logon_type=batch
vars:
ansible_become_method: runas
ansible_become_user: "{{ one_username }}"
ansible_become_pass: "{{ one_userpassword }}"
- name: Install ONE Monitor Server
win_package:
path: "{{ one_source }}Monitor\\VeeamONE.Monitor.Server.x64.msi"
state: present
arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPT_EULA=1 VM_MN_SERVICEACCOUNT={{ one_username }} VM_MN_SERVICEPASSWORD={{ one_userpassword }} VM_MN_SQL_SERVER=localhost\\VEEAMSQL2016 VM_MN_SQL_AUTHENTICATION=1 VM_MN_SQL_USER=sa VM_MN_SQL_PASSWORD={{ sql_sapassword }} VM_BACKUP_ADD_LATER=1 VM_VC_SELECTED_TYPE=2"
- name: Install ONE Reporter Server
win_package:
path: "{{ one_source }}Reporter\\VeeamONE.Reporter.Server.x64.msi"
state: present
arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPT_EULA=1 VM_RP_SERVICEACCOUNT={{ one_username }} VM_RP_SERVICEPASSWORD={{ one_userpassword }} VM_RP_SQL_SERVER=localhost\\VEEAMSQL2016 VM_RP_SQL_AUTHENTICATION=1 VM_RP_SQL_USER=sa VM_RP_SQL_PASSWORD={{ sql_sapassword }} VM_BACKUP_ADD_LATER=1 VM_VC_SELECTED_TYPE=2"
include_management_tools: yes
- name: Pre - Install SQL 2016 Express
win_package:
path: "{{ one_source }}Redistr\\x64\\SqlExpress\\2016SP2\\SQLEXPR_x64_ENU.exe"
product_id: SQL 2016 Express
arguments:
- '/q'
- '/ACTION=Install'
- '/IACCEPTSQLSERVERLICENSETERMS'
- '/FEATURES=SQL'
- '/INSTANCENAME=VEEAMSQL2016'
- '/SQLSVCACCOUNT={{ sql_username }}'
- '/SQLSVCPASSWORD={{ sql_userpassword }}'
- '/SECURITYMODE=SQL'
- '/SAPWD={{ sql_sapassword }}'
- '/ADDCURRENTUSERASSQLADMIN'
- '/UPDATEENABLED=0'
- '/TCPENABLED=1'
- '/NPENABLED=1'
become: yes
become_flags: logon_type=batch
vars:
ansible_become_method: runas
ansible_become_user: "{{ one_username }}"
ansible_become_pass: "{{ one_userpassword }}"
- name: Install ONE Monitor Server
win_package:
path: "{{ one_source }}Monitor\\VeeamONE.Monitor.Server.x64.msi"
state: present
arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPT_EULA=1 VM_MN_SERVICEACCOUNT={{ one_username }} VM_MN_SERVICEPASSWORD={{ one_userpassword }} VM_MN_SQL_SERVER=localhost\\VEEAMSQL2016 VM_MN_SQL_AUTHENTICATION=1 VM_MN_SQL_USER=sa VM_MN_SQL_PASSWORD={{ sql_sapassword }} VM_BACKUP_ADD_LATER=1 VM_VC_SELECTED_TYPE=2"
- name: Install ONE Reporter Server
win_package:
path: "{{ one_source }}Reporter\\VeeamONE.Reporter.Server.x64.msi"
state: present
arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPT_EULA=1 VM_RP_SERVICEACCOUNT={{ one_username }} VM_RP_SERVICEPASSWORD={{ one_userpassword }} VM_RP_SQL_SERVER=localhost\\VEEAMSQL2016 VM_RP_SQL_AUTHENTICATION=1 VM_RP_SQL_USER=sa VM_RP_SQL_PASSWORD={{ sql_sapassword }} VM_BACKUP_ADD_LATER=1 VM_VC_SELECTED_TYPE=2"
- name: Pre - Install SQL Native Client
win_package:
path: "{{ one_source }}Redistr\\x64\\sqlncli.msi"
state: present
arguments: "IACCEPTSQLNCLILICENSETERMS=YES"
- name: Pre - Install ReportViewer
win_package:
path: "{{ one_source }}Redistr\\ReportViewer.msi"
state: present
- name: Pre - Install IIS
win_feature:
name: Web-Server
state: present
include_sub_features: yes
include_management_tools: yes
- name: Pre - Install SQL 2016 Express
win_package:
path: "{{ one_source }}Redistr\\x64\\SqlExpress\\2016SP2\\SQLEXPR_x64_ENU.exe"
product_id: SQL 2016 Express
arguments:
- '/q'
- '/ACTION=Install'
- '/IACCEPTSQLSERVERLICENSETERMS'
- '/FEATURES=SQL'
- '/INSTANCENAME=VEEAMSQL2016'
- '/SQLSVCACCOUNT={{ sql_username }}'
- '/SQLSVCPASSWORD={{ sql_userpassword }}'
- '/SECURITYMODE=SQL'
- '/SAPWD={{ sql_sapassword }}'
- '/ADDCURRENTUSERASSQLADMIN'
- '/UPDATEENABLED=0'
- '/TCPENABLED=1'
- '/NPENABLED=1'
become: yes
become_flags: logon_type=batch
vars:
ansible_become_method: runas
ansible_become_user: "{{ one_username }}"
ansible_become_pass: "{{ one_userpassword }}"
- name: Install ONE Monitor Server
win_package:
path: "{{ one_source }}Monitor\\VeeamONE.Monitor.Server.x64.msi"
state: present
arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPT_EULA=1 VM_MN_SERVICEACCOUNT={{ one_username }} VM_MN_SERVICEPASSWORD={{ one_uss
erpassword }} VM_MN_SQL_SERVER=localhost\\VEEAMSQL2016 VM_MN_SQL_AUTHENTICATION=1 VM_MN_SQL_USER=sa VM_MN_SQL_PASSWORD={{ sql_sapasswoo
rd }} VM_BACKUP_ADD_LATER=1 VM_VC_SELECTED_TYPE=2"
- name: Install ONE Reporter Server
win_package:
path: "{{ one_source }}Reporter\\VeeamONE.Reporter.Server.x64.msi"
state: present
arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPT_EULA=1 VM_RP_SERVICEACCOUNT={{ one_username }} VM_RP_SERVICEPASSWORD={{ one_uss
erpassword }} VM_RP_SQL_SERVER=localhost\\VEEAMSQL2016 VM_RP_SQL_AUTHENTICATION=1 VM_RP_SQL_USER=sa VM_RP_SQL_PASSWORD={{ sql_sapasswoo
rd }} VM_BACKUP_ADD_LATER=1 VM_VC_SELECTED_TYPE=2"
- name: Pre - Install SQL Native Client
win_package:
path: "{{ one_source }}Redistr\\x64\\sqlncli.msi"
state: present
arguments: "IACCEPTSQLNCLILICENSETERMS=YES"
- name: Pre - Install ReportViewer
win_package:
path: "{{ one_source }}Redistr\\ReportViewer.msi"
state: present
- name: Pre - Install IIS
win_feature:
name: Web-Server
state: present
include_sub_features: yes
include_management_tools: yes
- name: Pre - Install SQL 2016 Express
win_package:
path: "{{ one_source }}Redistr\\x64\\SqlExpress\\2016SP2\\SQLEXPR_x64_ENU.exe"
product_id: SQL 2016 Express
arguments:
- '/q'
- '/ACTION=Install'
- '/IACCEPTSQLSERVERLICENSETERMS'
- '/FEATURES=SQL'
- '/INSTANCENAME=VEEAMSQL2016'
- '/SQLSVCACCOUNT={{ sql_username }}'
- '/SQLSVCPASSWORD={{ sql_userpassword }}'
- '/SECURITYMODE=SQL'
- '/SAPWD={{ sql_sapassword }}'
- '/ADDCURRENTUSERASSQLADMIN'
- '/UPDATEENABLED=0'
- '/TCPENABLED=1'
- '/NPENABLED=1'
become: yes
become_flags: logon_type=batch
vars:
ansible_become_method: runas
ansible_become_user: "{{ one_username }}"
ansible_become_pass: "{{ one_userpassword }}"
- name: Install ONE Monitor Server
win_package:
path: "{{ one_source }}Monitor\\VeeamONE.Monitor.Server.x64.msi"
state: present
arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPT_EULA=1 VM_MN_SERVICEACCOUNT={{ one_username }} VM_MN_SERVICEPASSWORD={{ one_userpassword }} VM_MN_SQL_SERVER=localhost\\VEEAMSQL2016 VM_MN_SQL_AUTHENTICATION=1 VM_MN_SQL_USER=sa VM_MN_SQL_PASSWORD={{ sql_sapassword }} VM_BACKUP_ADD_LATER=1 VM_VC_SELECTED_TYPE=2"
- name: Install ONE Reporter Server
win_package:
path: "{{ one_source }}Reporter\\VeeamONE.Reporter.Server.x64.msi"
state: present
arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPT_EULA=1 VM_RP_SERVICEACCOUNT={{ one_username }} VM_RP_SERVICEPASSWORD={{ one_userpassword }} VM_RP_SQL_SERVER=localhost\\VEEAMSQL2016 VM_RP_SQL_AUTHENTICATION=1 VM_RP_SQL_USER=sa VM_RP_SQL_PASSWORD={{ sql_sapassword }} VM_BACKUP_ADD_LATER=1 VM_VC_SELECTED_TYPE=2"
state: present
- name: Pre - Install SQL Native Client
win_package:
path: "{{ one_source }}Redistr\\x64\\sqlncli.msi"
state: present
arguments: "IACCEPTSQLNCLILICENSETERMS=YES"
- name: Pre - Install ReportViewer
win_package:
path: "{{ one_source }}Redistr\\ReportViewer.msi"
state: present
- name: Pre - Install IIS
win_feature:
name: Web-Server
state: present
include_sub_features: yes
include_management_tools: yes
- name: Pre - Install SQL 2016 Express
win_package:
path: "{{ one_source }}Redistr\\x64\\SqlExpress\\2016SP2\\SQLEXPR_x64_ENU.exe"
product_id: SQL 2016 Express
arguments:
- '/q'
- '/ACTION=Install'
- '/IACCEPTSQLSERVERLICENSETERMS'
- '/FEATURES=SQL'
- '/INSTANCENAME=VEEAMSQL2016'
- '/SQLSVCACCOUNT={{ sql_username }}'
- '/SQLSVCPASSWORD={{ sql_userpassword }}'
- '/SECURITYMODE=SQL'
- '/SAPWD={{ sql_sapassword }}'
- '/ADDCURRENTUSERASSQLADMIN'
- '/UPDATEENABLED=0'
- '/TCPENABLED=1'
- '/NPENABLED=1'
become: yes
become_flags: logon_type=batch
vars:
ansible_become_method: runas
ansible_become_user: "{{ one_username }}"
ansible_become_pass: "{{ one_userpassword }}"
- name: Install ONE Monitor Server
win_package:
path: "{{ one_source }}Monitor\\VeeamONE.Monitor.Server.x64.msi"
state: present
arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPT_EULA=1 VM_MN_SERVICEACCOUNT={{ one_username }} VM_MN_SERVICEPASSWORD={{ one_userpassword }} VM_MN_SQL_SERVER=localhost\\VEEAMSQL2016 VM_MN_SQL_AUTHENTICATION=1 VM_MN_SQL_USER=sa VM_MN_SQL_PASSWORD={{ sql_sapassword }} VM_BACKUP_ADD_LATER=1 VM_VC_SELECTED_TYPE=2"
- name: Install ONE Reporter Server
win_package:
path: "{{ one_source }}Reporter\\VeeamONE.Reporter.Server.x64.msi"
state: present
arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPT_EULA=1 VM_RP_SERVICEACCOUNT={{ one_username }} VM_RP_SERVICEPASSWORD={{ one_userpassword }} VM_RP_SQL_SERVER=localhost\\VEEAMSQL2016 VM_RP_SQL_AUTHENTICATION=1 VM_RP_SQL_USER=sa VM_RP_SQL_PASSWORD={{ sql_sapassword }} VM_BACKUP_ADD_LATER=1 VM_VC_SELECTED_TYPE=2"
5.4 Veeam One Playbook 的执行过程
[root@localhost ~]# ansible-playbook ./VeeamOne.yaml --vault-password-file vault_pass.txt
PLAY [Veeam One v10 Setup] *************************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************************
ok: [172.16.60.133]
TASK [Pre - Enable firewall] ***********************************************************************************************************
ok: [172.16.60.133]
TASK [Pre - Configure firewall rule "Reporter Console"] ********************************************************************************
ok: [172.16.60.133]
TASK [Pre - Configure firewall rule "Business View"] ***********************************************************************************
ok: [172.16.60.133]
TASK [Pre - Configure firewall rule "Agent"] *******************************************************************************************
ok: [172.16.60.133]
TASK [Pre - Configure firewall rule "Server SMB"] **************************************************************************************
ok: [172.16.60.133]
TASK [Pre - Create Local Veeam ONE Service User] ***************************************************************************************
ok: [172.16.60.133]
TASK [Pre - Create Local SQL Service User] *********************************************************************************************
ok: [172.16.60.133]
TASK [Pre - Install 2012 System CLR Types] *********************************************************************************************
ok: [172.16.60.133]
TASK [Pre - Install 2012 Shared management objects] ************************************************************************************
ok: [172.16.60.133]
TASK [Pre - Install XML Parser] ********************************************************************************************************
changed: [172.16.60.133]
TASK [Pre - Install SQL Native Client] *************************************************************************************************
ok: [172.16.60.133]
TASK [Pre - Install ReportViewer] ******************************************************************************************************
ok: [172.16.60.133]
TASK [Pre - Install IIS] ***************************************************************************************************************
changed: [172.16.60.133]
TASK [Pre - Install SQL 2016 Express] **************************************************************************************************
changed: [172.16.60.133]
TASK [Install ONE Monitor Server] ******************************************************************************************************
changed: [172.16.60.133]
TASK [Install ONE Reporter Server] *****************************************************************************************************
changed: [172.16.60.133]
TASK [Install ONE Reporter Web UI] *****************************************************************************************************
changed: [172.16.60.133]
TASK [Install ONE Monitor Client] ******************************************************************************************************
changed: [172.16.60.133]
TASK [Install ONE Agent] ***************************************************************************************************************
changed: [172.16.60.133]
PLAY RECAP *****************************************************************************************************************************
172.16.60.133 : ok=20 changed=8 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
5.5 查看 Veeam One Playbook 的执行结果
PS C:\Users\Administrator> Get-Service Veeam*
Status Name DisplayName
------ ---- -----------
Running VeeamDCS Veeam ONE Monitor Server
Running VeeamOneAgentSvc Veeam ONE Agent
Running VeeamRSS Veeam ONE Reporter Server
PS C:\Users\Administrator> Get-Service SQL*
Status Name DisplayName
------ ---- -----------
Stopped SQLAgent$VEEAMS... SQL Server Agent (VEEAMSQL2016)
Running SQLBrowser SQL Server Browser
Running SQLTELEMETRY$VE... SQL Server CEIP service (VEEAMSQL2016)
Running SQLWriter SQL Server VSS Writer
参考书籍与推荐阅读
[1.《Veeam 静默安装 》] (https://helpcenter.veeam.com/docs/backup/vsphere/silent_mode.html?ver=95u4)
https://helpcenter.veeam.com/docs/backup/vsphere/silent_mode.html?ver=95u4
[2.《Ansible 用户手册》] (https://https://docs.ansible.com/ansible/2.5/user_guide/quickstart.html)
https://www.ansible.com/resources/ebooks/mastering-ansible
3.《Mastering Ansible》 by Jesse Keating
https://www.ansible.com/resources/ebooks/mastering-ansible
4.《How To Fix Windows Server 2019 Error 0x800f0950 – Install .NET 3.5》
https://www.gigxp.com/how-to-fix-windows-server-2019-error-0x800f0950-install-net-3-5/>