小编MAN*_*NTA的帖子

Ansible:无法将/ etc / ansible / hosts解析为清单资源

我是新手ansible,遇到了以下问题。我可以ssh进入客户端计算机。但是无法运行剧本。

得到以下错误:

[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source

 [WARNING]: No inventory was parsed, only implicit localhost is available

 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit
localhost does not match 'all'

 [WARNING]: Could not match supplied host pattern, ignoring: a
Run Code Online (Sandbox Code Playgroud)

这是我的群组名称。我的主机如下:

---------


[a]
172.31.26.93



[all:vars]

ansible_user=vagrant
ansible_ssh_pass=vagrant


 ansible_ssh_host=172.31.26.93
 ansible_ssh_port=22
 ansible_ssh_user='ansibleuser'
 ansible_ssh_private_key_file=/home/ansibleuser/.ssh
Run Code Online (Sandbox Code Playgroud)

-------我的剧本文件如下-

- hosts: a
  tasks:
  - name: create a directory
    file: path=/home/ansiblesuser/www state=directory
Run Code Online (Sandbox Code Playgroud)

这是我第一次遇到此问题。

error-handling ssh ansible

4
推荐指数
3
解决办法
1万
查看次数

标签 统计

ansible ×1

error-handling ×1

ssh ×1