Hi Experts,
I need your help in below requirement.
*Requirement*
I need to create a file (xxx_logrotate.conf) with content as below
/xx/xx/xx.log {
weekly
copytruncate
rotate 8
compress
maxage 180
missingok
}
2. Create the symlink for above create file xxx_logrotate.conf to
/etc/logrotate.d/xxx_logrotate.conf
*My approach*
1. I went ahead creating the file with using erb tempalte for adding the
file content but when I create a new resource to create the symlik for the
source and target. The puppet run fails with duplicate file resource
file { 'xxx-log-rotation-config-file':
ensure => 'present',
path => '/xxx/conf/xxx_logrotate.conf',
content => template('aaa/xxx_logrotate.conf.erb'),
owner => 'root',
group => 'root',
}
file { '/xxx/conf/xxx_logrotate.conf':
ensure => 'link',
target => '/etc/logrotate.d/xxx_logrotate.conf',
require => File['xxx-log-rotation-config-file'],
}
The puppet run fails for above code with below error
Error: Evaluation Error: Error while evaluating a Resource Statement,
Duplicate declaration: File[/xxx/conf/mysql_logrotate.conf] is already
declared in file
/etc/puppetlabs/code/environments/production/modules/xxx/manifests/postinstall.pp:46;
cannot redeclare at
/etc/puppetlabs/code/environments/production/modules/xxx/manifests/postinstall.pp:54
at
/etc/puppetlabs/code/environments/production/modules/xxx/manifests/postinstall.pp:54:3
Is there a better way of handling this without any issue using file
resource?
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-dev/9108c3b2-0a1f-4126-a5d1-432a70240896%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.