i am using this CIS module arildjensen/cis-puppet
and want to override the /etc/profile
file declaration on the CIS module
so i created this new manifest, following this post
class profile::hadoop::settings inherits cis {
file { '/etc/profile':
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0600',
source => 'puppet:///modules/profile/hadoop/etc/profile',
}
}
however this still gives the error
Error: Duplicate declaration: File[/etc/profile] is already declared in file /tmp/vagrant-puppet/modules-ab9b45e51a68912cdc576c81d46a2260/profile/manifests/hadoop/settings.pp:9; cannot redeclare at /tmp/vagrant-puppet/modules-ab9b45e51a68912cdc576c81d46a2260/cis/manifests/linuxcontrols/c0076.pp:12 on node server.localdomain
The syntax for a resource override is different from the syntax for a resource declaration. You're looking for this:
class profile::hadoop::settings inherits cis {
File['/etc/profile'] {
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0600',
source => 'puppet:///modules/profile/hadoop/etc/profile',
}
}
Syntactically, it's a resource reference (which makes sense) with an appended list of property overrides.
That's the old-school way, of course. Since at least Puppet 3.0, you can also perform overrides with a collector, in which case you don't need class inheritance:
class profile::hadoop::settings {
include 'cis'
File<|title == '/etc/profile'|> {
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0600',
source => 'puppet:///modules/profile/hadoop/etc/profile',
}
}
See the docs for full details.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.