VeeamHub / veeam-ansible

Sample code for deploying and configuring various Veeam solutions using Ansible.
GNU Lesser General Public License v3.0
47 stars 19 forks source link

Unhandled exception which may be related to having no backups scheduled? #27

Open rnickle opened 2 years ago

rnickle commented 2 years ago

Is your feature request related to a problem? Please describe.

Pertinent code:

- name: Stopping all Veeam Backup Jobs (Only if VBR installed on same server as EM)
  ansible.windows.win_shell: |
    if (-Not (Get-Module -ListAvailable -Name Veeam.Backup.PowerShell)){Add-PSSnapin -PassThru VeeamPSSnapIn -ErrorAction Stop | Out-Null}
    Get-VBRJob | Stop-VBRJob | Out-Null
  # when: software.installed | bool

Pertinent error:

"stderr_lines": [
        "Get-VBRJob : Execution environment cannot be initialized to Remote",
        "At line:2 char:1",
        "+ Get-VBRJob | Stop-VBRJob | Out-Null",
        "+ ~~~~~~~~~~",
        "    + CategoryInfo          : NotSpecified: (:) [], Exception",
        "    + FullyQualifiedErrorId : System.Exception"
    ],

Describe the solution you'd like I am not 100% sure if the root cause of this is not having backups enabled, but that's my suspicion.

Describe alternatives you've considered Make this step optional by creating a parameter to enable or disable it in the group vars.

Additional context For the time being I added a 'when: false' directive to disable this feature.

carceneaux commented 2 years ago

Did you stop Veeam services prior running the Ansible playbook? This would cause this command to fail.

That said, thanks for identifying this as this command failing shouldn't halt the upgrade process. I'll update it accordingly.

rnickle commented 2 years ago

Thank you! I believe I did stop the services, but I have a test bench I can verify on.