Uploaded image for project: 'Migration Toolkit for Virtualization'
  1. Migration Toolkit for Virtualization
  2. MTV-1590

[DOC] Improve API-based hooks for MTV migration plans

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Normal Normal
    • 2.8.0
    • None
    • Documentation
    • None
    • 8
    • False
    • None
    • False
    • Sprint 16-MMSDOCS 2024, Sprint 17-MMSDOCS 2024, Sprint 18-MMSDOCS 2024, Sprint 19-MMSDOCS 2024, Sprint 20-MMSDOCS 2024, Sprint 1-MMSDOCS 2025, Sprint 2-MMSDOCS 2025, Sprint 3-MMSDOCS 2025, Sprint 4-MMSDOCS 2025

      See - https://redhat-internal.slack.com/archives/C014ZTV21L2/p1728993469443739?thread_ts=1728666417.246609&cid=C014ZTV21L2

       

      We have to improve this section - https://docs.redhat.com/en/documentation/migration_toolkit_for_virtualization/2.7/html-single/installing_and_using_the_migration_toolkit_for_virtualization/index#about-api-hooks-in-migration-plans_mtv

       

      Our documentation on this is really quite bad, especially if we want to encourage users to create a hook in the Console. The Console doesn't even have a way to specify a serviceAccount, which appears to be a mandatory field (at least, I couldn't get it to work using the default image and the default SA of forklift-controller). 

       

      - name: Main
        hosts: localhost
        tasks:
        - name: Load Plan
          include_vars:
            file: plan.yml
            name: plan

        - name: Load Workload
          include_vars:
            file: workload.yml
            name: workload

        - name: 
          getent:
            database: passwd
            key: "{{ ansible_user_id }}"
            split: ':'

        - k8s_info:
            api_version: v1
            kind: Secret
            name: privkey
            namespace: openshift-mtv
          register: ssh_credentials

        - debug: 
            var: ssh_credentials

        - name: Ensure SSH directory exists
          file:
            path: ~/.ssh
            state: directory
            mode: 0750
          environment:
            HOME: "{{ ansible_facts.getent_passwd[ansible_user_id][4] }}"

        - name: Create SSH key
          copy:
            dest: ~/.ssh/id_rsa
            content: "{{ ssh_credentials.resources[0].data.key | b64decode }}"
            mode: 0600

        - add_host:
            name: "{{ workload.vm.ipaddress }}"
            ansible_user: root
            groups: vms

        - name: Create Test File
          copy:
            dest: ~/test.txt
            content: "Hello World"
            mode: 0644
          delegate_to: "{{ workload.vm.ipaddress }}"

              richard.hoch Richard Hoch
              rhn-support-anarnold A Arnold
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: