kubev2v / forklift

Apache License 2.0
28 stars 26 forks source link

Support for Hooks for windows VMs #956

Open jsakil14 opened 1 month ago

jsakil14 commented 1 month ago

Hello anyone has success with using pre / post hooks for windows vms? I am looking to capture network config and disk layout part of pre hook and run a condition check for nw and disks in post hook and apply them if they are not correct. Is this possible using ansible ? since I see only requirement is to have ssh enabled , for sake of windows I got winrm enabled. I am trying to achieve this by below:

postHooks:
  - name: Bring all disks online
    type: Ansible
    image: quay.io/konveyor/hook-runner
    playbook: |
      ---
      - name: Bring all disks online
        hosts: all
        tasks:
          - name: Bring disks online
            win_shell: |
              $disks = Get-Disk | Where-Object IsOffline -eq $true
              foreach ($disk in $disks) {
                Set-Disk -Number $disk.Number -IsOffline $false
                Set-Disk -Number $disk.Number -IsReadOnly $false
              }
            become: yes
ahadas commented 1 month ago

I didn't try, but I'd recommend to look at this example which is supposedly working as a pre-migration hook for Windows guests

jsakil14 commented 1 month ago

@ahadas Thanks - if I understand correctly , in the hooks section - can we create a custom docker image with hook runner and ansible scripts added and leave the dialog box empty?