干货分享 | 利用 Ansiable 自动化部署 Veeam Backup & Replication 9.5U4b
1、Ansiable 介绍
《Mastering Ansible》 by Jesse Keatinghttps://www.ansible.com/resources/ebooks/mastering-ansible
2、前提:Veeam 的静默安装模式
User Guide for VMware vSphere > Deployment > Installing Veeam Backup & Replication in Unattended Mode
[《Veeam 静默安装 》] (https://helpcenter.veeam.com/docs/backup/vsphere/silent_mode.html?ver=95u4)
Veeam Backup Catalog Veeam Backup & Replication Server Veeam Backup & Replication Console Veeam Explorers: Veeam Explorer for Active Directory Veeam Explorer for Exchange Veeam Explorer for Oracle Veeam Explorer for SharePoint Veeam Explorer for Microsoft SQL Veeam Update 4b
3、Ansiable 自动化部署环境准备
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
[root@localhost ~]#
yum install -y epel-release yum update -y yum install -y ansible git vim htop
yum install -y python-pip
pip install --upgrade pip # optional
pip install pywinrm
配置 Inventory 文件,定义 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
3.2 执行对象--Windows 服务器的部署
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.
3.3 WinRM 及 帐户身份验证模式
Ansible 从1.7之后的版本支持 Windows 服务的管理,管理机仍然需要一台 Linux 服务器,通信方式为 PowerShell,为了与 Windows 通信管理机还需要安装 WinRm 模块,方可和远程 Windows 主机正常通信。
WinRM使用帐户身份验证时,可以使用几种不同的选项,在这里我选择了 NTLM + Ansiable 加密模块 的方式作为 WinRM 帐户身份验证。
4、连通性测试,win-ping
ansible 有一个非常好的工具win-ping,专门用来测试与Windows的Host定义是不是可以联通。详情可以参照,Asiable的手册。
[root@localhost ~]# ansible VBR -m win_ping --vault-password-file vault_pass.txt
172.16.60.133 | SUCCESS => {
"changed": false,
"ping": "pong"
}
5、编写 Asible Playbook 进行自动化编排
- name: VBR Community Edition Setup
hosts: VBR
gather_facts: yes
vars:
vbr_source: "D:\\"
sql_username: "svc_sql"
sql_userpassword: !vault|
$ANSIBLE_VAULT;1.1;AES256
sql_sapassword: !vault |
$ANSIBLE_VAULT;1.1;AES256
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
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 2016 Express
win_package:
path: "{{ vbr_source }}Redistr\\x64\\SqlExpress\\2016SP1\\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'
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
- name: Install VBR Update 4b
win_package:
path: "{{ vbr_source }}Updates\\veeam_backup_9.5.4.2866.update4b_setup.exe"
product_id: VBR Update 4b
arguments: "/silent /noreboot VBR_AUTO_UPGRADE=1"
tags: update
6、执行 Asible 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
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
参考书籍与推荐阅读
1.《Veeam 静默安装 》https://helpcenter.veeam.com/docs/backup/vsphere/silent_mode.html?ver=95u4
2.《Ansible 用户手册》https://www.ansible.com/resources/ebooks/mastering-ansible
3.《Mastering Ansible》 by Jesse Keatinghttps://www.ansible.com/resources/ebooks/mastering-ansible
Veeam在全球云数据管理领域位居前列。Veeam Availability Platform是最完备的备份解决方案,可以帮助客户成功完成智能数据管理的5个阶段。我们在全球拥有35万家客户,其中包括82%的财富500强企业和66%的全球2,000强企业。我们拥有业界最高的客户满意度评分,是行业平均水平的3.5倍。我们的全球生态系统包括61,000家渠道伙伴;独家经销商思科、慧与(HPE)、联想和NetApp;以及21,000家云和服务提供商。Veeam总部位于瑞士巴尔,在30多个国家设有办事处。
解决方案:
用例
改造备份
业务连续性和灾难恢复
远程办公室/分支机构
云解决方案
多云数据保护
云备份和 DRaaS
云数据保留
云移动性
公有云和 SaaS 数据保护
业务类型和行业
医疗
基础架构
备份设备
融合基础架构
主存储
行业解决方案:
HPE + Veeam
Cisco + Veeam
NetApp + Veeam
Dell EMC + Veeam
ExaGrid + Veeam
Pure Storage + Veeam
Quantum + Veeam
Nutanix + Veeam
IBM + Veeam
联想 + Veeam
所有产品:
企业
Veeam Availability Suite 、Veeam Backup & Replication、Veeam Agent for Microsoft Windows、Veeam Agent for Linux、Veeam Availability for Nutanix AHV、Veeam Agent for IBM AIX 和 Veeam Agent for Oracle Solaris、Veeam Availability Orchestrator、Veeam Backup for Microsoft Office 365、适用于 VMware vSphere 和 Microsoft Hyper-V 的 Veeam ONE 、Veeam Cloud Connect for the Enterprise;
中小型企业
Veeam Agent for Microsoft Windows、Veeam Agent for Linux、Veeam Backup for Microsoft Office 365;
服务提供商
Veeam Availability Console、Veeam Endpoint Backup for ConnectWise、Veeam Backup & Replication Plug-in for ConnectWise;
免费工具
Veeam Backup & Replication 社区版、Veeam Agent for Microsoft Windows 免费版、Veeam Agent for Linux 免费版、Veeam Availability Console、Veeam Backup for Microsoft Office 365 社区版 、Veeam PN for Microsoft Azure 、Veeam ONE 社区版、Veeam Management Pack for Veeam Backup、Veeam Task Manager for Hyper-V、Veeam FastSCP for Microsoft Azure 、Veeam Report Library for System Center、Veeam Stencils for Microsoft Visio;
云合作伙伴:
Amazon Web Services
IBM Cloud
托管云提供商
Microsoft Cloud
社区专家:
Veeam vExperts
Veeam MVP
Veeam Vanguards
用例
改造备份
业务连续性和灾难恢复
远程办公室/分支机构
云解决方案
多云数据保护
云备份和 DRaaS
云数据保留
云移动性
公有云和 SaaS 数据保护
业务类型和行业
医疗
基础架构
备份设备
融合基础架构
主存储
行业解决方案:
HPE + Veeam
Cisco + Veeam
NetApp + Veeam
Dell EMC + Veeam
ExaGrid + Veeam
Pure Storage + Veeam
Quantum + Veeam
Nutanix + Veeam
IBM + Veeam
联想 + Veeam
所有产品:
企业
Veeam Availability Suite 、Veeam Backup & Replication、Veeam Agent for Microsoft Windows、Veeam Agent for Linux、Veeam Availability for Nutanix AHV、Veeam Agent for IBM AIX 和 Veeam Agent for Oracle Solaris、Veeam Availability Orchestrator、Veeam Backup for Microsoft Office 365、适用于 VMware vSphere 和 Microsoft Hyper-V 的 Veeam ONE 、Veeam Cloud Connect for the Enterprise;
中小型企业
Veeam Agent for Microsoft Windows、Veeam Agent for Linux、Veeam Backup for Microsoft Office 365;
服务提供商
Veeam Availability Console、Veeam Endpoint Backup for ConnectWise、Veeam Backup & Replication Plug-in for ConnectWise;
免费工具
Veeam Backup & Replication 社区版、Veeam Agent for Microsoft Windows 免费版、Veeam Agent for Linux 免费版、Veeam Availability Console、Veeam Backup for Microsoft Office 365 社区版 、Veeam PN for Microsoft Azure 、Veeam ONE 社区版、Veeam Management Pack for Veeam Backup、Veeam Task Manager for Hyper-V、Veeam FastSCP for Microsoft Azure 、Veeam Report Library for System Center、Veeam Stencils for Microsoft Visio;
云合作伙伴:
Amazon Web Services
IBM Cloud
托管云提供商
Microsoft Cloud
社区专家:
Veeam vExperts
Veeam MVP
Veeam Vanguards
成都科汇科技有限公司 --- 专业数据备份服务商
无论您的IT架构是 本地化、云端、还是混和云 都能提供一站式数据备份方案。
Veeam 线下代理技术咨询服务
四川成都Veeam解决方案中心
四川成都Veeam体验中心
四川成都Veeam技术服务中心
成都科汇科技有限公司
地址:成都市人民南路四段1号时代数码大厦18F
电话:400-028-1235
QQ: 2231749852
手机:138 8074 7621(微信同号)
无论您的IT架构是 本地化、云端、还是混和云 都能提供一站式数据备份方案。
Veeam 线下代理技术咨询服务
四川成都Veeam解决方案中心
四川成都Veeam体验中心
四川成都Veeam技术服务中心
成都科汇科技有限公司
地址:成都市人民南路四段1号时代数码大厦18F
电话:400-028-1235
QQ: 2231749852
手机:138 8074 7621(微信同号)