我创建了一个简单的 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) 我写了一个Puppet模块在Windows上安装Git.Puppet Master是Linux.
是否可以使用puppet资源(即没有脚本或exec)编写Puppet清单来克隆GitHub仓库?
这是一个私人仓库,因此解决方案需要包含安全凭证.