# Transfer file witch ansible.builtin.expect

**URL:** <https://forum.ansible.com/t/transfer-file-witch-ansible-builtin-expect/4942>\
**Category:** Get Help\
**Created:** [April 14, 2024, 1:58pm UTC](https://forum.ansible.com/t/transfer-file-witch-ansible-builtin-expect/4942 "2024-04-14T13:58:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DengelFred](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@DengelFred](https://forum.ansible.com/u/DengelFred)\
**Post date:** [April 14, 2024, 1:58pm UTC](https://forum.ansible.com/t/transfer-file-witch-ansible-builtin-expect/4942/1 "2024-04-14T13:58:17Z")

</div>

Hello,

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:

```auto
    - name: Apply initial configuration settings
      delegate_to: pve1
      ansible.builtin.expect:
        command: "qm terminal {{ proxmox_id }}"
        timeout: 5
        echo: true
        responses:
          'starting serial terminal on interface serial0': ''
          'root@OPNsense:':
            - 'cat <<EOF > test.py'
            - 'python3 test.py'
            - '/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!

---

<div class="post-metadata">

**Author:** ![DengelFred](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@DengelFred](https://forum.ansible.com/u/DengelFred)\
**Post date:** [May 8, 2024, 7:48pm UTC](https://forum.ansible.com/t/transfer-file-witch-ansible-builtin-expect/4942/2 "2024-05-08T19:48:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [June 7, 2024, 7:48pm UTC](https://forum.ansible.com/t/transfer-file-witch-ansible-builtin-expect/4942/3 "2024-06-07T19:48:28Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
