“skipping: no hosts matched” issue with Vagrant and Ansible

前端 未结 9 1151

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 f

9条回答
  •  北海茫月
    2021-02-05 03:13

    I think you can also do this without a hosts file, by assigning the Ansible groups in your Vagrant file.

    If you don't have multiple machines in your Vagrant file your box will probably be called "default" and you will be able to add multiple Ansible groups with the following code.

    Code:

    config.vm.provision "ansible" do |ansible|
        ansible.groups = {
            "webservers" => ["default"],
            "dev_enviroment" => ["default"]
        }
    
        ansible.playbook = "provisioning/playbook.yml"
    end
    

提交回复
热议问题