Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.75 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. define apache2::module($ensure = present) {
  2.   case $ensure {
  3.     present: {
  4.       exec { "Enable Apache module $name":
  5.         command => "/usr/sbin/a2enmod $name",
  6.        }
  7.      }
  8.      absent: {
  9.        exec { "Disable Apache module $name":
  10.          command => "/usr/sbin/a2dismod $name",
  11.        }
  12.      }
  13.      default: {
  14.        fail "Invalid 'ensure' value '$ensure' for apache2::module"
  15.      }
  16.    }
  17. }
  18.  
  19. # Fails with:
  20. # err: //Apache2::Module[php5]/Exec[Enable Apache module php5]/returns: change from notrun to 0 failed:
  21. apache2::module { "php5": }
  22.  
  23. # Works:
  24. # notice: //Exec[global scope: Enable Apache module php5]/returns: executed successfully
  25. exec { "global scope: Enable Apache module php5":
  26.   command => "/usr/sbin/a2enmod php5",
  27. }