Thank you. David for immediate reply. Answer - ' I'd switch the title and target of the symlink around'
On Wednesday, May 24, 2017 at 10:44:33 AM UTC-4, David Schmitt wrote: > > > > On 24 May 2017 at 15:16, ggun <gaurav...@gmail.com <javascript:>> wrote: > >> 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 >> >> >> >> >> > You need to decide where you want the file, and where you want the > symlink. As it stands, you define the file /xxx/conf/xxx_logrotate.conf > twice, once with the templated content, once as symlink. In your situation, > I'd switch the title and target of the symlink around. > > > Cheers, David > > -- 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 puppet-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/99c6e5e0-505c-4f75-88ef-c2d15484b31d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.