veeamhub.veeam.veeam_vbr_rest_jobs_manage (2.2.1) — module

Manage Veeam Backup & Replication Jobs.

| "added in version" 1.0.0 of veeamhub.veeam"

Authors: Markus Kraus (@vMarkusK)

preview | supported by community

Install collection

Install with ansible-galaxy collection install veeamhub.veeam:==2.2.1


Add to requirements.yml

  collections:
    - name: veeamhub.veeam
      version: 2.2.1

Description

Manage Veeam Backup & Replication Jobs.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: End-to-End Create Veeam Job
  hosts: localhost
  gather_facts: false
  vars:
    repo_name: '<Repository Name>'
  tasks:
    - name: Get VBR Repos
      veeamhub.veeam.veeam_vbr_rest_repositories_info:
        server_name: "<VBR Host>"
        server_username: "<VBR User>"
        server_password: "<VBR Password>"
      register: repo_testout
    - name: Debug VBR Repos Result
      ansible.builtin.debug:
        var: repo_testout
    - name: Filter Repo Object
      ansible.builtin.set_fact:
        repo_id: "{{ repo_testout | json_query(repos_id_query) }}"
      vars:
        repos_id_query: "infrastructure_repositories.data[?name==`{{ repo_name }}`].id"
    - name: Create VBR Job
      veeamhub.veeam.veeam_vbr_rest_jobs_manage:
        server_name: "<VBR Host>"
        server_username: "<VBR User>"
        server_password: "<VBR Password>"
        state: present
        jobName: "Ansible Test"
        hostName: "<vCenter Hostname>"
        name: "<VM Name>"
        objectId: "<VM MoRef ID>"
        type: "VirtualMachine"
        description: "Created by Ansible RestAPI Module"
        backupRepositoryId: "{{ repo_id[0] }}"
      register: create_job
    - name: Debug VBR Jobs Result
      ansible.builtin.debug:
        var: create_job
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: End-to-End Delete Veeam Job
  hosts: localhost
  gather_facts: false
  vars:
    job_name: "Ansible Test"
  tasks:
    - name: Get VBR Jobs
      veeamhub.veeam.veeam_vbr_rest_jobs_info:
        server_name: "<VBR Host>"
        server_username: "<VBR User>"
        server_password: "<VBR Password>"
      register: job_testout
    - name: Debug VBR Jobs Result
      ansible.builtin.debug:
        var: job_testout
    - name: Filter Job Object
      ansible.builtin.set_fact:
        job_id: "{{ job_testout | json_query(jobs_id_query) }}"
      vars:
        jobs_id_query: "infrastructure_jobs.data[?name==`{{ job_name }}`].id"
    - name: Delete VBR Job
      veeamhub.veeam.veeam_vbr_rest_jobs_manage:
        server_name: "<VBR Host>"
        server_username: "<VBR User>"
        server_password: "<VBR Password>"
        state: absent
        id: "{{ job_id[0] }}"
      register: delete_job
    - name: Debug VBR Jobs Result
      ansible.builtin.debug:
        var: delete_job

Inputs

    
server_name:
    description: VBR Server Name or IP
    required: true
    type: str

server_port:
    default: 9419
    description: VBR RestAPI Sever Port
    required: false
    type: str

validate_certs:
    default: false
    description: Validate SSL certs.
    required: false
    type: bool

server_password:
    description: VBR Server password
    required: true
    type: str

server_username:
    description: VBR Server Username
    required: true
    type: str