For an ansible playbook to copy over a file on a target Junos machine, I need the raw module and sftp/scp to use.
The target machine (Junos) doesn't have python, so I have only raw module on the ansible side to run commands. And I've been trying sftp/scp both require the password to be entered on the prompt, but not getting it working using raw module.
If the copy command could be done in a single line, that'd work too, but the target machine doesn't have sshpass too. So, I'd hope to get any workaround so password can be provided on the prompt from raw module of ansible playbook.
This is from the Junos, sftp works fine after providing password on prompt.
root@:~ # sftp <username>@host:/file/location/file destFile
<username>@host's password:
And the playbook has the same command for raw but, can't handle the prompt for password even using multiple commands setting for raw using (;/&&).
- name: "Copy config file on Junos"
# raw: sftp <username>@host:/file/location/file destFile && <password>
# raw: sftp <username>@host:/file/location/file destFile;<password>
raw: sftp <username>@host:/file/location/file destFile
register: disp
- name: "Print disp"
debug:
var: disp
In short, how can I manipulate using the raw module of ansible to allow providing the password on the prompt?