Ask Your Question

File conflict in Puppet between modules

asked 2018-08-23 12:31:23 -0600

gil.comeau gravatar image

I have run into a problem that I am sure is an simple fix but I can't seem to find any resources that explain the behavior correctly. I am building out a new nginx puppet module for automating git server deployment.

I am using a standard nginx setup and am trying to replace the ngnix.conf file.

I call the base class and then request the files become absent before putting the configuration file that I need for my setup.

  class { 'nginx': }

  $nginx_default_files_to_remove = 

  file { [ $nginx_default_files_to_remove ]: 
  ensure => 'absent', 
  require => Class["nginx"]

This causes the following error to be generated when I run the puppet module on my agent:

  Error 400 on SERVER: Duplicate declaration: File[/etc/nginx/nginx.conf] is 
  already declared in file /etc/puppet/modules/nginx/manifests/config.pp:331; 
  cannot redeclare at /etc/puppet/modules/sf_nginx/manifests/git.pp:18

It's my understanding that puppet has the ability to remove and replace standard configuration files. Where am I going wrong here?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-08-24 09:36:36 -0600

gene gravatar image

I believe the error is telling you that you have two modules (nginx and sf_nginix) that both have a file declaration for /etc/nginx/nginx.conf and that is a problem. Only one of them can declare the resource.

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


Asked: 2018-08-23 12:31:23 -0600

Seen: 50 times

Last updated: Aug 24