我使用 Puppet 通过 RVM 安装 Ruby,直到最近(最近几天左右)都工作正常。
我认为这是由于 rvm 希望我“按任意键继续”。无论如何,有没有办法强制“是”这个,我已经尝试过——强制但没有运气。谢谢
[root@local ~]# rvm install --binary --verify-downloads 1 ruby-1.9.3-p362
Searching for binary rubies, this might take some time.
Installing requirements for unknown, might require sudo password.
Always update your system first!
/bin/bash
/usr/bin/curl
which: no git in (/usr/local/rvm/gems/ruby-1.9.3-p362/bin:/usr/local/rvm/gems/ruby-1.9.3-p362@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p362/bin:/usr/local/rvm/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin)
/usr/bin/patch
Install: git
Install: build-essential openssl libreadline zlib1g libyaml libsqlite3 sqlite3 libxml2 libxslt autoconf libc6 libgdbm ncurses automake libtool bison pkg-config
press any key to continue
Run Code Online (Sandbox Code Playgroud) 假设您有一个必须满足的任意要求才能运行木偶模块。如何让 puppet 模块正常退出?
例如,假设我的模块需要 puppet 3.2 或更高版本才能成功运行。如果模块尝试在 3.1.x 上运行,它将失败(非正常)。
http://docs.puppetlabs.com/references/latest/function.html#warning
我正在学习 puppet,并且遇到了 haproxy 配置的一部分,如下所示
@@haproxy::balancermember { $::fqdn:
listening_service => 'puppet00',
server_names => $::hostname,
ipaddresses => $::ipaddress,
ports => '8140',
options => 'check',
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试弄清楚它@@的名称以及它在此配置中的作用
我想使用 puppet 在文件中放置一些值,但是当我在 ruby 模板中执行以下操作时:
<% @_zoo_cfgs.each do |zooconfig| -%>
<%=zooconfig -%>
<% end -%>
Run Code Online (Sandbox Code Playgroud)
我在生成的文件中得到以下内容:
server.1=a1-dev-mem333.lab.lynx-connected.com:2888:3888(trailing whitespace)
Run Code Online (Sandbox Code Playgroud)
但我想要以下内容:
server.1=a1-dev-mem333.lab.lynx-connected.com:2888:3888(no trailing whitespace)
Run Code Online (Sandbox Code Playgroud)
在值之前或之后的文件中没有额外的空格。任何人都可以让我知道如何做到这一点?
我创建了一个简单的 Puppet 4 类和一个单元测试,如下(在执行touch metadata.json; rspec-puppet-initwhile in 之后modules/test/):
# modules/test/manifests/hello_world1.pp
class test::hello_world1 {
file { "/tmp/hello_world1":
content => "Hello, world!\n"
}
}
# modules/test/spec/classes/test__hello_world1_spec.rb
require 'spec_helper'
describe 'test::hello_world1' do
it { is_expected.to compile }
it { is_expected.to contain_file('/tmp/hello_world1')\
.with_content(/^Hello, world!$/) }
end
Run Code Online (Sandbox Code Playgroud)
我可以通过rspec spec/classes/test__hello_world1_spec.rb在modules/test/.
我现在想继续学习一个稍微高级一点的类,它使用另一个模块的代码,即concat(该模块已经安装在 中modules/concat):
# modules/test/manifests/hello_world2.pp
class test::hello_world2
{
concat{ "/tmp/hello_world2":
ensure => present,
}
concat::fragment{ "/tmp/hello_world2_01":
target => "/tmp/hello_world2",
content => "Hello, world!\n",
order => …Run Code Online (Sandbox Code Playgroud) 我已经使用 aws opsworks 创建了傀儡大师。我可以自动将 ami linux 节点添加到 puppet master。
当我尝试通过以下链接将 Windows 64 位节点添加到我的 puppet master 时遇到问题https://puppet.com/docs/pe/2017.3/installing/installing_agents.html#install-windows-agents-with -msi 包
我将 puppet-agent-x64.msi 从当前位置的 puppet master 复制到 windows 节点和 /opt/puppetlabs/server/data/packages/public//windows-x86_64-/ 并运行安装程序来安装代理。安装成功,开始菜单包含一个 Puppet 文件夹,其中包含手动运行代理、运行 Facter 和打开命令提示符以与 Puppet 工具一起使用的快捷方式。
但是 Windows 节点没有显示在 puppet web ui 中,当我尝试运行 puppet 代理时出现此错误
"Running Puppet agent on demand ...
Error: Could not request certificate: Error 403 on SERVER: Forbidden request: /puppet-ca/v1/certificate/ca (method :get). Please see the server logs for details.
Exiting; failed to retrieve certificate and waitforcert is disabled …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行“puppet-lint -f(当前打开的文件)
Puppet 扩展提供了 puppet-lint 检查,但不会自动修复任何问题,它只是给出警告。如何添加键盘快捷键以在当前编辑的文件上运行“puppet-lint -f”?
谢谢
我有一个使用自定义 Puppet 函数结果的 Puppet 类。为了确保在对类进行单元测试时只测试我的类中的逻辑,而不是我的函数中的逻辑,我想模拟该函数。
但是,我似乎无法将模拟函数完全隔离到单个上下文中。我真正的测试代码比下面的例子大,但我把它归结为:
class break_tests {
$result = my_mocked_function('foo', 'bar', 'baz')
file { 'under_test':
content => $result,
}
}
Run Code Online (Sandbox Code Playgroud)
class break_tests {
$result = my_mocked_function('foo', 'bar', 'baz')
file { 'under_test':
content => $result,
}
}
Run Code Online (Sandbox Code Playgroud)
Failures:
1) break_tests numero duo should contain File[under_test] with content supplied string
Failure/Error: it { should contain_file('under_test').with_content('bar') }
expected that the catalogue would contain File[under_test] with content set to supplied string
# ./spec/classes/break_tests_spec.rb:17:in `block (3 levels) in <top (required)>'
Run Code Online (Sandbox Code Playgroud)
我尝试将其拆分为两个describes …
尝试从 puppet 代理节点运行以下命令时:
puppet agent --test --verbose
Run Code Online (Sandbox Code Playgroud)
提示以下错误
错误:证书验证失败 [无法获得 CN=puppetmaster.example.com 的本地颁发者证书]
我已经在 /etc/hosts 文件中向我的主机添加了 FQDN。
我对木偶很新,只是想了解输出告诉我的内容.我有一个非常简单的init.pp文件来配置shudders文件:
class sudo {
package { sudo:
ensure => present,
}
if $operatingsystem == "Ubuntu" {
package { "sudo-ldap":
ensure => present,
require => Package["sudo"],
}
}
file { "/etc/sudoers":
owner => "root",
group => "wheel",
mode => 0440,
source => "puppet:///modules/sudo/sudoers",
require => Package["sudo"],
}
Run Code Online (Sandbox Code Playgroud)
但是每当我运行以下命令时:
sudo puppet agent --server=my-imac.local --no-daemonize --verbose --onetime --noop
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
info: Caching catalog for susan-hirschs-imac.local
info: Applying configuration version '1321294018'
notice: /Stage[main]/Sudo/Package[sudo]/ensure: current_value absent, should be present (noop)
notice: Class[Sudo]: Would have triggered 'refresh' …Run Code Online (Sandbox Code Playgroud) puppet ×10
rspec ×2
unit-testing ×2
aws-opsworks ×1
erb ×1
lint ×1
rspec-puppet ×1
ruby ×1
rvm ×1
testing ×1