Ask Your Question
0

Not able to start puppet master service

asked 2017-12-08 03:24:40 -0500

Manish149 gravatar image

This is the issue. Error: Could not create resources for managing Puppet's files and directories in sections [:main, :ssl, :ca]: Duplicate declaration: File[/etc/puppetlabs/code/environments/production] is already declared; cannot redeclare Error: Could not create resources for managing Puppet's files and directories in sections [:main, :ssl, :ca]: Duplicate declaration: File[/etc/puppetlabs/code/environments/production] is already declared; cannot redeclare Duplicate declaration: File[/etc/puppetlabs/code/environments/production] is already declared; cannot redeclare

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-12-11 02:56:56 -0500

It's saying that you cannot have two resources with the same name. In other words, this will never work.

class foo { file {'/tmp/foo': ensure => 'directory' } }

class bar { file {'/tmp/foo': ensure => 'directory', } }

This is a pretty common dilemma, especially when dealing with directories. For instance, you have a directory like "/etc/puppetlabs/code/environments/production" that needs to exist as a dependency to several different classes. You can solve this in a few different ways.

  1. Use the stdlib ensure_resource function: https://forge.puppet.com/puppetlabs/s...
  2. Include/Require a base class: https://puppet.com/docs/puppet/5.3/la...
  3. Inherit a base class: https://puppet.com/docs/puppet/5.3/la...
  4. You can even hack in an exec statement with mkdir and then use a test statement in the unless parameter: https://puppet.com/docs/puppet/5.3/ty...
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

1 follower

Stats

Asked: 2017-12-08 03:24:40 -0500

Seen: 386 times

Last updated: Dec 11 '17