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 =
[
"/etc/nginx/conf.d/default.conf",
"/etc/nginx/default.d/php.conf",
"/etc/nginx/nginx.conf"
]
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?