Boudewijn Ector
2012-Apr-16 21:39 UTC
[Puppet Users] Requiring defines from other classes in a fact
Hi Guys, Currently I''m coding a recipe for installing some UNIX daemon (openca, but that''s not very relevant). This works fine, except some dependency stuff regarding classes from an external module. My current setup is like this: /etc/puppet/modules/openca/manifests/init.pp: class openca { define openca-server($db_name, et cetera) { mysql::database{$db_name: ensure => present } package{"openca": ..... } service{"openca": ....... requires => Package["openca"], } } } (yeah this example has been simplified a lot, I know puppet resolves the depency all by it self in this case) Very very simple, except for the fact that I want to add the dependency for the mysql::database too. I''m using this excellent module for managing mysql: https://github.com/camptocamp/puppet-mysql Is there a neat way to do something like this service{"openca": ....... requires => [Package["openca"],mysql::database["openca"]], } I already tried doing this, and also tried dependency chaining, but just can''t get it to work at all. Another option might be: class openca { define openca-database($db_name){ mysql::database{$db_name: ensure => present } } define openca-server($db_name , etc ) { openca::openca-database($db_name) } But that will not fix the dependency issue either. Can someone please point either where to look for a clue (yeah in the manual, but where?) or give me some advice regarding this? Cheers, Boudewijn Ector -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Wil Cooley
2012-Apr-17 05:14 UTC
[Puppet Users] Re: Requiring defines from other classes in a fact
On Apr 16, 2:39 pm, Boudewijn Ector <boudew...@boudewijnector.nl> wrote:> Very very simple, except for the fact that I want to add the > dependency for the mysql::database too. I''m using this excellent > module for managing mysql:https://github.com/camptocamp/puppet-mysql > > Is there a neat way to do something like this > > service{"openca": > ....... > requires => [Package["openca"],mysql::database["openca"]], > } > > I already tried doing this, and also tried dependency chaining, but > just can''t get it to work at all.You''ve almost got it here; you need to use reference syntax for the mysql::database resource just like you do for the package: requires => [Package["openca"],Mysql::Database["openca"]], Wil -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Boudewijn Ector
2012-Apr-17 12:02 UTC
Re: [Puppet Users] Re: Requiring defines from other classes in a fact
On 04/17/2012 07:14 AM, Wil Cooley wrote:> On Apr 16, 2:39 pm, Boudewijn Ector <boudew...@boudewijnector.nl> > wrote: > >> Very very simple, except for the fact that I want to add the >> dependency for the mysql::database too. I''m using this excellent >> module for managing mysql:https://github.com/camptocamp/puppet-mysql >> >> Is there a neat way to do something like this >> >> service{"openca": >> ....... >> requires => [Package["openca"],mysql::database["openca"]], >> } >> >> I already tried doing this, and also tried dependency chaining, but >> just can''t get it to work at all. > You''ve almost got it here; you need to use reference syntax for the > mysql::database resource just like you do for the package: > > requires => [Package["openca"],Mysql::Database["openca"]], > > Wil >Hi Wil, That worked pretty well. Should have tried that, but it was already pretty late ;-). Thanks! Boudewijn -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.