Report abuse

class apache2::upload inherits apache2::mpm-prefork {

        // lots of stuff

        Service["apache2"] { subscribe +> Exec["codesync-upload"] }
}

class apache2::storagegateway inherits apache2::mpm-prefork {

        // lots of stuff

        Service["apache2"] { subscribe +> Exec["codesync-storagegateway"] }
}

class apache2::mpm-prefork inherits apache2::server {

    ###############################
    ###### PACKAGES REQUIRED ######
        package { apache2-mpm-prefork: ensure => latest }

}

class apache2::server {

        ###############################
        ###### PACKAGES REQUIRED ######
        package { "apache2.2-common": ensure => latest }
        package { "apachetop": ensure => latest }

        service { "apache2":
                enable => true,
                ensure => running,
                hasstatus => true,
                hasrestart => true,
                require => Package["apache2.2-common"]
        }

        // lots of stuff
}


class mycompany::common {

        define codesync()
        {
                exec { "codesync-$name":
                        command => "/usr/sbin/codesync -s -a $name",
                        creates => "/etc/codesync.d/$name",
                        require => [ Package["codesync"], User["core"], Class['php5::cli'] ];
                }
        }
}

class mycompany::storagegateway inherits mycompany::common {

        codesync {"storagegateway":}

}