2014-10-07 53 views
0

我是一名木偶新手。我試圖設置一個廚師式的部署環境。我設置了一個puppet-master服務器,我希望能夠配置/部署到我同時設置的兩個節點。進口陳述失敗

我現在用我的木偶設置期望的是我的兩臺服務器(稱爲img01和img02)自動創建一個名爲/tmp/test_file.txt的文件。

我甚至不知道如何真正「加載」清單。我只是假設site.pp中的任何內容都會自動加載,但似乎並非如此。當我運行「傀儡適用/etc/puppet/manifests/site.pp」,我得到如下:

Error: Could not parse for environment production: No file(s) found for import of 'test' at /etc/puppet/manifests/site.pp:3 on node puppet.lgwp.com 
Error: Could not parse for environment production: No file(s) found for import of 'test' at /etc/puppet/manifests/site.pp:3 on node puppet.lgwp.com 

這是我的清單設置看起來像現在:在

證書列表木偶主服務器:

+ "img01.lgwp.com.com" (SHA256) (omitted) 
+ "img02.lgwp.com" (SHA256) (omitted) 
+ "puppet.lgwp.com" (SHA256) (omitted) (alt names: "DNS:puppet.lgwp.com") 

/etc/puppet/manifest/site.pp:

import "test" 

import "nodes" 

Exec { path => "/usr/bin:/usr/sbin/:/bin:/sbin" } 

/etc/puppet/manifest/nodes.pp:

import "test" 

node "imageserver" { 
    include "tempfile" 
} 

node 'img01.lgwp.com' inherits imageserver { 
} 
node 'img02.lgwp.com' inherits imageserver { 
} 

/etc/puppet/modules/test/manifests/test.pp:

class test { 

    package { test: ensure => latest } 

    file { "test_file": 
    path => '/tmp/test_file.txt', 
    ensure => present, 
    mode => 0755, 
    content => 'hola world', 
    source => "puppet:///modules/test/test_file", 
    require => Package["test"], 
    } 
} 

回答

1

別t使用導入。不要。

刪除現有的import報表和改變你的puppet.conf設置manifest包括在/etc/puppet/manifests的所有文件。

[main] 
manifest=/etc/puppet/manifests/ 

include tempfile是沒有意義或者,除非你有一個tempfile模塊。嘗試

include test 

test模塊中的其他類應該被命名爲test::something,也只是被包括在內。 Puppet在相應的模塊中查找清單。幾乎不需要使用import了。