Yaml 让Ansible示例(jboss单机版)与Vagrant一起工作
我需要一些帮助,让/jboss standalone与Vagrant一起工作。我想我也犯了同样的错误,我的流浪配置 我的档案在这里:Yaml 让Ansible示例(jboss单机版)与Vagrant一起工作,yaml,ansible,inventory,Yaml,Ansible,Inventory,我需要一些帮助,让/jboss standalone与Vagrant一起工作。我想我也犯了同样的错误,我的流浪配置 我的档案在这里: VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "chef/centos-6.6" config.vm.network "forwarded_port", guest: 80, host: 8080
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/centos-6.6"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.hostname = "webserver1"
config.vm.provision :ansible do |ansible|
ansible.playbook = "site.yml"
ansible.verbose = "vvvv"
ansible.inventory_path = "/Users/miledavenport/vagrant-ansible/jboss-standalone/hosts"
end
end
# Generated by Vagrant
default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222
[jboss-servers]
webserver1
[webserver1]
127.0.0.1 ansible_connection=local
[localhost]
127.0.0.1
我的主机文件在这里:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/centos-6.6"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.hostname = "webserver1"
config.vm.provision :ansible do |ansible|
ansible.playbook = "site.yml"
ansible.verbose = "vvvv"
ansible.inventory_path = "/Users/miledavenport/vagrant-ansible/jboss-standalone/hosts"
end
end
# Generated by Vagrant
default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222
[jboss-servers]
webserver1
[webserver1]
127.0.0.1 ansible_connection=local
[localhost]
127.0.0.1
我对使用ansible相当陌生,想通过使用Vagrant来“玩”ansible
“vagrant up”产生以下错误:
TASK: [jboss-standalone | Install Java 1.7 and some basic dependencies] *******
FATAL: no hosts matched or all hosts have already failed -- aborting
“流浪ssh”工作正常
site.yml是:
---
# This playbook deploys a simple standalone JBoss server.
- hosts: jboss-servers
user: root
roles:
- jboss-standalone
我不明白为什么会出现错误:
致命:没有匹配的主机
主机包含webserver1,它与文件主机名相同
有人能帮我解决这个错误吗
谢谢:)
Miles.也许您的目的是创建一个名为jboss服务器的父组,以及一个名为webserver1的子组 尝试将
[jboss服务器]
更改为[jboss服务器:子项]
这将使组jboss服务器也包含127.0.0.1作为其主机,并且您的playbook应该运行
目前,由于webserver1没有与之关联的KVP
ansible\u ssh\u host=
,因此它只是一个没有ip连接的主机名。只有当您的/etc/hosts文件或其他文件中没有将webserver1映射到某个IP时,才将其作为jboss服务器的子组:)1。希望你的站点中的缩进是正确的。yml,你发布的缩进是错误的。2.您的代码似乎没有其他问题。您确定ansible palybook使用您发布的资源清册(主机)文件吗?您可以使用ansible playbook-h
进行检查。或者使用-i
显式传递清单文件。3.您的清单文件没有意义webserver1
既是主机又是主机组。但只要DNS解析webserver1
,它就应该仍然有效。