“跳过:没有匹配的主机"流浪汉和Ansible的问题 [英] "skipping: no hosts matched" issue with Vagrant and Ansible

查看:262
本文介绍了“跳过:没有匹配的主机"流浪汉和Ansible的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了Vagrant,VirtualBox和Ansible,并尝试在一台主机上运行资源调配,但它总是返回跳过:没有匹配的主机"

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

和我的/etc/ansible/hosts文件如下所示:

[webservers]
webserver1

我尝试将IP地址放在此处,但结果相同.我已将ssh密钥添加到服务器,并将webserver1主机添加到.ssh/config/etc/hosts.

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.

由于使用ssh键,我可以ssh vagrant@webserver1罚款而不会被提示输入密码.

I can ssh vagrant@webserver1 fine without being prompted for a password, thanks to using the ssh key.

我在这里想念什么?

  • 主机:Debian 7.2
  • 客户端计算机:Debian 7
  • Virtualbox:4.1.18
  • Vangrantup:1.4.1
  • Ansible:1.5

推荐答案

这可能有助于发布您的Vagrantfile和您的ansible库存文件.

It could help to post your Vagrantfile and your ansible inventory file.

  • 您是否正在使用默认的无业游民提供者?

  • Are you using the default ansible provider of vagrant?

您指定了inventory_path吗?


 config.vm.provision :ansible do |ansible|
   ansible.playbook = "provisioning/playbook.yml"
   ansible.inventory_path = "provisioning/ansible_hosts"
 end

  • 您要通过带有--connection=local的无聊的ssh启动它吗,请尝试/etc/ansible/hosts
    • 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
      

      • 您是否正在使用ansibleLocal提供程序/vagrant插件?
      • 这篇关于“跳过:没有匹配的主机"流浪汉和Ansible的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆