file as parameter with ansible.builtin.script

Hi,

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

- 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!

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

1 Like

Will do it. Thank you!