我正在努力学习如何使用木偶,以及他们的快速入门指南 。 我想用generate生成一个时间戳: $timestamp = generate('/bin/date') class helloworld::motd { file { '/etc/motd': owner => 'root', group => 'root', mode => '0644', content => "Production puppetmaster is in control. Last run: ${timestamp}\n", } } 但由此产生的motd文件没有date/时间: Production puppetmaster is in control. Last run: 我究竟做错了什么?
我正在使用Puppet来pipe理一些服务器的configuration。 其中一个任务是在/www下创build一个特定的文件夹结构来托pipe我们的应用程序。 但最近,我们已经有了这个服务器,其中/www只是到另一个目录的符号链接(必须这样做是因为存储空间不足) $ ls -l /www lrwxrwxrwx 1 root root 13 Oct 25 15:33 /www -> /storage/www/ 我们一直在使用这个来pipe理目录: file { $path: ensure => directory, owner => user, group => group, mode => 'a=rx,u+w' } 这个特定服务器的问题是,当运行Puppet时, /www符号链接被删除,Puppet会在/www下创build一个新的常规目录。 除非我们再次手动介入来创build符号链接,否则这会打乱我们的应用程序。 我的问题:有人知道一种方式,使木偶不删除符号链接,只是把它作为一个目录:如果没有/www目录或没有/www符号链接存在,创build/www目录,否则什么都不做?
我有一个问题,基于Windows的模块安装过程通过木偶大师来控制。 设置: Puppetmaster Linux服务器 运行木偶代理的Windows 7工作站并成功连接到puppetmaster。 我想开始使用一个模块来控制Windows 7机器上的本地安全策略。 https://forge.puppet.com/cannonps/local_security_policy 我有点困惑,我需要安装这个模块。 我需要安装在: 仅限Windows机器 只有木偶大师 代理人和木偶主人 谢谢 :)
当我在nodes.pp包含以下内容时: class {'bareos': … manage_database => true, … 我得到以下错误: ==> bareOSdirector: Error: Could not find class mysql::client for bareosdirector on node bareosdirector ==> bareOSdirector: Error: Could not find class mysql::client for bareosdirector on node bareosdirector 似乎有很多的mysql模块,有没有人有一个想法,哪一个是打算成为这个库的依赖? 我知道netmanagers bareos是无人维护的。
exec { "check_presence": command => "/bin/true", onlyif => '/usr/bin/test -e /path', } file {"/home/user/test.txt": ensure => file, require => Exec["check_presence"] } 我无法弄清楚我的脚本有什么问题。 我用puppet apply test.pp来运行这个脚本。 但不pipe是否存在,文件test.txt都已创build。 我正在使用木偶3.4.3。 任何帮助表示赞赏。 相关的答案: https : //serverfault.com/a/516919/428218
我正在阅读最新的木偶书,它把事情分解成很好的模块。 在一个例子中,他们为SSH创build了一个模块,所以: /modules/ssh/{files, manifests, …} 然后,您可以将该模块包含到您的节点类中。 我的问题是,对于现场制作木偶configuration,这基本上意味着你将有很多模块正确? 我的意思是如果你为ssh创build一个,这个列表将会很长,你不会说吗? eg: I need: nginx, ssh, mysql, phusion passenger, etc. etc. 这些是主要组件,但是如果我为每个需要的服务编写一个模块,我认为这个列表将会变长。 另一方面,ssh已经安装了Ubuntu,所以也许这本书中的例子只是为了传授模块背后的想法而devise的。
我有这个模块: class bash { package { "shells/bash": ensure => "installed", } } 执行后,我在傀儡仪表板中发现了这个: 从缺席变为现在失败:无法获取端口INDEX:425无法build立连接。 我不知道为什么会这样,几个星期前没有发生,但现在每一次都有几台不同的机器。 详细模式: $ puppet agent –test –debug –verbose I see debug: Puppet::Type::Package::ProviderFreebsd: Executing '/usr/sbin/pkg_info -aoQ' debug: Package: shells/bash: origin => {:port_category=>"shells", :port_name=>"bash"} debug: Package: shells/bash: source => #<URI::FTP:0x801d3fca8 URL:ftp://ftp.freebsd.org/%2Fpub/FreeBSD/ports/amd64/packages-8-stable/> debug: Fetching INDEX: #<URI::FTP:0x801d31108 URL:ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/INDEX.bz2> err: /Stage[main]/Bash/Package[shells/bash]/ensure: change from absent to present […]
在我的木偶脚本中,我有2个执行不同batch file的exec调用 exec { command => 'file1.bat' } exec { command => 'file2.bat' } 如果file1.bat使用SET环境variables SET VAR1=someVal 它不能从我预期的file2.bat访问。 但是,如果我使用SETX SETX VAR1 someVal -m 它在file2.bat中仍然不可用。 我已经能够对file2.bat进行variables更改的唯一方法是直接在file1.bat中的registry(使用reg ADD)中设置variables,然后在file2.bat中查询它(使用reg QUERY)。 有一个更好的方法吗? 我无法将file1.bat和file2.bat组合到一个脚本中,因为它们在别处是独立使用的。
我已经build立了一个模板来设置/ etc / hosts文件的内容。 这是我的模板: 127.0.0.1 localhost.localdomain localhost <%= scope.lookupvar('ipaddress') %> <%= scope.lookupvar('fqdn') %> <%= scope.lookupvar('hostname') %> 这是正确的工作,但我想,在具有多个networking接口的节点上,为这两个IP地址提供主机名。 然后我尝试了以下模板: <%= scope.lookupvar('interfaces').each do |interface| %> <%= scope.lookupvar('ipaddress_'+interface) %> 但木偶在客户端显示错误: Could not retrieve catalog from remote server: wrong header line format 当然,我可以使用傀儡提供的来pipe理主机文件,但是像这样: # host entry with multiple aliases host { 'dashboard': ip => [$ipaddress_eth0, $ipaddress_eth1] host_aliases => […]
Puppet 0.25.4在ubuntu上点空白拒绝执行以下命令: exec {"initiate replica set": command => "echo 'rs.initiate()' | mongo", path => ["/usr/bin","/usr/sbin","/bin"], user => "root", require => Class["mongodb"] } 我可以以root身份执行命令,所以我猜可能是shell的问题。 不幸的是升级木偶不是一种select(无论如何会导致其他问题)。 我已经尝试指定二进制文件的显式path,而不是依赖于path参数,也改变命令: "bash -c \"echo 'rs.initiate()' | mongo\"" 依然不起作用。 有任何想法吗? 我收到一条错误消息,提示“无法从notrun更改为0”