2011-10-14 50 views
1

我是Puppet世界的新手。我有Ubuntu 11.04(64位)服務器和客戶端。我已經安裝了最新版本的puppet服務器和客戶端。 Puppet配置成功運行。我能夠從我的客戶端連接到服務器。在Ubuntu上運行木偶的食譜11.04

我想寫一個配方來在我的客戶端上安裝Apache2。任何人都可以告訴我一個木偶配方的鏈接或一步一步的創建過程來在我的客戶端上安裝Apache2嗎?如何運行以及在哪裏運行這些食譜?

我在哪裏可以看到錯誤文件?我如何知道我的食譜工作正常?

的init.pp文件

file {"password": 
    name=>"/etc/passwd", 
    owner =>"root", 
    group =>"bin", 
    mode=>644, 
} 

class apache{ 
    package { httpd: ensure => installed } 
    service{ "httpd" : 
     name => $operatingsystem ?{ 
        debian=>"apache2", 
        redhat=>"httpd", 
        default =>"apache", 
        CentOS=>"httpd", 
       }, 
     ensure=> running, 
     require=>Package["httpd"], 
    } 
} 

node 'myclientname'{ 
    include apache 
} 

# All of the nodes that don't have definitions associated with the will use 
# the following node definition. 
node default { 
    case $operatingsystem { 
     CentOS: { include apache } 
     default: {} 
    } 
} 
+0

你到目前爲止嘗試過什麼?在http://askubuntu.com上問你可能會有更多的運氣。 –

+0

我已經寫在服務器上的init.pp。由puppet運行應用--verbose init.pp --noop。我的客戶端沒有安裝apache。我正在獲取信息:應用配置版本'1318681308'通知:/ Stage [main] // File [password]/group:是root,應該是bin(noop)。我應該怎麼做以及在哪裏檢查conf是寫或錯的。在哪裏看日誌。 – keyur

+0

myinit.pp--文件{「password」:02name =>「/ etc/passwd」,03 owner =>「root」,04 group =>「bin」,05 mode => 644,06} 08class apache {09 10 package {httpd:ensure => installed} 11 12 service {「httpd」:13 14name => $ operatingsystem?{15 debian =>「apache2」,16 redhat =>「httpd」,17 default =>「apache」, 18CentOS =>「httpd」,19},20ensure =>運行,21 require => Package [「httpd」],22} 23} 2425節點'myclientname'{26包括apache 27} 28#Allothernodestheydon'thavedefinitions with the will使用以下節點定義。 2930node default {31 case $ operatingsystem {32CentOS:{includeapache} 33默認值:{} 34} 35} – keyur

回答

0

的消息告訴你已經有一個/ etc/password文件是誰的組是根,而不是倉。由於/ etc/password文件與安裝apache沒有任何關係,所以我建議刪除整個文件塊。

你可能想看看其他的事情:

  • 的Apache包名稱會根據操作系統的改變,因此它贏得了;噸永遠是「httpd的」
  • 您可能希望在你的服務中包含一個「enable => true」,這樣apache將在啓動時啓動。