debian - Vagrant 和 Ansible 的 "skipping: no hosts matched"问题

标签 debian vagrant virtualbox ansible

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

我的剧本文件的头部如下所示:

---
- hosts: webservers
  user: vagrant
  sudo: yes

和我的 /etc/ansible/hosts文件如下所示:
[webservers]
webserver1

我尝试将 IP 地址放在那里,但结果相同。我已将我的 ssh key 添加到服务器并将 webserver1 主机添加到 .ssh/config/etc/hosts .

我可以 ssh vagrant@webserver1由于使用了 ssh key ,因此无需输入密码即可。

我在这里缺少什么?
  • 主机:Debian 7.2
  • 客户端机器:Debian 7
  • 虚拟机:4.1.18
  • Vangrantup:1.4.1
  • Ansible:1.5
  • 最佳答案

    发布您的 Vagrantfile 和 ansible list 文件可能会有所帮助。

  • 您是否使用 vagrant 的默认 ansible 提供程序?
    您是否指定了 inventory_path ?

  • config.vm.provision :ansible 做 |ansible|
    ansible.playbook = "配置/playbook.yml"
    ansible.inventory_path = "配置/ansible_hosts"
    结尾
  • 您是通过 --connection=local 的 Vagrant ssh 启动它吗?尝试/etc/ansible/hosts

  • [网络服务器1]
    127.0.0.1 ansible_connection=本地
  • 你在使用 ansibleLocal provider/vagrant 插件吗?
  • 关于debian - Vagrant 和 Ansible 的 "skipping: no hosts matched"问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20801787/

    相关文章:

    linux - 适用于 Linux 的 Delphi Tokyo : stream file contents to stdout (console output)

    mysql - mysql grant 命令是什么意思?

    ubuntu - pbuilder 没有正确构建

    java - 获取 GDK_BACKEND 与 debian 中的可用显示错误不匹配

    git - 在 vagrant+chef 设置中使用带密码的 ssh key

    linux - Centos kernel-devel 安装后不可用

    windows - 从 vbox 复制/粘贴到 windows

    virtualbox - 如何调整 VirtualBox vmdk 文件的大小

    azure - 如何从 Vagrant azure 插件获取 IP 地址?

    macos - 使用 vagrant 和 virtualbox 在 mac 上安装 Kubernetes