在我更新节点的清单之后;puppetmaster 是否自动将配置发送到节点?如果它这样做,间隔是多少,我该如何改变它?我在哪里可以找到更多关于这方面的信息?
我假设它是runintervalpuppet.conf 的?默认设置为 1800 秒;但是,自从 puppetmaster 启动以来,我还没有注意到任何配置更改。
我对 Puppet 很陌生。我只是写了一段代码来通过 puppet 安装软件
node 'myweb.com' {
include ntp
include apache
apache::vhost { 'myweb.com':
port =>8080,
docroot => '/var/www/myweb.com',
ssl => false,
priority => 10,
serveraliases => 'myweb.com',
}
Run Code Online (Sandbox Code Playgroud)
应用上述代码后,我是否应该将其删除,以免下次重复安装?
任何建议将不胜感激
我是木偶新手。因此,我正在尝试以最佳方式来设置有意义的清单。遵循 DRY(不要重复自己)原则,我尝试在一个模板中加载通用指令,然后从与环境匹配的文件中加载特定于环境的指令。基本上是这样的:
# nodes.pp
node base_dev {
$service_env = 'dev'
}
node 'service1.ownij.lan' inherits base_dev {
include global_env_specific
}
class global_env_specific {
include shell::bash
}
# modules/shell/bash.pp
class shell::bash inherits shell {
notify{"Service env: ${service_env}": }
file { '/etc/profile.d/custom_test.sh':
content => template('_global/prefix.erb', 'shell/bash/global.erb', 'shell/bash/$service_env.erb'),
mode => 644
}
}
Run Code Online (Sandbox Code Playgroud)
但是每次我运行puppet agent --testpuppet 时都会抱怨它找不到该shell/bash/$service_env.erb文件,但我仔细检查了它是否存在。由于输出预期值的通知语句,我知道 var 是可访问的,所以我怀疑我正在做的事情是不允许的。
我知道我可以有一个单一的template.erb并将变量传递给模板,这在这种情况下会起作用,因为 custom.sh 文件很小而且跨环境没有太多变化,但是对于更复杂的配置(httpd、solr 等)我会更喜欢访问特定于环境的文件。我也知道我可以指定特定于环境的模块路径,但我更愿意只在模板级别处理这种行为,而不是拥有多个密切命名的目录。
谢谢。
所以几周前,我开始使用 puppet 来自动化所有配置/服务。当时我正在使用 EPEL 存储库,它安装了 2.6.x 版。经过一些阅读后,我试图flatten通过 puppet stdlib访问可用的方法,并认为它在较新的 2.7.x 版本中默认可用。所以我添加了一个具有以下设置的 puppet repo:
[puppetlabs]
name=Puppet Labs Packages
baseurl=http://yum.puppetlabs.com/el/$releasever/products/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
Run Code Online (Sandbox Code Playgroud)
问题是它安装了 v3.0.x 而不是 2.7.x。显然 3.0.x 是几周前才发布的重大升级。显然,我更愿意在接下来的几个月中使用 2.7.x,而 PuppetLabs 会修复在主要版本之后不可避免地出现的任何缺陷。
所以我的问题是,我可以在 puppet repo 配置中添加什么设置以仅下拉 2.7.x 分支而不是 3.0.x 分支?
我想通过 puppet 将一些配置文件推送到我的所有服务器。所有服务器的文件几乎相同,但有一个变化 - 主机名。
我已经用清单和临时配置文件在 puppet 中创建了模块。我包括所有节点。一切都很好。
我的问题是:如何通过更改该文件中的一/两行将该文件推送到所有服务器。但我不想在模块中为所有人设置配置文件。我想使用一个文件,并在两行推送更改期间使用。
谢谢你的帮助。
最好的事物,
拉法尔
我在 Puppet 仪表板中看到许多消息,说发生了变化,将组的所有权从“用户”更改为“用户”。它似乎与存在两次的“用户”组有关,一次在本地组 ID 为 100,一次在组 ID 为 3000。
[root@tst-01 ~]# puppet agent --test
info: Caching catalog for tst-01.tst.domain.tld
info: Applying configuration version '1370937308'
notice: /File[/var/opt/dolphin]/group: group changed 'users' to 'users'
notice: Finished catalog run in 3.41 seconds
[root@tst-01 ~]#
[root@puppetmaster ~]# cat init.pp
class dolphin {
file { "/var/opt/dolphin":
ensure => "directory",
owner => "dolphin",
group => "users",
mode => 755,
}
}
[root@puppetmaster ~]#
[root@tst-01 audit]# grep -A2 dolphin-own audit.log
type=SYSCALL msg=audit(1370894388.610:49571): arch=c000003e syscall=94 success=yes exit=0 a0=4e96770 a1=ffffffff …Run Code Online (Sandbox Code Playgroud) 我正在运行 puppet 并且它运行正常,但是在没有任何更改的情况下同步需要大约 15 分钟,在我看来,这应该不会超过一两分钟。以下是一些统计数据:
我尝试过使用和不使用 Apache 隧道/WEBrick/passenger,结果相同。
有哪些诊断和改进同步时间的策略?
更新:就我而言,除了使用该--evaltrace选项的选定答案外,我使用strace并发现 TCP 连接超时并且我的防火墙正在限制速率。(为什么 puppet 没有报告超时以及为什么它没有重用连接,我不知道。)
我致力于在 vagrant 管理的虚拟机上配置 CQ5。配置是使用 puppet 完成的。我对人偶清单文件中类/资源的执行顺序有疑问。
请在下面找到清单文件 cqsite.pp
include java
include apache
cq::instance {myauthor:
installation_type => author,
}
cq::instance {mypublish:
installation_type => publish,
}
Run Code Online (Sandbox Code Playgroud)
在供应期间,puppet 最初选择 cq 资源(cq::instance)而不是 java。但是必须先安装 java 才能执行 cq::instance.pp 文件中的几个命令。所以它抛出一个错误。请帮我找到解决方案
我有一个新安装的 Puppet 服务器,只配置了一个模块和一个托管客户端。
这是一个 MOTD 模块,看起来像这样:
class motd {
file { "/etc/custom_motd.sh":
path => '/etc/custom_motd.sh',
ensure => present,
owner => "root",
group => "root",
mode => "775",
content => template('motd/custom_motd.sh.erb'),
#require => Class['nagios_client'],
}
# file_line { 'enable motd':
# ensure => present,
# line => '/etc/custom_motd.sh',
# path => '/etc/profile',
# require => File['/etc/custom_motd.sh']
# }
}
Run Code Online (Sandbox Code Playgroud)
当我puppet agent -t在客户端上运行时,我得到了正确的结果:
[root@pnd01 ~]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for pnd01.company.com
Info: …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用文件资源复制文件。我的代码如下:
node 'Node-002' {
file { "/root/helloworld.txt":
ensure => file,
owner => "root",
group => "root",
mode => "0644",
source => "puppet://modules/templates/${fqdn}/hosts.erb",
}
}
Run Code Online (Sandbox Code Playgroud)
但它因以下错误而失败
Error: /Stage[main]/Main/Node[Node-002]/File[/root/helloworld.txt]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/templates/Node-002.example.com/hosts.erb
Run Code Online (Sandbox Code Playgroud)
模板位置如下:
ls -l /apps/wps/puppetlabs/code/environments/production/modules/templates/Node-002.example.com/hosts.erb
-rw-r--r-- 1 puppet puppet 462 Jul 20 02:13 /apps/wps/puppetlabs/code/environments/production/modules/templates/Node-002.wiley.com/hosts.erb
Run Code Online (Sandbox Code Playgroud)
即使我在source参数中给出完整路径,它也会因相同的错误而失败。
我正在使用木偶 4.5.4
请建议
我最近安装了一个 puppetmaster,我试图用嵌套资源配置一个 puppet 类。例如。
class base {
user { 'testuser':
name => 'test',
ensure => present,
comment => 'Test User',
expiry => '2014-06-30',
gid => '100',
groups => 'wheel',
password_max_age => "60",
managehome => true,
shell => "/bin/bash",
password => '*password*',
exec {
"usermod -p '${password}' ${user}":
onlyif => "egrep -q '^${user}:[*!]' /etc/shadow",
require => User[$user],
},
}
}
Run Code Online (Sandbox Code Playgroud)
问题是我不断收到语法错误:
[root@puppetclient ~]# puppet agent -t \\
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on …Run Code Online (Sandbox Code Playgroud) puppet ×11
puppetmaster ×11
centos ×2
puppet-agent ×2
performance ×1
redhat ×1
rhel6 ×1
yum ×1