如何将文件名作为参数传递给 Puppet 类?我的清单文件是
class new_file ($my_filename){
file { $my_filename:
ensure => present,
content => "I got it, Hello, I am Aura, with new content\n",
}
}
node 'agent1' {
class {new_file: path => "/tmp/t.txt", }
}
答案1
你的课程接受一个名为的参数my_filename
:
类 new_file ($my_filename){
但在这里你提供的是path
:
类 {new_file:path => “/tmp/t.txt”, }
将此参数更改为相同的名称,将会避免出现invalid parameter path
错误:
class {new_file: my_filename => "/tmp/t.txt", }