Fork me on GitHub
Suzf  Blog

Tag Puppet

Puppet erb template

puppet templates follow the erb templating standard.

The puppet documentation contains an example of how to do a simple if statement.

<% if broadcast != "NONE" %>       
    broadcast <%= broadcast %>
<% end %>

To do an if/else statement, simply add <% else %>

<% if @someclass::someparameter != true %>
    bar = 42
<% else %>
    bar = 0
<% end %>

--  for dynamic content use: <%= %>
--  for another content use: <% %>
-- eg: <% if 1>2 %>


The Puppet Language Style Guide

Puppet Language Style Guide: Version 2.0.1Puppet: Version 3.7+

(Note: While the style guide maps to Puppet 3.7, many of its recommendations apply to Puppet 3.0.x and up.)

Puppet 将模块绘制成依赖关系图


Puppet之安装dashboard 成功版

Puppet Dasshboard是由支持Puppet开发的公司Puppetlabs创建的,是Ruby on Rails程序。可以作为一个ENC(外部节点分类器)以及一个报告工具,并且正在逐渐成为一个包含许多Puppet新功能的集成界面,例如审计和资源管 理功能。 Puppet Dashboard是一个Ruby on Rails程序,用于显示Puppet master和agent的相关信息。它允许你查看从一个或多个Puppet master汇总的图形和报告数据。它同时从一个或者多个Puppet master上收集来自于Puppet agent的资产数据(主机的Fact和其他信息)。最后,它能作为一个ENC来配置Puppet节点,并指定这些节点上的类和参数。

Puppet 自定义facter 简述

在使用puppet作为配置管理工具的同时,facter是一个非常有用的系统盘点工具,自定义fact可以让节点增加更多的标签。这个工具可以通过一些预先设定好变量定位一台主机,比如可 以通过变量lsbdistrelease便可以知道当前系统的版本号,通过osfamily便可以知道系统是RedHat还是SLES,还是其它等等。但 是这些预先设定好的变量毕竟有限,在整个自动化运维过程中,由于系统应用的多样性,更多需要通过应用的名称、角色的名称进行标示,这样就需要自定义一些 fact并赋值到每个节点上去,相当于给节点打上标签。

Puppet 之 Nginx 模块编写

搞puppet也有三几天了,一些概念还不是很清晰。很多时候实验未成功,都是概念没有理清楚、文档没有看全。别的就先不说了,先来安装一个nginx 来试一下吧。

FAQ_Puppet: 常见问题 【持续更新中】

Q1:最近测试3.7.1 的版本出现了一个问题:The package type's allow_virtual parameter will be changing its default value from false to true in a future release


[[email protected] ~]# puppet --version

[[email protected] ~]# puppet agent --test --server --noop
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for
Warning: The package type's allow_virtual parameter will be changing its default value from false to true in a future release. If you do not want to allow virtual packages, please explicitly set allow_virtual to false.
(at /usr/lib/ruby/site_ruby/1.8/puppet/type/package.rb:430:in `default')
Info: Applying configuration version '1413249918'

Notice: Finished catalog run in 0.11 seconds


可以在服务器端的 pp文件中的package 中加入 :allow_virtual => false, 来解决出现的警告。




puppet Error 400 on SERVER Permission denied

Error: /Stage[main]/Ssh::Config/File[/etc/ssh/sshd_config]: Could not evaluate: Error 400 on SERVER: Permission denied - /etc/puppet/modules/ssh/files/sshd_config Could not retrieve file metadata for puppet:///modules/ssh/sshd_config: Error 400 on SERVER: Permission denied - /etc/puppet/modules/ssh/files/sshd_config

A2: chmod -R ./ssh/files/*


What causes the error “Could not retrieve catalog from remote server: execution expired” in Puppet

This can be caused when the load on the Puppet Master server is too high to send compiled catalogs to the agents.
Start by checking if any services are using all the available resources, or if the server is under-powered for the requests it is getting. If all agents run at the same time, edit the cron job that controls their run time to spread it out.
If all else fails, allowing the agents to take longer to receive the catalog may work. This can be done by adding the configtimeout setting to the puppet.conf file (/etc/puppet/puppet.conf) and increasing the value. It defaults to "2m", meaning two minutes.


Error: Could not retrieve catalog from remote server: Connection refused - connect(2)
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Error: Could not send report: Connection refused - connect(2)

此错误是没有启动puppet master服务 或是没有绑定主机名/DNS 未得到正确解析

[14:37:04][[email protected] ~]$ cat /etc/hosts | grep 192
#   master01
#    agent01

取消注释 再次执行 问题解决