使用 Vagrant 配置 puppetlabs/apache 模块的问题

Issue configuring puppetlabs/apache module with Vagrant

我最近开始使用 Vagrant 和 Puppet,但我很难让 puppet 工作。

我想使用 puppet 将 apache 用户和组更改为 vagrant 以解决共享文件夹时的权限问题。

我想使用以下人偶配置来完成

class { "apache":
    user => "vagrant",
    group => "vagrant",
}

参考:http://ryansechrest.com/2014/04/unable-set-permissions-within-shared-folder-using-vagrant-virtualbox/

为此,我在主机和来宾计算机上安装了 puppet,在主机上,我在 Vagrantfile 中添加了以下 cofig

config.vm.provision :puppet do |puppet|
    puppet.manifests_path = 'puppet/manifests'
    puppet.module_path    = 'puppet/modules'
end

并在主机上创建文件 puppet/manifests/default.pp,内容如下

node 'node1' {

    include apache

    class { "apache":
        user => "vagrant",
        group => "vagrant",
    }
}

当我运行 vagrant provision时,我得到以下错误

==> default: Error: Could not find default node or by name with 'localhost' on node localhost
==> default: Error: Could not find default node or by name with 'localhost' on node localhost
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

我哪里错了?

保持简单:

For this i installed puppet on my host and guest machine,

你只需要在你的来宾机器上安装puppet,你就可以保持你的主机干净

你引用定义puppet/manifests/default.pp没问题,去掉节点部分

Package {
  allow_virtual => true,
}

class { "apache":
    user => "vagrant",
    group => "vagrant",
}

include apache

你能确认你有一个 apache 模块在你的主机 puppet/modules 上或安装在来宾上 - 你可以提供 运行 类似

的东西
#!/bin/bash

mkdir -p /etc/puppet/modules;

if [ ! -d /etc/puppet/modules/puppetlabs-apache ]; then
  puppet module install puppetlabs-apache
fi

假设您谈论的是 this apache 模块,否则如果它来自 forge

,请替换为您正在使用的模块