最近开始调查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