Hi, What is the best way for you to simulate a provider behavior in modules ? For exemple if you have an webserver module and want to have a apache2, lighthttpd prividers. How would you do so the call to the modules functions stay like: webserver::addvhost { ... } and not webserver::apache2::addvhost Any best practices you can share ? I know that conditional include would not work so... :) -- Cordialement, Ghislain _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Dec 21, 2007, at 11:16 AM, ADNET Ghislain wrote:> Hi, > > What is the best way for you to simulate a provider behavior in > modules ? For exemple if you have an webserver module and want to > have a apache2, lighthttpd prividers. How would you do so the call > to the modules functions stay like: > > > webserver::addvhost { ... } > > and not > > webserver::apache2::addvhost > > > Any best practices you can share ? I know that conditional include > would not work so... :)Conditional include doesn''t work, but conditional evaluation works fine. include "webserver::$provider" -- The most overlooked advantage to owning a computer is that if they foul up there''s no law against wacking them around a little. -- Joe Martin --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Hi, What is the best way for you to simulate a provider behavior in modules ? For exemple if you have an webserver module and want to have a apache2, lighthttpd prividers. How would you do so the call to the modules functions stay like: webserver::addvhost { ... } and not webserver::apache2::addvhost Any best practices you can share ? I know that conditional include would not work so... :) -- Cordialement, Ghislain _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Hi, What is the best way for you to simulate a provider behavior in modules ? For exemple if you have an webserver module and want to have a apache2, lighthttpd prividers. How would you do so the call to the modules functions stay like: webserver::addvhost { ... } and not webserver::apache2::addvhost Any best practices you can share ? I know that conditional include would not work so... :) -- Cordialement, Ghislain _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
> Conditional include doesn''t work, but conditional evaluation works fine. > > include "webserver::$provider" >Sorry i was not right, i should use import and not include... i need two classes to have the same define. For exemple addvhost so in the case above i would have to call webserver::apache::addvhost and not webserver::addvhost { provider => apache } my exemple was bad it it better to say import "webserver::$provider" where in the provider file i have the definition of addvhost but all the files apache.pp, lighthttp.pp have the very same addvhost. You see what i mean. Is this possible ? the goal is: Webserver { provider => apache20 } webserver::addvhost{ puppet.com: alias => www.puppet.com ... } webserver::addmodule{ php4: include => [''gd'',''mbcrypt''] } and i can change Webserver{ provider =>lighhttpd } if i need the config for lighty :) Same thing for mailserver with sendmail/postfix etc.... -- Cordialement, Ghislain _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Dec 24, 2007, at 2:15 AM, ADNET Ghislain wrote:> >> Conditional include doesn''t work, but conditional evaluation works >> fine. >> >> include "webserver::$provider" >> > Sorry i was not right, i should use import and not include... > > i need two classes to have the same define. For exemple addvhost > so in > the case above i would have to call > > webserver::apache::addvhost and not > > webserver::addvhost { provider => apache } > > my exemple was bad it it better to say > > import "webserver::$provider" > > where in the provider file i have the definition of addvhost but > all the > files apache.pp, lighthttp.pp have the very same addvhost. You see > what > i mean. > > Is this possible ?Like I said, you can''t do conditional imports. Have a ''webserver::apache::addvhost'' definition and a ''webserver::lighty::addvhost'' definition, then have a ''webserver::addvhost'' definition that is a conditional on ''$provider''.> the goal is: > > Webserver { provider => apache20 } > webserver::addvhost{ puppet.com: alias => www.puppet.com ... } > webserver::addmodule{ php4: include => [''gd'',''mbcrypt''] } > > and i can change Webserver{ provider =>lighhttpd } if i need the > config > for lighty :) > Same thing for mailserver with sendmail/postfix etc....You can at least get very close to this with my above recommendation. -- Always read stuff that will make you look good if you die in the middle of it. -- P. J. O''Rourke --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com