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

时间:2016-04-07 19:21:21

标签: vagrant puppet

我最近开始使用Vagrant和Puppet,我很难让傀儡上班。

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

我想通过使用以下puppet配置

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

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

对于我在主机和客户机上安装的木偶,在主机上我在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.

我哪里错了?

1 个答案:

答案 0 :(得分:1)

保持简单:

  

对于我在我的主机和客户机上安装的木偶,

您只需要在客人机器上安装木偶,就可以保持主机清洁

你引用并定义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模块,否则替换为您使用的模块(如果它来自伪造