ansibleguy76 / ansibleforms

A webapplication to create pretty advanced forms to run ansible playbooks or awx templates.
https://ansibleforms.com/
GNU General Public License v3.0
66 stars 10 forks source link

Preserving file names after uploading it through Ansible forms #133

Closed nx2804 closed 8 months ago

nx2804 commented 8 months ago

Hi Team,

Using file field type when i upload a file the name is getting modified. instead i wanted the file name to be preserved

also i wanted to generate a drop down which list all the files in certain directory. Will it be possible to get that using Ansible forms?

Thanks,

nx2804 commented 8 months ago

or any expressions would just do a rename with executing playbook

vcmirko commented 8 months ago

Hi Team,

Using file field type when i upload a file the name is getting modified. instead i wanted the file name to be preserved

also i wanted to generate a drop down which list all the files in certain directory. Will it be possible to get that using Ansible forms?

Thanks,

That's correct, the file is uploaded under a temp filename, but extravars are sent with the original name so that you can move/copy/rename the file in ansible. So you can rename it back to the original name.

vcmirko commented 8 months ago

Hi Team,

Using file field type when i upload a file the name is getting modified. instead i wanted the file name to be preserved

also i wanted to generate a drop down which list all the files in certain directory. Will it be possible to get that using Ansible forms?

Thanks,

Regarding the dropdown, there is a remote expression fn.fnSsh that allows you to ssh to a machine, run a command, and parse the output, you can do an "ls" to get the list of files.

nx2804 commented 8 months ago

But I want this to be done with out using playbook or manual

Any expressions support this for renaming the file immediately after upload

On Wed, 10 Jan 2024 at 2:45 PM, vcmirko @.***> wrote:

Hi Team,

Using file field type when i upload a file the name is getting modified. instead i wanted the file name to be preserved

also i wanted to generate a drop down which list all the files in certain directory. Will it be possible to get that using Ansible forms?

Thanks,

That's correct, the file is uploaded under a temp filename, but extravars are sent with the original name so that you can move/copy/rename the file in ansible. So you can rename it back to the original name.

— Reply to this email directly, view it on GitHub https://github.com/ansibleguy76/ansibleforms/issues/133#issuecomment-1884460179, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCAEUMD6TO5DJHZRU6HGGRLYNZL2PAVCNFSM6AAAAABBUEMZ3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBUGQ3DAMJXHE . You are receiving this because you authored the thread.Message ID: @.***>

nx2804 commented 8 months ago

Where can I find the list of functions available

On Wed, 10 Jan 2024 at 2:46 PM, vcmirko @.***> wrote:

Hi Team,

Using file field type when i upload a file the name is getting modified. instead i wanted the file name to be preserved

also i wanted to generate a drop down which list all the files in certain directory. Will it be possible to get that using Ansible forms?

Thanks,

Regarding the dropdown, there is a remote expression fn.fnSsh that allows you to ssh to a machine, run a command, and parse the output, you can do an "ls" to get the list of files.

— Reply to this email directly, view it on GitHub https://github.com/ansibleguy76/ansibleforms/issues/133#issuecomment-1884462364, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCAEUMD5GQN6XZHR47WJOXTYNZL7NAVCNFSM6AAAAABBUEMZ3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBUGQ3DEMZWGQ . You are receiving this because you authored the thread.Message ID: @.***>

ansibleguy76 commented 8 months ago

https://ansibleforms.com/expressions/#remote-expressions

also consider using discussions for questions so we can keep issues for actual issues.