“跳过:没有匹配的主机"Vagrant 和 Ansible 的问题 [英] "skipping: no hosts matched" issue with Vagrant and Ansible
问题描述
我已经安装了 Vagrant、VirtualBox 和 Ansible 并尝试在一台主机上运行配置,但它总是返回跳过:没有匹配的主机"
我的剧本文件的头部如下所示:
---- 主机:网络服务器用户:流浪须藤:是的
和我的 /etc/ansible/hosts
文件看起来像这样:
[网络服务器]网络服务器1
我尝试将 IP 地址放在那里,但结果相同.我已将我的 ssh 密钥添加到服务器,并将 webserver1 主机添加到 .ssh/config
和 /etc/hosts
.
由于使用了 ssh 密钥,我可以 ssh vagrant@webserver1
正常运行而不会提示输入密码.
我在这里遗漏了什么?
- 主机:Debian 7.2
- 客户端机器:Debian 7
- 虚拟盒:4.1.18
- Vangrantup:1.4.1
- Ansible:1.5
它可以帮助发布您的 Vagrantfile 和 ansible 清单文件.
您是否使用 vagrant 的默认 ansible 提供程序?
您是否指定了
inventory_path
?
- 您是否通过带有
--connection=local
的 vagrant ssh 启动它,尝试/etc/ansible/hosts
- 您在使用 ansibleLocal 提供程序/vagrant 插件吗?
I have installed Vagrant, VirtualBox and Ansible and trying to run provision over one host but it always returns "skipping: no hosts matched"
The head of my playbook file looks like this:
---
- hosts: webservers
user: vagrant
sudo: yes
and my /etc/ansible/hosts
file looks like this:
[webservers]
webserver1
I tried putting the IP address there but had the same result. I have added my ssh key to the server and added webserver1 host to both .ssh/config
and /etc/hosts
.
I can ssh vagrant@webserver1
fine without being prompted for a password, thanks to using the ssh key.
What am I missing here?
- Host: Debian 7.2
- Client machine: Debian 7
- Virtualbox: 4.1.18
- Vangrantup: 1.4.1
- Ansible: 1.5
It could help to post your Vagrantfile and your ansible inventory file.
Are you using the default ansible provider of vagrant?
did you specify the
inventory_path
?
config.vm.provision :ansible do |ansible| ansible.playbook = "provisioning/playbook.yml" ansible.inventory_path = "provisioning/ansible_hosts" end
- Are you launching it the through the a vagrant ssh with
--connection=local
try a /etc/ansible/hosts
[webserver1] 127.0.0.1 ansible_connection=local
- Are you using the ansibleLocal provider / vagrant plugin?
这篇关于“跳过:没有匹配的主机"Vagrant 和 Ansible 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!