Articles of 木偶

如何合并puppet数组variables

鉴于下面的木偶清单,我怎样才能合并/连接两个数组,使命令将执行与a=b和b=c ? Cron{ environment => ["a=b"] } class a{ cron{'test': command => "/usr/bin/true", user => "francois", environment => ["b=c"], } } include a 我的crontab项目就这样结束了: # Puppet Name: test b=c * * * * * /usr/bin/true

为什么这个puppet节点定义不能在它匹配的主机名上运行?

我在Debian Squeeze系统上运行puppet 2.7.9。 我瞄准的那个盒子被命名为“傀儡” # hostname puppet # facter | grep hostname hostname => puppet # cat /etc/hosts | head -n2 127.0.0.1 localhost 127.0.1.1 puppet.example.com puppet 我的节点定义如下所示: node puppet { include base, puppet } 尽pipe节点文档断言 节点名称可以是简短的主机名或完全限定的域名(FQDN)。 上面的节点定义只会在我用短主机名replaceFQDN或使用正则expression式匹配时触发,如:“/^puppet..*/”。 使用简短的主机名称定义: # puppet agent -vt info: Caching catalog for puppet.example.com info: Applying configuration version '1327898040' notice: Finished catalog […]

在类中包装定义的types – puppet

我的users.pp class users::add { define add_user ( $name, $comment, $home, $shell, $uid, $gid, $password) { # Create the user. This is where most of the magic happens. user { "$name": name => "$name", ensure => present, comment => "$comment", home => "$home", shell => "$shell", uid => "$uid", password => "$password", gid => "$gid" } […]

试图定义全局类variables的木偶

我试图用puppet作为unix用户pipe理。 以下是我创build的用于添加新用户的类: class unix_accounts( $username, $forename, $name, $email, $uid) { user { $username: comment => '$forename $name', home => '/home/$username', shell => '/bin/bash', uid => $uid, groups => [$username, 'sudo'], } 我想,基本上可以从$ name和$ forename中推导出电子邮件和用户名,以便在unix_accounts类中定义这些variables。 我试过这个: $username = $forename[0].chr.downcase+name.downcase $email = $forename.downcase+'.'+$name.downcase+'@localnet.lan' 但是客户端的puppetdtesting在第一个点(。)出现以下消息: Error 400 on server: Syntax error at '.'; expected '}' at …. 这与ruby没有任何关系,因为我之前用irb试过了,似乎只和puppet语法有关。 […]

Hiera +木偶类

我试图找出Puppet(3.0)以及它与内置Hiera的关系。 所以这就是我尝试的一个非常简单的例子(当我设法让简单的一个工作的时候,我会做一个更复杂的层次): # /etc/puppet/hiera.yaml :backends: – yaml :hierarchy: – common :yaml: :datadir: /etc/puppet/hieradata # /etc/puppet/hieradata/common.yaml test::param: value # /etc/puppet/modules/test/manifests/init.pp class test ($param) { notice($param) } # /etc/puppet/manifests/site.pp include test 如果我直接应用它,那很好: $ puppet apply /etc/puppet/manifests/site.pp Scope(Class[Test]): value 如果我经过木偶大师,这不是很好: $ puppet agent –test Could not retrieve catalog from remote server: Error 400 on SERVER: Must pass param […]

使用库存设置多个木偶大师

我成功地设立了多名木偶大师,担任一名木偶大师作为CA,客户可以从这台CA服务器获得证书,但是使用他们指定的木偶大师来获得他们的舱单。 看到这个问题的更多信息.. 多个木偶大师 。 但是,有一些事情我不得不做正确的工作,并有一个错误,我会得到。 首先,为了让连接到指定的木偶大师(PM)的傀儡客户端(PC)工作,我必须将PM1上的CA证书复制到PM2 ca目录中。 我运行这个命令: scp [email protected]:/var/lib/puppet/ssl/ca/ca_cr*.pem [email protected]:/var/lib/puppet/ssl/ca/. 一旦我这样做了,我可以取消注释我的rack.conf VH文件的SSLCertificateChainFile, SSLCACertificateFile & SSLCARevocationFile部分在PM2上。 一旦我完成了这个工作,库存就开始工作了。 这听起来是一种可以接受的做事方式吗? 其次,在puppet.conf文件中,我为客户端设置了指定的PM服务器,例如server = puppet-master2.test.net 。 除非有更好的方法,否则这将在我的生产环境中起作用。 所以PC1会和PM1通话,PC2会跟PM2通话。 这是我有一个错误。 当PC2首先从PM1上的CA请求证书时,证书出现,然后我在PM1上的CA上签署证书。 当我做一个木偶代理 – 在PC2上testing(在puppet.conf中有server = puppet-master2.test.net),我得到这个错误: Warning: Unable to fetch my node definition, but the agent run will continue: Warning: Error 403 on SERVER: Forbidden request: puppet-master2.test.net(10.1.1.161) access to /certificate_revocation_list/ca […]

testing清单时Puppet错误

前缀:我搜查了这个,但事实上,有任何事情可以导致这个问题,我一直无法find解决这个特定的情况。 我有一个木偶大师(3.0.2-1; RHEL6)和/etc/puppet/manifests/site.pp文件包含以下内容: import 'nodes/nodes.pp' $puppetserver = 'puppet.example.dom' 自然,服务器领域并不是在使用什么,而是为了保护无辜者而被改变了。 nodes / nodes.pp文件包含: node 'agent1.example.dom' { include users, } 用户类在/ etc / puppet / modules / users下。 清单/ init.pp文件包含: class users { group { 'admins': ensure => 'present', gid => '501', } user { 'user1': ensure => 'present', uid => '10000', gid => '501', home => […]

问题同时得到木偶定制的事实

我创build了一个简单的定制事实: Facter.add(:hello) do setcode do "Hello, world" end end 把它放在这里(傀儡大师): /etc/puppet/modules/custom/lib/facter 我正在木偶客户端testing它: facter hello 什么都看不到 而这个命令的工作(在傀儡客户端): facter –puppet hello Hello, world 检查是否同步(在puppet客户端上): puppetd –test –pluginsync info: Retrieving plugin info: Loading facts in /var/lib/puppet/lib/facter/hello.rb info: Caching catalog for host.example.com 它看起来像自定义事实是同步罚款。 我不明白为什么它不能通过facter 。 另外,我怎样才能从傀儡大师那里使用这个新的事实呢? 我需要根据自定义的事实来构build一个简单的条件。 例如,我在site.pp (puppetmaster)中join了: $string = "$hello" notice("Testing custom fact: $string") 同样,在syslog中, notice函数中没有行。 我研究了很多文档,但仍然无法使其工作。 […]

木偶:用root_squash设置在nfs共享上创build目录

我有一个服务器上的NFS共享,属于用户barack 。 barack可以写在这个共享中,而root不能,因为根的壁球function 我试图用puppet 2.7.21来创build一个目录,使用filetypes,但它看起来像木偶创build文件/目录作为根,然后改变所有权。 很明显,第一步将会(而且确实)失败。 我结束了使用exec w / mkdir 。 我的理论是关于木偶创build文件的第一个权利? 有没有办法强制木偶创build一个目录为barack ,使用filetypes?

Puppet使用主机名作为variables值

我有这个简单的function: define e::x($x = $title) { file {$x: path => "/tmp/${x}", ensure => present, } } 我这样使用它: e::x {"xxxx":} 然而,创build的文件是/ tmp /“hostname”,就像debian-vm或其他东西。 它永远不会使用正确的值。 我不明白什么是错的,有没有人有任何线索? 谢谢。 编辑 所以,经过一些更多的testing,看起来像$ x = $标题不起作用。 如果我直接使用$标题它的作品。 这很奇怪,因为我确定我已经在另一台服务器上使用了这种模式,没有麻烦。 也许这与我的Puppet版本有关。 我在Debian Squeeze上运行Puppet的打包版本。 可能有一个错误。