On Monday, November 5, 2012 2:17:11 PM UTC-6, Erwin Bogaard wrote:
>
> As I'm in over my head, let's supply you with (part of) the manifests in 
> question:
>
> The define:
>
> define sugar::definitions_sug_wp (
>       $template       = 'sugar/etc/httpd/conf.d/sugar6x.conf.erb',
>       $client_domain  = "$title",
>       $mysql_rootpwd  = "$mysql_password",
>       $mysql_dbname,
>       $mysql_pwd,
>       $sugar_admin,
>       $sugar_pwd,
>
>     ) {
>
> # This is for example to create the httpd.conf and the sugar-folder. So 
> this has to be in both. As you can see, I parametrized the httpd-conf, so I 
> can specify it in my class. Also, the  ${client_domain}-variable is used 
> throughout this define.
>     file {
>     "/etc/httpd/conf.d/sug-${client_domain}.conf":
>       content => template($template),
>       owner   => 'root',
>       group   => 'root',
>       mode    => '0644',
>       notify  => Service['httpd'];
>     "/var/log/sugar/${client_domain}":
>       ensure  => 'directory';
>    }
>
>
> # The following is specific to the WordPress-installation and doesn't need 
> to be applied to every machine. So this part isn't in the define 'define 
> sugar::definitions_sug'.
>     file {
>     # Configuratie van publieke html
>     "/var/www/html/${client_domain}":
>       owner   => 'apache',
>       group   => 'apache',
>       mode    => '0744',
>       ensure  => 'directory';
>     # Configuratiefile WordPress
>     "/var/www/html/${client_domain}/wp-config.php":
>       owner   => 'apache',
>       group   => 'apache',
>       mode    => '0744',
>       require => File["/var/www/html/${client_domain}"],
>       content => template('sugar/wordpress/wp-config.php.erb');
>
> I call both defines ('sugar::definitions_sug_wp' and 'define 
> sugar::definitions_sug') in the following class:
> class sugar::instances {
>
>     sugar::definitions_sug {
>     # SugarCRM - ECM2
>     'node1':
>       mysql_dbname => 'dbname1',
>       mysql_pwd    => 'password1';
>
>     sugar::definitions_sug_wp {
>     'node2':
>       sugar_admin  => 'text1',
>       sugar_pwd    => 'password2',
>       mysql_dbname => 'dbname2',
>       mysql_pwd    => 'password3';
>
> I include this class on one node to get several sugar-only vhosts and 
> several sugar+wordpress-nodes on that node.
>
> Hope this helps you explain things to me!
>
>

You're still making me guess about what the actual problem is.  Have you 
actually tried anything, or is this all hypothetical?  If you tried and 
failed, then what error messages were produced?

Bits and pieces of your manifests are not particularly helpful.  I'm 
looking for something manageable that provides a complete example of the 
problem.  Ideally something as stripped-down as possible.  If you are 
totally new to Puppet then you might consider playing with a simplified 
model before moving on to a full-blown solution.

My best guess at this point is that the problem -- if there is one -- 
concerns resources that both your definitions declare, such that you get 
duplicate resource declarations if you try to instantiate some combinations 
of those definitions.  I suggested such a problem a couple of posts ago, 
however, and you more or less ignored it.

If duplicate resource declarations are indeed the problem then the solution 
is simple: don't do that!  Every managed resource should have exactly one 
owner -- generally either a class or defined-type instance.  Resources 
should be declared only by their owners.  If you stick to that -- 
remembering that defined-type instances are themselves resources -- then 
you will not have problems with duplicate resource declarations.

So, what obstacles must you overcome to (re-)structure your manifests so 
that each resource has exactly one owner?  (Not a rhetorical question.)  
Virtual resources and conditionals are some of the tools at your disposal 
for overcoming such obstacles, but it's all about how you use them.  In 
particular, just making a declaration virtual does not inherently prevent 
duplicate declaration issues.

Tim's suggestion of combining the definitions and using a parameter to 
direct whether to include WordPress components would be one possible 
solution.  There are several others.  Which would be best depends on the 
details of the problem.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/XGFuEULdHvcJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to