2011-07-15 52 views
1

嗨,大家好,我是傀儡新手,我想在客戶端使用puppet執行以下命令,以便在puppet客戶端上啓用快速cgi mod。 lighttpd的啓用-MOD的FastCGI在lighttpd中通過puppet啓用fastcgi mod

兩個傀儡服務器和客戶端的Ubuntu機器和我的lighttpd模塊的init.pp文件如下:

class lighttpd::install { 
package { "lighttpd": 
ensure => present, 
} 
} 

class lighttpd::conf { 
file { "/etc/lighttpd/lighttpd.conf": 
    ensure => present, 
    owner => 'root', 
    group => 'root', 
    mode => 0600, 
    source => "puppet:///modules/lighttpd/lighttpd.conf", 
    require => Class["lighttpd::install"], 
    } 
} 


class lighttpd::fastcgi { 
file { "/etc/lighttpd/conf-available/10-fastcgi.conf": 
    ensure => present, 
    owner => 'root', 
    group => 'root', 
    mode => 0600, 
    source => "puppet:///modules/lighttpd/10-fastcgi.conf", 
    require => Class["lighttpd::install"], 
    } 

} 

class lighttpd { 
include lighttpd::install, lighttpd::conf, lighttpd::fastcgi 

}

請幫我在執行這個命令傀儡客戶。

感謝

回答

1

因此,如果您修改lighttpd的FastCGI的::類是這樣的:

class lighttpd::fastcgi { 
    file { "/etc/lighttpd/conf-available/10-fastcgi.conf": 
    ensure => present, 
    owner => 'root', 
    group => 'root', 
    mode => 0600, 
    source => "puppet:///modules/lighttpd/10-fastcgi.conf", 
    require => Class["lighttpd::install"], 
    notify => Exec["enable-mod-fastcgi"], 
    } 
    exec { "enable-mod-fastcgi": 
    command => "/usr/bin/lighttpd-enable-mod fastcgi", 
    refreshonly => true, 
    } 
} 

(對不起 - 路徑可能是錯誤的lighttpd的啓用-MOD - 我不知道在這裏有lighttpd)。

這應該正確地通知'exec'。由於'refreshonly'參數爲true,因此只有在通知時纔會調用exec。