Error saying File etc httpd conf mods-enabled proxy conf is already defined cannot redefined

0 votes

I'm trying to inherit a module using Puppet

class apache::proxy {
file { '/etc/httpd/conf/mods-enabled/proxy.conf':
source => "puppet:///modules/apache/proxy.conf"
}

Defined my own version:

class myapp {
include apache::proxy
file { '/etc/httpd/conf/mods-enabled/proxy.conf':
source => "puppet:///services/myapp/proxy.conf"
}

It keeps throwing this error:

File[/etc/httpd/conf/mods-enabled/proxy.conf] is already defined; cannot redefined

What do I do?

Mar 5, 2019 in Puppet by Kavya
775 views

2 answers to this question.

0 votes

You can override resources with class inheritance by creating a subclass that inherits resources from the parent class.

class myapp::apache inherits apache::proxy {
file { '/etc/httpd/conf/mods-enabled/proxy.conf':
source => "puppet:///services/myapp/proxy.conf"
}

Then instead of calling the class with the statement include apache::proxy you call the override class with the statement include myapp::apache in the service manifest.

answered Mar 5, 2019 by Yogesh
0 votes
This error occurs when you try to create a service stack from reusable Puppet modules and try altering a resource that has already been defined in the previous module.
answered Mar 5, 2019 by Kyraa

Related Questions In Puppet

0 votes
1 answer

Pupper error - Duplicate definition: Service[ServiceName] is already defined

Hey @Nigya, try something like this: class MyClass ...READ MORE

answered Feb 15, 2019 in Puppet by Hatim
611 views
0 votes
1 answer
0 votes
1 answer

Puppet: Error: Cannot set modulepath settings in puppet.conf

These extra module paths are specific to ...READ MORE

answered Aug 7, 2019 in Puppet by Sirajul
• 59,230 points
2,271 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,055 views
+2 votes
1 answer
0 votes
1 answer

Service already defines error in Puppet

Hey @Rohan, try this: class MyClass { ...READ MORE

answered Feb 9, 2019 in Puppet by Monish
1,156 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP