Hi, I have a little trickky thing i wanted to do with puppet, mainly this is configuring web host on servers. I have a tree like this : NODE - WEB -APACHE - 1.x - 2.x - FTP - VSFTP - PROFTPD - STATS -AWSTATS - if FTP then configure awstats for awstats - URCHIN5 So my issue is that i want to be able to have defines like createvirtualhost createftpuser and that it is called like this creatvevirtualhost( blah, blah,...) and that it automaticaly use the define for the node (if i defined include apache2 in my node then it is apache2 version of the define...). I also want that the createvirtualhost define can know that this node also has STATS and that awstats is used so it can configure it with the vhost. I turn round and round and i cannot find a way to have this hierarchy working. I have to call apache2::createvirtualhost and not createvirtualhost. So this make my define tied to the webserver used and not ''free'' of it. I know this is kind of complicated but i feel like this can be done but i cannot find a clean way. Is that sounding like it could/should be a bunch of custom type and not a recipe ? -- Cordialement, Ghislain _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Jun 5, 2007, at 8:30 AM, ADNET Ghislain wrote:> [...] > I turn round and round and i cannot find a way to have this > hierarchy working. I have to call apache2::createvirtualhost and > not createvirtualhost. So this make my define tied to the webserver > used and not ''free'' of it. I know this is kind of complicated but > i feel like this can be done but i cannot find a clean way. Is > that sounding like it could/should be a bunch of custom type and > not a recipe ?The best way to do this is with native types and different providers (e.g., vsftp vs proftpd). Otherwise, you could write a single ''virtual_host'' defined type that swtiched based on ''provider''. E.g.: define virtual_host($ip, $docroot, $provider = apache2) { case $provider { apache2: { apache2::virtual_host { $name: ip => $ip, ... } ... } } Also, it''s a better idea to name your types something like ''virtualhost'', rather than ''createvirtualhost'', because they do more than create the hosts, they can modify and delete them. -- Trying to determine what is going on in the world by reading newspapers is like trying to tell the time by watching the second hand of a clock. --Ben Hecht --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
> The best way to do this is with native types and different providers > (e.g., vsftp vs proftpd). > >ok so i will have to make a try ! But i still wonder how the type webserver for exemple will know that there is a type stats that exist and configure the stats for this package or vice versa. The pupppet language is easy and i wonder how i will be able to use templates or directory purging like i done in my shorewall recipe in a custom type. ok i go to the site to search for this :)> Otherwise, you could write a single ''virtual_host'' defined type that > swtiched based on ''provider''. E.g.: > > define virtual_host($ip, $docroot, $provider = apache2) { > case $provider { > apache2: { apache2::virtual_host { $name: ip => $ip, ... } > ... > } > } > >this will tend to make a huge spagetti code and i wanted to prevent the case case case of case statement, my feeling is that it will become impossible to manage over time but i can be wrong. I will try to see which is easier for me ! :)> Also, it''s a better idea to name your types something like > ''virtualhost'', rather than ''createvirtualhost'', because they do more > than create the hosts, they can modify and delete them. > >yes good catch. Thanks again for your help ! -- Cordialement, Ghislain ADNET. AQUEOS. Attention ! Toute demande de support ou commande de domaine par email sera refusée, pour cela utilisez https://support.aqueos.net. Pour tout contact nos coordonnées : http://www.aqueos.com/aqueos-services-informatiques-societe.php Fax: 01.72.70.32.66 _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Jun 6, 2007, at 1:41 AM, ADNET Ghislain wrote:> >> The best way to do this is with native types and different >> providers (e.g., vsftp vs proftpd). >> >> > ok so i will have to make a try ! But i still wonder how the type > webserver for exemple will know that there is a type stats that > exist and configure the stats for this package or vice versa. The > pupppet language is easy and i wonder how i will be able to use > templates or directory purging like i done in my shorewall recipe > in a custom type. ok i go to the site to search for this :)I''m not sure exactly what you mean here. You''d probably use static templates for generating files, but I''m not sure.>> Otherwise, you could write a single ''virtual_host'' defined type >> that swtiched based on ''provider''. E.g.: >> >> define virtual_host($ip, $docroot, $provider = apache2) { >> case $provider { >> apache2: { apache2::virtual_host { $name: ip => $ip, ... } >> ... >> } >> } >> >> > this will tend to make a huge spagetti code and i wanted to prevent > the case case case of case statement, my feeling is that it will > become impossible to manage over time but i can be wrong. I will > try to see which is easier for me ! :)It''s certainly not what I''d call the cleanest. It''d be nice to have some simple way to make defined types with providers and make them as functional as native types, but I haven''t been able to come up with one. -- True Terror is to wake up one morning and discover that your high school class is running the country. -- Kurt Vonnegut --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com