Skip to content

Commit

Permalink
add scp "-O" option for file transfer
Browse files Browse the repository at this point in the history
Signed-off-by: MarkAckert <[email protected]>
  • Loading branch information
MarkAckert committed Jan 17, 2025
1 parent e81b5ad commit 457b1fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion playbooks/roles/common/templates/scp.with-key.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ FILE_LOCAL=$1
FILE_REMOTE=$2

echo "SCP $FILE_LOCAL ==> $FILE_REMOTE"
scp -oHostKeyAlgorithms=+ssh-rsa -P {{ hostvars[inventory_hostname].ansible_port | default('22') }} -i {{ hostvars[inventory_hostname].ansible_ssh_private_key_file }} $FILE_LOCAL {{ hostvars[inventory_hostname].ansible_user }}@{{ hostvars[inventory_hostname].ansible_ssh_host }}:$FILE_REMOTE
scp -O -oHostKeyAlgorithms=+ssh-rsa -P {{ hostvars[inventory_hostname].ansible_port | default('22') }} -i {{ hostvars[inventory_hostname].ansible_ssh_private_key_file }} $FILE_LOCAL {{ hostvars[inventory_hostname].ansible_user }}@{{ hostvars[inventory_hostname].ansible_ssh_host }}:$FILE_REMOTE
2 changes: 1 addition & 1 deletion playbooks/roles/common/templates/scp.with-pwd.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ FILE_LOCAL=$1
FILE_REMOTE=$2

echo "SCP $FILE_LOCAL ==> $FILE_REMOTE"
sshpass -p "{{ hostvars[inventory_hostname].ansible_password }}" scp -oHostKeyAlgorithms=+ssh-rsa -P {{ hostvars[inventory_hostname].ansible_port | default('22') }} $FILE_LOCAL {{ hostvars[inventory_hostname].ansible_user }}@{{ hostvars[inventory_hostname].ansible_ssh_host }}:$FILE_REMOTE
sshpass -p "{{ hostvars[inventory_hostname].ansible_password }}" scp -O -oHostKeyAlgorithms=+ssh-rsa -P {{ hostvars[inventory_hostname].ansible_port | default('22') }} $FILE_LOCAL {{ hostvars[inventory_hostname].ansible_user }}@{{ hostvars[inventory_hostname].ansible_ssh_host }}:$FILE_REMOTE

0 comments on commit 457b1fa

Please sign in to comment.