# file as parameter with ansible.builtin.script

**URL:** <https://forum.ansible.com/t/file-as-parameter-with-ansible-builtin-script/42933>\
**Category:** Get Help\
**Tags:** module, linux\
**Created:** [May 22, 2025, 3:57pm UTC](https://forum.ansible.com/t/file-as-parameter-with-ansible-builtin-script/42933 "2025-05-22T15:57:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ekynox360](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ekynox360/32/8594_2.png) [@ekynox360](https://forum.ansible.com/u/ekynox360)\
**Post date:** [May 22, 2025, 3:57pm UTC](https://forum.ansible.com/t/file-as-parameter-with-ansible-builtin-script/42933/1 "2025-05-22T15:57:30Z")

</div>

Hi,

I’m trying to use the _ansible.builtin.script_ module.  
My script is using a varfile as parameter :

```YAML
- name: Software unattended installation
      ansible.builtin.script: myscript.x64.sh -q -varfile software_properties_file
      become: true

```

On the remote host, _myscript.x64.sh_ is well copied in _/home/user/.ansible/tmp/_ but not _software\_properties\_file_. So an error rises :

> Could not read file /home/user/.ansible/tmp/ansible-tmp-XXXX/software\_properties\_file

How do you get around this problem?

Thx!

---

<div class="post-metadata">

**Author:** ![Lyle\_McKarns](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/lyle_mckarns/32/8142_2.png) [@Lyle\_McKarns](https://forum.ansible.com/u/Lyle_McKarns)\
**Post date:** [May 22, 2025, 5:20pm UTC](https://forum.ansible.com/t/file-as-parameter-with-ansible-builtin-script/42933/2 "2025-05-22T17:20:45Z")

</div>

One way or another, you’ll need to `software_properties_file` to exist on your target system. If its already there / stays there, you can use a full path to an existing file. If not, you’ll need to copy it (and potentially remove it afterwards) yourself with something like [ansible.builtin.copy](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html)

---

<div class="post-metadata">

**Author:** ![ekynox360](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ekynox360/32/8594_2.png) [@ekynox360](https://forum.ansible.com/u/ekynox360)\
**Post date:** [May 23, 2025, 7:29am UTC](https://forum.ansible.com/t/file-as-parameter-with-ansible-builtin-script/42933/3 "2025-05-23T07:29:50Z")

</div>

Will do it. Thank you!

---

<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 22, 2025, 7:30am UTC](https://forum.ansible.com/t/file-as-parameter-with-ansible-builtin-script/42933/4 "2025-06-22T07:30:43Z")

</div>

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