[英]Error scp from local machine to aws ec2 using ansible “command” module
i am using asnible shell module to scp the directory from my local to newly created ec2 instance.我正在使用 asnible shell 模块将目录从我的本地 scp 到新创建的 ec2 实例。 And i am facing below error.我面临以下错误。
===== =====
- name: Installer to cloud instance
shell: /usr/bin/scp -i {key} -r {dir} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no LogLevel=quiet ec2-user@ '{{ ec2.instances[0].public_dns_name }}:'/tmp/
===== =====
Error: "Please login as the user "ec2-user" rather than the user "root\错误:“请以用户“ec2-user”而不是用户“root\”身份登录
From the error it look like the user you are passing is not being used从错误看来,您传递的用户没有被使用
I found a space char right after the ec2-user@
, which might be the problem.我在ec2-user@
之后发现了一个空格字符,这可能是问题所在。
in question有问题
shell: /usr/bin/scp -i {key} -r {dir} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no LogLevel=quiet ec2-user@ '{{ ec2.instances[0].public_dns_name }}:'/tmp/ shell: /usr/bin/scp -i {key} -r {dir} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no LogLevel=quiet ec2-user@ '{{ ec2.instances[0].public_dns_name } }:'/tmp/
try:尝试:
shell: /usr/bin/scp -i {key} -r {dir} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no LogLevel=quiet ec2-user@'{{ ec2.instances[0].public_dns_name }}:'/tmp/ shell: /usr/bin/scp -i {key} -r {dir} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no LogLevel=quiet ec2-user@'{{ ec2.instances[0].public_dns_name } }:'/tmp/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.