Hi Stack,

here's an example:
https://github.com/wolfspyre/puppet-mysqlx/blob/master/manifests/v55.pp

in this class I create a pair of bookend anchors, and then shove a yumrepo,
and a file resource between them.


Your other classes/resources can then declare a relationship to the end
anchor to establish the relationship.

some gotchas:

- Make sure to include the class declaring the anchor into the class which
has the dependency.
- Remember that you've just permanently established a relationship between
these two classes. This is important to know, and can take you in a
direction that leads to complications down the road.

- It is common to have specific software classes depend on your base-type
'i set up my package repositories, and some other core things that will
happen most everywhere' resources. The caveat here is that modules you
share with the world will NOT have that base class, and as such may have
dependency issues.

- Use the anchor pattern as sparingly as possible. Consider having to use
it like having to resort to an exec. It is occasionally the right tool for
the job, but not usually.

Hope that helps.




On Wed, Jun 26, 2013 at 7:38 PM, Stack Kororā <i.am.st...@gmail.com> wrote:

> Thank you very much Joe. I think this exactly the path that I need but I
> am having trouble with it.
>
> As I said, I have multiple systems that this repo class watches over.
> Thus, for one of several instances, I have things like:
>
> if $osfamily == 'RedHat' {
>     class {'repos::epel': }
> }
>
> The sub-class epel.pp file configures the EPEL repository for the RHEL,
> Scientific, CentOS, Fedora, ect. However, trying to anchor that caused a
> bunch of odd errors (it is entirely possible I didn't do it right).
>
> I also have the main configuration in a large case statement that manages
> the main configuration in sub-classes for all operating systems (thus only
> some sub-classes are ever called). This too is causing me some issues.
>
> I think it is because I don't fully understand how the anchor is supposed
> to work and the examples listed are a bit simplistic with both a require
> and a notify. But what if I need it to require only if it matches certain
> parameters?
>
> I poked around in a few other modules seeing if I could find more
> examples, but came up empty.
>
> Does anyone know where I can view more examples/code for some guidance?
>
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to