Ask Your Question
1

Referencing a previously defined resource

asked 2013-12-20 12:28:26 -0500

Mark S gravatar image

I am pushing the system-auth file from the Puppet Server to my puppet clients. My question is how do I push the file and then symlink it to a target file with out getting a duplicate declaration error?

Here is a my manifest snippet:

class security::pass_lock{
   file { "/etc/pam.d/system-auth":
     owner => "root",
     group => "root",
     mode => 0644,
     source  => "puppet:///modules/security/etc/pam.d/system-auth",
   }
}

class security::symlink_authac{
   file {"/etc/pam.d/system-auth":
   ensure => link,
   target => "/etc/pam.d/system-auth-ac",
   }
}

and here is the resulting error message:

Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate ...

(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-12-20 13:46:07 -0500

ramindk gravatar image

target => should be the real file, not the symlink you want to create. http://docs.puppetlabs.com/references/stable/type.html#file-attribute-target

The correct code would be.

class security::pass_lock {
   file { '/etc/pam.d/system-auth':
     owner   => root,
     group   => root,
     mode    => 0644,
     source  => 'puppet:///modules/security/etc/pam.d/system-auth',
   }
}

class security::symlink_authac {
   file { '/etc/pam.d/system-auth-ac':
   ensure => link,
   target => '/etc/pam.d/system-auth',
   }
}
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-12-20 12:28:26 -0500

Seen: 221 times

Last updated: Dec 20 '13