我正在使用Puppet为参数化的类提供MySQL: class mysql::server( $password ) { package { 'mysql-server': ensure => installed } package { 'mysql': ensure => installed } service { 'mysqld': enable => true, ensure => running, require => Package['mysql-server'], } exec { 'set-mysql-password': unless => "mysqladmin -uroot -p$password status", path => ['/bin', '/usr/bin'], command => "mysqladmin -uroot password $password", require => Service['mysqld'], […]
有什么办法使用puppet设置服务器的主机名? 我可以写一个自定义types,但也许有一个更简单的方法。 谢谢 [编辑]对不起,我应该提到我跑傀儡无主,傀儡先设置,然后它设置了一切。
我一直在试图找出一种方法来testing资源是否已经在另一个文件中定义,如果不是创build它? 一个简单的例子: if File[$local_container] { alert("Testing – It existed $local_container") } else { file{ "$local_container": ensure => directory, } } 但是, File[$local_container]似乎总是评估为真。 有没有办法做到这一点?
比方说,我有一个模块的files/etc/foo/{conf0, conf1, conf2, conf3, etc} 。 当它们的数量很小时,放置每个文件都很简单: file { 'conf0': path => '/etc/foo/conf0', ensure => true, source => 'puppet:///…/etc/foo/conf0', } 并重复。 但是这里涉及到相当多的重复,而且如果有多个configuration文件,维护是很繁琐的。 我想确保files/etc/foo/镜像到给定的path。 也就是说, file { 'etc foo confs': path => '/etc/foo', ensure => recursive, source => 'puppet:///…/etc/foo', } 会创build/etc/foo/conf0 , /etc/foo/conf1等等。 这可能吗?
我使用木偶来(理论上)让npcd在安装时启动,但是在Ubuntu上,这个服务安装在RUN =“no”的/ etc / default / npcd默认设置中: $ cat /etc/default/npcd # Default settings for the NPCD init script. # Should NPCD be started? ("yes" to enable) RUN="no" # Additional options that are passed to the daemon. DAEMON_OPTS="-d -f /etc/pnp4nagios/npcd.cfg" 我会认为这块木偶configuration会照顾的事情: service { "npcd": enable => true, ensure => "running", require => Package["pnp4nagios"], } 但是,可惜的是,它并没有实际重写/ etc […]
我想从puppetpipe理安装的分区,其中包括修改/etc/fstab和创build用作挂载点的目录。 mount资源types更新fstab就好了,但使用file来创build挂载点有点棘手。 例如,默认情况下,目录的所有者是root ,如果挂载的分区的根目录(/)有另一个所有者,puppet将尝试更改它,我不想要这个。 我知道我可以设置该目录的所有者,但为什么我应该关心挂载的分区上的内容? 我想要做的就是挂载它。 有没有办法让木偶不关心用作挂载点的目录的权限? 这就是我现在使用的: define extra_mount_point( $device, $location = "/mnt", $fstype = "xfs", $owner = "root", $group = "root", $mode = 0755, $seltype = "public_content_t" $options = "ro,relatime,nosuid,nodev,noexec", ) { file { "${location}/${name}": ensure => directory, owner => "${owner}", group => "${group}", mode => $mode, seltype => "${seltype}", } mount { […]
如何在傀儡清单中访问环境variables(来自puppet守护进程的环境)?
我想在puppet中写一个函数,如果传入的目录path不存在,将会fail 。 if File["/some/path"]总是返回true,并且if defined(File["/some/path"])只有当资源在puppet中定义时才返回true,而不pipe它是否实际存在。 有一种方法来做到这一点与简单的if语句? 谢谢
我想确定motd文件是空的。 我喜欢这样做: file { "/etc/motd": ensure => empty } 这显然不起作用。 有一个简单的方法来确保文件是空的,而不是使用“源”声明,并在文件存储库中存储一个空文件?
默认情况下,Puppet客户端每30分钟要求更新一次。 我想改变这个间隔。 什么是最方便的方法呢?