标签: puppetmaster

Puppet: Conditional file source based on naming convention

I'm getting the ball rolling on puppet for my environment - and I'd like to have a conditional file resource based on whether or not the module itself contains a file based on a naming convention.

So visually, assume a module named 'mysql' and it's layout:

mysql/
    /files
        /etc/
            my.cnf
            my.hostname1.cnf
            my.hostname2.cnf
     /manifests
            init.pp
...
Run Code Online (Sandbox Code Playgroud)

因此,我希望该块以伪术语验证模块的资源是否存在,并相应地采取行动:

file { '/etc/my.cnf':

  if -f 'puppet:///mysql/etc/my.$hostname.cnf' {
      source => 'puppet:///mysql/etc/my.$hostname.cnf'
  }
  else {
      source => 'puppet:///mysql/etc/my.cnf'
  }
}
Run Code Online (Sandbox Code Playgroud)

这样一来,人们就不必管理 csv 文件或.pp带有特定于主机的 case …

puppet puppetmaster

3
推荐指数
1
解决办法
519
查看次数

如何维护多节点的site.pp?

我将所有节点保存在一个文件 site.pp 中 - 但是随着我添加越来越多的节点,维护它们变得非常困难。

导入指令看起来很有前途,但据我了解文档,每次发生变化时都必须重新启动 puppermaster。对我来说这是不可接受的。

有没有其他方法可以做到这一点?而不是使用大注释来分隔节点/组。现在我只使用 rdoc。

我会很高兴有任何建议:-)

我当前的 puppet 目录结构如下所示:

  • 清单/site.pp
  • manifests/extdata/(用于 extlookup)
  • 模块/模块 1
  • 模块/模块 2
  • 文件/公钥...

我使用 git/rsync 部署 puppet 配置以仅覆盖更改的文件。

linux puppet puppetmaster

3
推荐指数
2
解决办法
9684
查看次数

puppet 将两行作为一行插入到配置文件中

我创建了下一个 Puppet 清单文件:

node 'puppetmaster' {
    package { "screen": ensure => "installed"}
    $enhancers = [ "pixman","pixman-devel","libXfont","tigervnc-server" ]
    package { $enhancers: ensure => "installed" }
    file { '/etc/skel/.vimrc':
    content => ":set nu\n :set incsearch\n :set ignorecase\n :set smartcase\n:set ts=2",}
    file { '/root/.vimrc':
    content => ":set nu\nset incsearch\n:set ignorecase\n:set smartcase\n:set ts=2",}
    file { '/etc/sysconfig/vncserver':
    content => 'VNCSERVERS="6:root"\nVNCSERVERARGS[6]="-geometry 1152x864"',}
 }
Run Code Online (Sandbox Code Playgroud)

应用清单后,我检查/etc/sysconfig/vncserver它看起来像这样:

VNCSERVERS=6:root\nVNCSERVERARGS[6]="-geometry 1152x864"
Run Code Online (Sandbox Code Playgroud)

而不是像这样分成两行:

VNCSERVERS=6:root
VNCSERVERARGS[6]="-geometry 1152x864"
Run Code Online (Sandbox Code Playgroud)

我在设置/etc/skel/.vimrc文件时使用了相同的格式,它就像一个魅力,所以我不明白为什么它在尝试设置时不起作用/etc/sysconfig/vncserver,我相信它与双引号有关""。任何帮助,将不胜感激!

linux vnc puppet centos6 puppetmaster

3
推荐指数
1
解决办法
220
查看次数

Centos 5 - 使用官方仓库升级手动安装的 Puppet 服务器

我有 Puppet 服务器版本 2.6.4,它是直接使用 RPM 包手动安装的(而不是使用 Yum 从存储库中获取包)。

现在我想通过使用 Puppet Labs 存储库和 Yum 安装它,尽可能安全地将它升级到最新版本 (3.6)。

如果出现问题,我该如何回滚更改?升级前我应该如何备份当前设置?

centos puppet centos5 puppetmaster

3
推荐指数
1
解决办法
183
查看次数

如何在 Puppet Manifest 中使用变量?

我在 Centos 7.2 上使用 WSUS 模块和 Puppet Master。我的 Puppet 代理服务器运行的是 Windows Server 2012。

我想使用带有变量的清单。但是,当 Puppet Agent 服务器运行 puppet 代理时,它会显示“错误 400,语法错误”。我尝试重新编写清单和我能想到的每一个变化。我不断收到一些错误。

以下是清单的一个示例:

class excellent {
    class { 'wsus_client':
       $cool = 'Saturday'
    server_url => 'http://acme.com',
    auto_update_option  => 'Scheduled'
    scheduled_install_day => $cool,
    scheduled_install_hour => 1,
}
}
Run Code Online (Sandbox Code Playgroud)

我试过在大括号 {} 中分配变量。我尝试使用 $LOAD_PATH、--custom-dir 和 FACTERLIB。但我无法弄清楚如何使用这三个中的任何一个。

我想在一个地方更改变量并在其父类的范围内使用它。我该怎么办?

wsus environment-variables puppet puppetmaster centos7

3
推荐指数
1
解决办法
6288
查看次数

防火墙后面的傀儡大师

我正在尝试在公司防火墙外的某些服务器上运行 puppet,而 puppetmaster 则在防火墙内。说服公司 IT 为我打开端口 8140 将是极其困难的——如果不是不可能的话——那么我有什么选择来让它工作?

puppet puppetmaster

2
推荐指数
1
解决办法
8930
查看次数

Puppet 客户端未连接到主服务器 - SSL 连接错误

我在同一台机器上安装了 puppet master 和 agent。当客户端启动时,我收到以下错误消息。

puppet agent --server=agent.com --no-daemonize --debug



err: Could not retrieve catalog from remote server: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed.  This is often because the time is out of sync on the server or client
Run Code Online (Sandbox Code Playgroud)

linux puppet ssl-certificate puppetmaster

2
推荐指数
1
解决办法
3141
查看次数

Puppet 服务器主机名与证书不匹配 - 无法进行身份验证。如何禁用傀儡身份验证?

我在让 puppet 代理对 master 进行身份验证时遇到问题。

在代理上,我首先做了 sudo puppet agent --test

info: Creating a new SSL key for m-agent-2
info: Caching certificate for ca
info: Creating a new SSL certificate request for m-agent-2
info: Certificate Request fingerprint (md5): 43:30:57:53:5B:20:F7:12:CD:94:59:17:12:28:68:A4
Run Code Online (Sandbox Code Playgroud)

然后在主人sudo puppet cert list身上我做了并得到了

"m-agent-2" (43:30:57:53:5B:20:F7:12:CD:94:59:17:12:28:68:A4)
Run Code Online (Sandbox Code Playgroud)

然后我做了sudo puppet cert sign m-agent-2,它返回了

notice: Signed certificate request for m-agent-2
notice: Removing file Puppet::SSL::CertificateRequest m-agent-2 at                 
'/var/lib/puppet/ssl/ca/requests/m-agent-2.pem'
Run Code Online (Sandbox Code Playgroud)

然后我做了sudo puppet agent --test,它返回了

info: Caching certificate for m-agent-2
err: Could not …
Run Code Online (Sandbox Code Playgroud)

ssl authentication puppet puppetmaster

2
推荐指数
1
解决办法
2万
查看次数

Puppet 将节点从 master 分配给环境?

我正在学习使用 Puppet,并已成功设置并连接了具有 2 个节点的主服务器。

production我已经为正在运行的默认环境创建了文件。我的环境文件夹中还有第二组配置beta

我想通过主服务器将 2 个节点中的 1 个分配给测试组。我该怎么做呢?

傀儡版本4

puppet puppetmaster

2
推荐指数
1
解决办法
5271
查看次数

Puppet Windows Agent 无法连接 - 证书验证失败:无法获取 /CN=Puppet 的颁发者证书

我已经安装了puppet服务器和代理,在sudo /opt/puppetlabs/bin/puppetserver ca sign --certname mywindowshost服务器上接受初始代理请求。

我可以看到证书放置在下面并存在于服务器根 ca 和代理的证书中:

C:\Windows\system32>puppet agent --configprint localcacert 
C:/ProgramData/PuppetLabs/puppet/etc/ssl/certs/ca.pem
Run Code Online (Sandbox Code Playgroud)

但是,在代理上运行以下命令来测试它,我得到以下结果:

C:\Windows\system32>puppet agent --test
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: SSL_connect returned=1 errno=0 state=error: certificate verify failed: [unable to get issuer certificate for /CN=Puppet CA: puppet.mydomain.com]
Info: Retrieving pluginfacts
Error: /File[C:/ProgramData/PuppetLabs/puppet/cache/facts.d]: Failed to generate additional resources using 'eval_generate': SSL_connect returned=1 errno=0 state=error: certificate verify failed: [unable to get issuer certificate for /CN=Puppet CA: puppet.mydomain.com]
Error: /File[C:/ProgramData/PuppetLabs/puppet/cache/facts.d]: …
Run Code Online (Sandbox Code Playgroud)

openssl puppet puppetmaster puppet-agent

1
推荐指数
1
解决办法
4954
查看次数