Ask Your Question
1

How to design to avoid clashing resource names and provide desired flexibility

asked 2013-12-30 09:09:36 -0500

jaksky gravatar image

updated 2014-01-05 19:38:44 -0500

ramindk gravatar image

My question is a bit theoretical or may be "best practice" would suite better. I am packing my puppet code into modules and classes. However at some stage I am running into a problem that when I perform some "configuration" combination - I am getting an error of duplicated resource names. Which is clear why that is happening. As my configuration is "role" based and when I try to apply more than two roles to the same machine I am getting a clash since roles has some common items. So my question is what is the best way to deal with ... (more)

edit retag flag offensive close merge delete

Comments

IIWM I would go with #2. This is the design pattern for puppet and the expected route to solve this problem.

ethrbunny gravatar imageethrbunny ( 2013-12-31 07:39:13 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-01-05 22:50:13 -0500

ramindk gravatar image

I'm not clear why you're having clashing resources. With role/profile you should be doing something like

class role::database_slave {
  include profile::base
  include profile::mysql
}

class profile::mysql {
   class { 'mysql': }
}

If you were to add role::wordpress to the same machine which we can assume contains profile::mysql as well it should not be a duplicate resource because of the wrapper Mysql class. If you're not wrapping parametrized modules in profile classes you'll likely have problems.

However role/profile in nearly all cases assumes that there is only one role. Doing otherwise is a giant ... (more)

edit flag offensive delete link more

Comments

I am following the pattern as you described. Let me clarify a bit more. Example: I am using this for installation of Hadoop - NameNode and SecondaryNameNode. Those two roles have ...(more)

jaksky gravatar imagejaksky ( 2014-01-06 02:11:45 -0500 )edit

Gotcha, so it's just a shared resource. Either of your ideas should work though most people seem to prefer making a third module of the common parts.

ramindk gravatar imageramindk ( 2014-01-06 05:54:10 -0500 )edit

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: 2013-12-30 09:09:36 -0500

Seen: 387 times

Last updated: Jan 05 '14