Ansible为何无法在本地执行ping操作?

huangapple go评论67阅读模式
英文:

Why ansible is not able to ping for locally?

问题

问题:

我有一个EC2实例,其IP地址是"52.15.160.250"。我在其中安装了Ansible。在主机清单文件[/etc/ansible/hosts]中,我使用了以下配置:

[localhost]

52.15.160.250

然后,我尝试对本地主机执行ping操作:

ansible -m ping all

或者

ansible -m ping 52.15.160.250

但我得到了以下错误:

错误图片链接

英文:

Without writing ansible-playbook Why ansible is not able to ping locally ?

Problem:-

I have taken 1 ec2 instance and the IP of ec2 is "52.15.160.250". I installed ansible in it. Inside the inventory file [/etc/ansible/hosts] i have taken

> [localhost]
>
> 52.15.160.250

Then visudo description

I tried to ping local host

> ansible -m ping all

or

> ansible -m ping 52.15.160.250

I am getting the following error

error

答案1

得分: 1

尝试添加如下:

[localhost]

52.15.160.250 ansible_connection=local

这样,它不会尝试通过SSH连接,而会使用本地连接。

英文:

try adding like this:

[localhost]

52.15.160.250 ansible_connection=local

this way, it would not attempt over ssh rather it would go by local connection.

huangapple
  • 本文由 发表于 2020年1月4日 01:29:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/59582830.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定