mycloudrevolution.veeam
Veeam
该角色提供用于管理 Veeam 备份与复制的 Ansible 模块。
需求
Veeam 模块基于 Veeam PowerShell 命令集(Veeam PowerShell 参考)。所有模块旨在在已安装控制台和 PowerShell Snapin 的 Veeam 备份与复制服务器上执行,不支持远程连接。
角色变量
可设置的变量取决于所使用的具体模块。
依赖关系
无
发布说明
版本 0.1
veeam_connection_facts - 版本 0.3
- 获取 Veeam 服务器连接
- 获取 Veeam 存储库
- 获取 Veeam 服务器
- 获取 Veeam 凭据
veeam_credential - 版本 0.2
- 添加 Windows、Linux 或标准凭据
- 根据 ID 移除凭据
veeam_server - 版本 0.2
- 添加 VMware ESXi 服务器
版本 0.2
- veeam_server - 版本 0.3
- 添加 VMware vCenter 服务器
版本 0.3
- veeam_backup - 版本 0.1
- 根据标签添加 VMware 备份任务
示例剧本
获取 Veeam 信息
- name: 获取所有 VBR 信息
hosts: veeam
gather_facts: no
roles:
- veeam
tasks:
- name: 获取 Veeam 信息
veeam_connection_facts:
register: my_facts
- name: 调试 Veeam 信息
debug:
var: my_facts
添加 Veeam 凭据
- name: 向 VBR 服务器添加新凭据
hosts: veeam
gather_facts: no
roles:
- veeam
vars:
query: "veeam_facts.veeam_credentials[?id=='{{ my_cred.id }}']"
my_password: <虚拟>
tasks:
- name: 添加凭据
veeam_credential:
state: present
type: windows
username: Administrator
password: "{{ my_password }}"
description: 我的虚拟描述
register: my_cred
- name: 调试 Veeam 凭据
debug:
var: my_cred
- name: 获取 Veeam 信息
veeam_connection_facts:
register: my_facts
- name: 调试 Veeam 凭据信息
debug:
var: my_facts | json_query(query)
- name: 移除凭据
veeam_credential:
state: absent
id: "{{ my_cred.id }}"
添加 VMware ESXi 主机到 VBR 服务器
- name: 向 VBR 服务器添加 ESXi 主机
hosts: veeam
gather_facts: no
roles:
- veeam
vars:
root_password: <虚拟>
tasks:
- name: 添加 root 凭据
veeam_credential:
state: present
type: standard
username: root
password: "{{ root_password }}"
description: "独立主机实验用户"
register: root_cred
- name: 调试 root 凭据
debug:
var: root_cred
- name: 添加 ESXi 服务器
veeam_server:
state: present
type: esxi
credential_id: "{{ root_cred.id }}"
name: 192.168.234.101
register: esxi_server
- name: 获取 Veeam 信息
veeam_connection_facts:
register: my_facts
- name: 调试 Veeam 服务器信息
debug:
var: my_facts.veeam_facts.veeam_servers
添加 VMware vCenter 服务器到 VBR 服务器
- name: 向 VBR 服务器添加 vCenter 服务器
hosts: veeam
gather_facts: no
roles:
- veeam
vars:
vcenter_password: <虚拟>
tasks:
- name: 添加 vCenter 凭据
veeam_credential:
state: present
type: standard
username: [email protected]
password: "{{ vcenter_password }}"
description: "vCenter 服务器实验用户"
register: vcenter_cred
- name: 调试 vCenter 凭据
debug:
var: vcenter_cred
- name: 添加 vCenter 服务器
veeam_server:
state: present
type: vcenter
credential_id: "{{ vcenter_cred.id }}"
name: 192.168.234.100
register: vcenter_server
- name: 获取 Veeam 信息
veeam_connection_facts:
register: my_facts
- name: 调试 Veeam 服务器信息
debug:
var: my_facts.veeam_facts.veeam_servers
根据标签添加 VMware 备份任务
- name: 添加新备份任务
hosts: veeam
gather_facts: no
roles:
- veeam
vars:
query: "veeam_facts.veeam_backups[?id=='{{ my_backup.id }}']"
tasks:
- name: 创建备份任务
veeam_backup:
state: present
type: vi
entity: tag
tag: "保护\\\\默认"
name: BackupJob01
repository: "默认备份存储库"
register: my_backup
- name: 获取 Veeam 信息
veeam_connection_facts:
register: my_facts
- name: 调试 Veeam 备份任务信息
debug:
var: my_facts | json_query(query)
许可证
GNU 较小公共许可证 v3.0
作者信息
Markus Kraus @vMarkus_K
MY CLOUD-(R)EVOLUTION mycloudrevolution.com