Transfer file witch ansible.builtin.expect


I try to automate the installation of OpnSense to a proxmox cluster. The inital configuration of OpnSense does not match my network configuration and therefore I only have a virtual serial terminal for configuring (until SSH is available).
Beside a few commands I need to transfer the initial configuration file with the correct network and ssh setup.
Currently I create a python script thats modify the config.xml of OpnSense, but this looks a little bit messy:

    - name: Apply initial configuration settings
      delegate_to: pve1
        command: "qm terminal {{ proxmox_id }}"
        timeout: 5
        echo: true
          'starting serial terminal on interface serial0': ''
            - 'cat <<EOF >'
            - 'python3'
            - '/usr/local/etc/rc.reload_all' # Apply configuration
            - "\x0F"  # = CTRL-O
            - import xml.etree.ElementTree as ET
            - import xml, uuid
            - conf_file = '/conf/config.xml'
           # ... much more lines

Any idea, how to transfer a local existing config file via the expect module?

Thanks a lot for your help!

done. Solved it with a virtual USB Stick for file transfer.