简体   繁体   English

使用 ansible“命令”模块从本地机器到 aws ec2 的错误 scp

[英]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.

相关问题 在本地机器上从 ubuntu (AWS EC2) 读取文件? - reading in a file from ubuntu (AWS EC2) on local machine? 从本地机器将 Python 连接到 AWS EC2 上的 kafka - Connect Python to kafka on AWS EC2 from local machine python:如何从EC2实例在本地计算机上运行命令 - python: How to run command on local machine from an EC2 instance 如何在 AWS EC2 上运行 Python 代码并将 csv 文件从服务器写入我的本地计算机? - How to run a Python code on AWS EC2 and write a csv file from the server to my local machine? 尝试使用 Ansible 停止 AWS EC2 实例时,boto3 出错 - boto3 gives error when trying to stop an AWS EC2 instance using Ansible 如何使用 AWS Lambda 函数将文件从 AWS S3 存储桶复制到 EC2 linux 机器 - How to copy files from AWS S3 bucket to EC2 linux machine using AWS Lambda Functions 如何修复从命令行导入的AWS EC2 Linux中的``没有名为cv2的模块'' - How to fix 'No module named cv2' in AWS EC2 Linux, imports from Command Line Ansible EC2 Region eu-central-1似乎不适用于AWS模块boto.ec2 - Ansible EC2 Region eu-central-1does not seem to be available for aws module boto.ec2 在 EC2 实例 (AWS) 上使用 Bash 脚本导入错误加载模块 - Import Error Loading Module using Bash Script on EC2 Instance (AWS) 从 AWS Lambda 在 AWS EC2 中调用 Flask 端点时出错 - Error calling Flask endpoint in AWS EC2 from AWS Lambda
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM