Skip to content

Instantly share code, notes, and snippets.

@OleMchls
Last active December 26, 2015 18:39
Show Gist options
  • Save OleMchls/7195553 to your computer and use it in GitHub Desktop.
Save OleMchls/7195553 to your computer and use it in GitHub Desktop.
delme
node web-1 {
$role = 'web-app-a'
$has_apache = true;
include php5
}
node web-2 {
$role = 'web-app-b'
$has_fcgi=true
include php5
}
# has both enabled, but needs a special config
node web-3 {
$role = 'web-app-c'
$has_fcgi=true
$has_apache=true
include php5
}
class php5 {
if ($::has_fcgi)
package { 'php5-cli' : ensure => installed }
}
if ($::has_apache) {
package { 'php5-apache' : ensure => installed }
}
if ($::role == 'web-app-c')
package { 'php5-web-app-c-special-module' }
file { '/etc/php5/php.ini' :
source => 'puppet:///modules/php5/php.ini-web-app-c'
}
}
}
class php5(
$has_fcgi = false,
$has_apache = false,
$role = undef
) {
if ($has_fcgi)
package { 'php5-cli' : ensure => installed }
}
if ($has_apache) {
package { 'php5-apache' : ensure => installed }
}
if ($role == 'web-app-c') {
package { 'php5-web-app-c-special-module' }
file { '/etc/php5/php.ini' :
source => 'puppet:///modules/php5/php.ini-web-app-c'
}
}
}
node 'web-1' {
$role = 'web-app-a'
$has_apache = true
class { 'php5' :
has_apache => true,
role => $role
}
}
node 'web-2' {
$role = 'web-app-b'
$has_fcgi = true
class { 'php5' :
has_fcgi => true,
role => $role
}
}
node 'web-1' {
$role = 'web-app-a'
$has_apache = true
class { 'php5' :
has_apache => true,
role => $role
}
}
node 'web-2' {
$role = 'web-app-b'
$has_fcgi = true
class { 'php5' :
has_fcgi => true,
role => $role
}
}
if ($role == 'web-app-c') {
package { 'php5-web-app-c-special-module' }
file { '/etc/php5/php.ini' :
source => 'puppet:///modules/php5/php.ini-web-app-c'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment