Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ansible playbook:错误:提供的主机列表为空_Ansible - Fatal编程技术网

ansible playbook:错误:提供的主机列表为空

ansible playbook:错误:提供的主机列表为空,ansible,Ansible,当我运行ansible playbook web\u db.yaml时,我得到 ERROR: provided hosts list is empty 知道为什么吗 一些补充资料: $ ls -l -rw-r--r-- 1 vagrant vagrant 100 Aug 4 14:55 ansible.cfg -rw-rw-r-- 1 vagrant vagrant 222 Oct 20 2016 inventory -rw-rw-r-- 1 vagrant vagrant 531 May

当我运行
ansible playbook web\u db.yaml
时,我得到

ERROR: provided hosts list is empty
知道为什么吗

一些补充资料:

$ ls -l
-rw-r--r-- 1 vagrant vagrant 100 Aug  4 14:55 ansible.cfg
-rw-rw-r-- 1 vagrant vagrant 222 Oct 20  2016 inventory
-rw-rw-r-- 1 vagrant vagrant 531 May  3 11:58 web_db.yaml

$ pwd
/home/vagrant/exercise1/production

$ cat inventory 
web1 ansible_ssh_host=192.168.33.20
[webservers]
web1

$ cat ansible.cfg 
[defaults]

inventory      = /home/vagrant/exercise1/production/inventory
host_key_checking = False

$ ansible --version
ansible 1.5.4

$ cat web_db.yaml 
---
- hosts: webservers
  sudo: yes

就我所记得的,古老的Ansible版本使用参数而不是
库存

试一试

hostfile = /home/vagrant/exercise1/production/inventory

在你的配置中。

你的ansible版本真的很旧…我也有同样的问题。此用户正在学习pluralsight的在线课程。添加hostfile对我很有效,我也在使用Ansible 1.5.4版