Veeam ONE unattended installation with Ansible

My new hobby project, Veeam ONE unattended installation with Ansible, was pretty interesting for me because of two reasons. First of all, I’ve never taken a closer look at Veeam ONE and I wanted to use the opportunity to rewrite my old playbook for the Veeam Backup & Replication unattended installation as Ansible Role. Many thanks to Michael Cade, who inspired me for this nice project.

Ansible Roles are a great framework to ship a predefined set of variables, tasks, files, templates, and modules. The tasks and modules within the Ansible Role can be used by other Playbooks. An Example for complete modules inside a role is my Ansible Veeam PowerShell Module. This blog post will show how Roles can be used to define sequences of tasks for a specific use case.

Red Hat has created a platform called Ansible Galaxy to share and maintain Ansible Roles. The Role I have created, for example, can be installed with one simple command:

ansible-galaxy install mycloudrevolution.veeam_setup

The tasks inside the Role can now be used in your own playbooks or easily modified for other use cases.

Veeam ONE installation with Ansible

The great documentation for the Veeam ONE unattended installation and the lessons I already have learned during my prior project made it easy for me to create the required tasks.

As you can see in the above list, all tasks are based on Ansible standard modules. No additional Ansible modules or custom scripts are required.

Playbook for the Veeam ONE installation

The playbook uses the veeam_setup Role to process the Veeam ONE unattended installation with Ansible. Some of the Roles default parameters are overwritten by variables in the playbook (check the default file for all available variables).

- name: Veeem ONE Free Edition Setup
  hosts: veeam
  gather_facts: no
  vars:
    vbr_setup: false
    vbr_update: false
    one_setup: true
    one_update: true
  roles:
    - veeam_setup
Veeam ONE unattended installation with Ansible - playbook run

The Ansible Role is executing the “typical deployment scenario”, which means an installation on a single server for small- to medium-scale deployments. A local Microsoft SQL Express 2016 is used as the database backend.

Veeam ONE unattended installation with Ansible - Monitor
Veeam ONE unattended installation with Ansible - Reporter

The configurations for virtual environments and backup servers skipped during the Veeam ONE unattended installation with Ansible. The optional configuration of these components might be a useful enhancement of the Role.

Role for the unattended installation

The Ansible Role contains a few tasks and the defaults file for the variables. The tasks cover setup and update of Veeam ONE 9.5 Update 4a and Veeam Backup & Replication 9.5 Update 4b.

|   CONTRIBUTING.md
|   LICENSE
|   PULL_REQUEST_TEMPLATE.md
|   README.md
|
+---defaults
|       main.yml
|
+---files
+---handlers
|       main.yml
|
+---meta
|       main.yml
|
+---tasks
|       main.yml
|       one_setup.yml
|       one_update.yml
|       vbr_setup.yml
|       vbr_update.yml
|
+---templates
+---tests
|       inventory
|       test.yml
|
\---vars
        main.yml
---
# defaults file for veeam_setup

## Choose Setup
vbr_setup: false
vbr_update: false
one_setup: false

## VBR Parameters
one_source: "E:\\"
one_username: "svc_one"
one_userpassword: "ChangeM3!"
one_update_file: "VeeamONE_9.5.4.4587_Update#4a.exe"
one_update_id: "Veeam ONE Update 4a"
vbr_source: "D:\\"
vbr_update_file: "veeam_backup_9.5.4.2866.update4b_setup.exe"
vbr_update_id: "Veeam VBR Update 4b"
sql_username: "svc_sql"
sql_userpassword: "ChangeM3!"
sql_sapassword: "ChangeM3!"
---
# tasks file for veeam_setup
- include_tasks: vbr_setup.yml
  when: vbr_setup| bool

- include_tasks: vbr_update.yml
  when: vbr_update| bool

- include_tasks: one_setup.yml
  when: one_setup| bool

- include_tasks: one_update.yml
  when: one_update| bool
---
# one_setup tasks file for veeam_setup
- name: Pre - Disable firewall for Domain, Public and Private profiles
  win_firewall:
    state: disabled
    profiles:
    - Domain
    - Private
    - Public
- 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: SQL - Install SQL 2016 Express
  win_package:
    path: "{{ one_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'
- name: Install ONE Monitor Server 
  win_package:
    path: "{{ one_source }}Monitor\\VeeamONE.Monitor.Server.x64.msi"
    state: present
    # Veean Documentation wrong, VM_VC_SELECTED_TYPE=2 is not default!
    arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPTEULA=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
    # Veean Documentation wrong, VM_VC_SELECTED_TYPE=2 is not default!
    arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPTEULA=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: Install ONE Reporter Web UI  
  win_package:
    path: "{{ one_source }}Reporter\\VeeamONE.Reporter.WebUI.x64.msi"
    state: present
    arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPTEULA=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 }}"
- name: Install ONE Monitor Client
  win_package:
    path: "{{ one_source }}Monitor\\VeeamONE.Monitor.Client.x64.msi"
    state: present
    arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPTEULA=1"
- name: Install ONE Agent 
  win_package:
    path: "{{ one_source }}Agent\\VeeamONE.Agent.x64.msi"
    state: present
    arguments: "ACCEPT_THIRDPARTY_LICENSES=1 ACCEPTEULA=1 VO_AGENT_TYPE=1 VO_BUNDLE_INSTALLATION=1 VO_AGENT_SERVICE_ACCOUNT_NAME={{ one_username }} VO_AGENT_SERVICE_ACCOUNT_PASSWORD={{ one_userpassword }}"
# one_update tasks file for veeam_setup
- name: Install ONE Update
  win_package:
    path: "{{ one_source }}Updates\\{{ one_update_file }}"
    product_id: "{{ one_update_id }}"
    arguments: "/silent /noreboot VM_ONE_SERVICEPASSWORD={{ one_userpassword }}"
---
# vbr_setup tasks file for veeam_setup
- name: Pre - Install 2012 System CLR Types
  win_package:
    path: "{{ vbr_source }}Redistr\\x64\\SQLSysClrTypes.msi"
    state: present
- name: Pre - Install 2012 Shared management objects
  win_package:
    path: "{{ vbr_source }}Redistr\\x64\\SharedManagementObjects.msi"
    state: present
- name: SQL - Create Local SQL User
  win_user:
    name: "{{ sql_username }}"
    password: "{{ sql_userpassword }}"
    password_never_expires: yes
    state: present
    groups:
        - Users
- 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'
- name: Install VBR Catalog
  win_package:
    path: "{{ vbr_source }}Catalog\\VeeamBackupCatalog64.msi"
    state: present
    arguments:
        - 'VBRC_SERVICE_ACCOUNT_TYPE=1'
        - 'ACCEPT_THIRDPARTY_LICENSES=1'
- 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"
- name: Install VBR Console
  win_package:
    path: "{{ vbr_source }}Backup\\Shell.x64.msi"
    state: present
    arguments:
        - 'ACCEPTEULA=YES'
        - 'ACCEPT_THIRDPARTY_LICENSES=1'
- name: Install VBR Explorer for ActiveDirectory
  win_package:
    path: "{{ vbr_source }}Explorers\\VeeamExplorerForActiveDirectory.msi"
    state: present
    arguments:
        - 'ACCEPT_EULA=1'
        - 'ACCEPT_THIRDPARTY_LICENSES=1'
- name: Install VBR Explorer for Exchange
  win_package:
    path: "{{ vbr_source }}Explorers\\VeeamExplorerForExchange.msi"
    state: present
    arguments:
        - 'ACCEPT_EULA=1'
        - 'ACCEPT_THIRDPARTY_LICENSES=1'
- name: Install VBR Explorer for Oracle
  win_package:
    path: "{{ vbr_source }}Explorers\\VeeamExplorerForOracle.msi"
    state: present
    arguments:
        - 'ACCEPT_EULA=1'
        - 'ACCEPT_THIRDPARTY_LICENSES=1'
- name: Install VBR Explorer for SharePoint
  win_package:
    path: "{{ vbr_source }}Explorers\\VeeamExplorerForSharePoint.msi"
    state: present
    arguments:
        - 'ACCEPT_EULA=1'
        - 'ACCEPT_THIRDPARTY_LICENSES=1'
- name: Install VBR Explorer for SQL
  win_package:
    path: "{{ vbr_source }}Explorers\\VeeamExplorerForSQL.msi"
    state: present
    arguments:
        - 'ACCEPT_EULA=1'
        - 'ACCEPT_THIRDPARTY_LICENSES=1'
# vbr_update tasks file for veeam_setup
- name: Install VBR Update
  win_package:
    path: "{{ vbr_source }}Updates\\{{ vbr_update_file }}"
    product_id: "{{ vbr_update_id }}"
    arguments: "/silent /noreboot VBR_AUTO_UPGRADE=1"

The update process for both products was split up into a dedicated task to achieve more flexibility. Not all Veeam releases need an update, update package names change more often than the major release and an “update only” run is possible with this task design.

Contribution

Feel free to contribute to the project by opening an issue, creating a pull request, leaving a comment for this blog post or rating the Veeam Setup Role on the Galaxy. All feedback and input is welcome!

Leave a Reply