>From what I've seen in other modules, the more common way is to do
something like this:

class php {
   case $::operatingsystem {
        'Gentoo': {
                include php::gentoo
        }
        /(RedHat|CentOS)/: {
                include php::redhat
        }
}

And then implement the correct packages and files inside those
subclasses. You can still have a class called php::fpm which then
configures fpm, it would have class parameters for the specific file
paths that change per OS for instance.

good luck,

Walter

On Fri, Mar 30, 2012 at 00:29, Matthias Saou <[email protected]> wrote:
> Hi,
>
> Before making any further changes to my existing PHP module, I'd like
> to get a few recommendations from anyone who has already faced this
> problem...
>
> My existing module supports Fedora, RHEL and clones. I'd like to extend
> support to more distributions, by adding a typical "params" class to it.
>
> So far, so good. I've already done it for other modules.
>
> *BUT* in the case of PHP, file locations, file splitting and package
> splitting can be extremely different from one distro to the next.
>
> For instance, in the case of Fedora/RHEL we have :
>  * Packages : php-cli, php-fpm, php (for mod_php)
>  * Configurations : /etc/php.ini, /etc/php.d/, /etc/php-fpm.conf,
>   /etc/php-fpm.d/
>
> Now in the case of Gentoo (don't ask) :
>  * Package : dev-lang/php (only this one for everything)
>  * Configurations : *lots* such as these :
>   /etc/php/cli-php${php_version}/php.ini
>   /etc/php/fpm-php${php_version}/php.ini
>   /etc/php/fpm-php${php_version}/php-fpm.conf
>   /etc/php/fpm-php${php_version}/ext/
>   /etc/php/fpm-php${php_version}/ext-active/
>
> I want to keep my module very flexible : Install only CLI, only FPM,
> only Apache httpd module or any combination of those three.
>
> The first problem I'm facing is with package requirements, where even
> with virtual resources I'm in a dead end. Not to mention wanting to
> support "ensure => absent" on any of CLI/FPM/mod when there's a single
> package for all three will no longer be easy.
>
> Right now, I'm going this way :
>    # packages
>    case $::operatingsystem {
>        'Gentoo': {
>            @package { 'dev-lang/php': ensure => installed }
>            $package_cli = 'dev-lang/php'
>            $package_fpm = 'dev-lang/php'
>        }
>        /(RedHat|CentOS)/: {
>            @package { 'php-cli': ensure => installed }
>            @package { 'php-fpm': ensure => installed }
>            $package_cli = 'php-cli'
>            $package_fpm = 'php-fpm'
>        }
>    }
>
> Then I'll be realizing $package_<x> where relevant. Is there any better
> way to do this?
>
> Cheers,
> Matthias
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 
Walter Heck

--
follow @walterheck on twitter to see what I'm up to!
--
Check out my new startup: Server Monitoring as a Service @ http://tribily.com
Follow @tribily on Twitter and/or 'Like' our Facebook page at
http://www.facebook.com/tribily

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to