Hello, I use a type i just written that install apache basicaly it is httpd and you provide the version (it is just a wrapper to the packets system) . I wanted to tell another type, the vhosts one that i required that this node defines the httpd type and that the vhosts type is allways called AFTER the httpd type. node ''mynode'' { httpd{ version => ''apache20'' } vhosts{ name => ''reductivelabs.com''} } i cannot require Httpd[''apache20''] because i don''t care about the version , i care about the type being there. How can i ask this ? -- Cordialement, Ghislain _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday 11 December 2006 14:13, Adnet Ghislain wrote:> Hello, > > I use a type i just written that install apache basicaly it is httpd > and you provide the version (it is just a wrapper to the packets system) > . I wanted to tell another type, the vhosts one that i required that > this node defines the httpd type and that the vhosts type is allways > called AFTER the httpd type. > > > node 'mynode' { > > httpd{ version => 'apache20' } > vhosts{ name => 'reductivelabs.com'} > } > > i cannot require Httpd['apache20'] because i don't care about the > version , i care about the type being there. How can i ask this ?use "alias => apache" in your httpd definition. Regards, David - -- - - hallo... wie gehts heute? - - *hust* gut *rotz* *keuch* - - gott sei dank kommunizieren wir über ein septisches medium ;) -- Matthias Leeb, Uni f. angewandte Kunst, 2005-02-15 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFFfWlA/Pp1N6Uzh0URAkK5AKCNfwrcHYUtevuybVctlXphkel5ygCfW2nM zXb/HVtRXZP795ps8eRWx6A=3KFf -----END PGP SIGNATURE----- _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Thanks, good idea :) so you mean: node ''mynode'' { httpd{ version => ''apache20'',alias => apache } vhosts{ name => ''reductivelabs.com'', require => Httpd[''apache'']} } ? ok that could work but i would prefer that the Types take care of themselves and that this is handled internaly by the type vhost itself. Is there a mean to have such dependancy ? Perhaps by defining a default like Httpd { alias => httpd } Vhost { require => Httpd[''httpd''] } This could be a way to move around the issue ? But again this is not included in the type itself so it makes maintenance of the type harder if someone manage to use itself a default somewhere else that would override the one i will set here :) Cordialement, Ghislain ADNET. AQUEOS.> use "alias => apache" in your httpd definition. > > > Regards, David > > - -- >_______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Dec 11, 2006, at 9:32 AM, Adnet Ghislain wrote:> Thanks, good idea :) > > so you mean: > > node ''mynode'' { > > httpd{ version => ''apache20'',alias => apache } > vhosts{ name => ''reductivelabs.com'', require => Httpd[''apache'']} > }Neither of these will actually work because you''re not specifying titles for your definitions. One of the reasons I added this restriction was to enforce the difference between classes and definitions -- classes are singletons, and definitions are meant to have many instances. This looks like httpd should be a class, since you''ll only have one of them, yet you''ll have many vhosts. As soon as I can, I''ll be adding parameters to classes so that you can configure things like the version of apache, but right now you''ll have to use variables -- e.g., set $apache_version = "20" and then call ''include http'' which uses that variable. I understand this is not ideal, but it''s the best we''ve got at the moment.> ? > > ok that could work but i would prefer that the Types take care of > themselves and that this is handled internaly by the type vhost > itself. Is there a mean to have such dependancy ? > > Perhaps by defining a default like > > > Httpd { alias => httpd } > Vhost { require => Httpd[''httpd''] } > > > This could be a way to move around the issue ? But again this is > not included in the type itself so it makes maintenance of the type > harder if someone manage to use itself a default somewhere else > that would override the one i will set here :)The whole reason that Puppet supports specifying both a name and a title for resources is to provide you with the ability to control this exactly as you want. Provide the appropriate name for the system you''re using it on, and then set a title that will be common to all of them, and always specify relationships to that title, not to the localized name. As to using defaults, the only reason that would work is that you''re incorrectly using a definition for httpd instead of a class. There''s a very common pattern to this problem -- provide an abstract title for the service, and build in the relationship to that service in your vhost definition. For instance: class httpd { ... do everything else service { apache: name => "apache$apache_version", ensure => running } } define vhost($docroot, ...) { file { "/etc/apache2/sites-available/$name": content => template ("..."), notify => Service[apache] } I use this pattern for literally every service within Puppet and it works just dandily. You now don''t have to specify the relationship with every vhost. -- I have an answering machine in my car. It says, "I''m home now. But leave a message and I''ll call when I''m out. -- Stephen Wright --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com