fabiendupont / ims.premigration-windows

IMS - Premigration Role - Windows
Apache License 2.0
1 stars 4 forks source link

Integration with forklift / MTV tool for virtual machine migrations as Hooks #2

Open jsakil14 opened 1 month ago

jsakil14 commented 1 month ago

Hello , I came across your repo which is supporting my requirement of capturing the n/w & disk config of windows vms before migration & applying the same post migration - in my case from vmware to openshift / kubevirt clusters and running it as a hook in terms of forklift operator. Would you be able to help me to integrate this scripts into the below page:

https://github.com/kubev2v/forklift/blob/main/docs/hooks.md

https://www.imghippo.com/i/gkEz61721194794.png

jsakil14 commented 1 month ago
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
[WARNING]: Collection ansible.windows does not support Ansible version
2.12.5.post0
PLAY [Pre-migration tasks] *****************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [Copy PowerShell script file] *********************************************
fatal: [localhost]: FAILED! => {"changed": false, "checksum": "36df118a11c01420ac0edf2c7954f0e4162cc307", "dest": "C:\\Windows\\Temp\\", "module_stderr": "/bin/sh: powershell: command not found\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "operation": "file_copy", "original_basename": "pre-migrate.ps1", "rc": 127, "size": 13232, "src": "files/pre-migrate.ps1"}
PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
jsakil14 commented 1 month ago

@fabiendupont

---
- name: Pre-migration tasks
  hosts: localhost
  gather_facts: no

  tasks:
    - name: Copy PowerShell script file
      ansible.windows.win_copy:
        src: "files/pre-migrate.ps1"
        dest: 'C:\\Windows\\Temp\\'

    - name: Run PowerShell command
      ansible.windows.win_command:
        cmdline: 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Bypass -File C:\\Windows\\Temp\\pre-migrate.ps1'
jsakil14 commented 1 month ago

Is it possible to create a Dockerfile with which I can build an image out of this script which I can inturn run as a prehook in MTV by openshift for windows vms?