跳过:没有主机匹配-Ansible- Vagrant

时间:2018-10-05 17:06:16

标签: ansible vagrant

最近开始调查ansible。因此,出于测试目的,我尝试提供一个盒子。我使用的是无聊的虚拟盒子,无法更改我的盒子,但是当我vagrant provision展示时

  

正在跳过:没有主机匹配

我的Vagrantfile

config.vm.define"deploymaster" do |deploymaster|
    deploymaster.vm.hostname = "deploymaster"
    deploymaster.vm.network :private_network, ip: "192.168.33.10"
    deploymaster.vm.network "forwarded_port", guest: 80, host: 6080, id: "http", auto_corect: true
    deploymaster.vm.network "forwarded_port", guest: 443, host: 2201, id: "https"
    deploymaster.vm.provider "virtualbox" do |vb|
      vb.memory = "1024"
    end
    deploymaster.vm.provision :ansible do |ansible|
      ansible.playbook = "../playbooks/inventory-change-callback.yml"
      ansible.inventory_path = "../inventory/ansible/hosts.yml"
      ansible.become = true  
      ansible.verbose = "vvv"
    end

  end

库存hosts.yml文件

deploymaster:
  hosts:
    192.168.33.10:
      hostname: deploymaster

elk:
  hosts:
    192.168.33.12:
      hostname: elk
  vars:
    retention: 30

更新1 更新了清单脚本

deploymaster:
  hosts:
    deploy-master:
      ansible_host: 192.168.33.10

elk:
  hosts:
    elk-node:
      ansible_host: 192.168.33.12

剧本

---
- name: Set inventory path
  hosts: deploymaster
  gather_facts: no
- include: some-play-book.yml

我正在按照herehere的方式将我的库存文件导入到无业游民的文件中,但仍然无法修复它。我在这里缺少什么。

0 个答案:

没有答案