puppet apply错误:找不到默认节点或名称为';uys0115';在节点uys0115上

puppet apply错误:找不到默认节点或名称为';uys0115';在节点uys0115上,puppet,Puppet,我已经在两个节点上安装了puppet,服务器节点的主机名是“uys0115”,cient节点的主机名是“uys0119”,服务器节点已经标记了客户端节点。当我执行commad:傀儡证书列表--all时,我们可以看到: + "uys0115" (24:55:95:77:8E:60:33:77:C8:D4:74:EA:01:21:BD:5A) + "uys0119" (86:53:1B:81:E5:4F:88:23:E8:34:E1:AB:03:D4:AE:7C) puppet主目录是/etc/p

我已经在两个节点上安装了puppet,服务器节点的主机名是“uys0115”,cient节点的主机名是“uys0119”,服务器节点已经标记了客户端节点。当我执行commad:
傀儡证书列表--all
时,我们可以看到:

+ "uys0115" (24:55:95:77:8E:60:33:77:C8:D4:74:EA:01:21:BD:5A)
+ "uys0119" (86:53:1B:81:E5:4F:88:23:E8:34:E1:AB:03:D4:AE:7C)
puppet主目录是/etc/puppet/,我编写了一个示例,文件的组织如下:

/etc/puppet/--
             |-/manifests/site.pp
             |-/modules/test/--  
                              |-/files/text.txt
                              |-/manifests/init.pp
                              |-/manifests/test.pp
import "test"
node default {
        include "test1"
}
import "test"
node "uys0119" {
        include "test1"
}
/etc/puppet/modules/test/manifests/test.pp
中的代码是:

class test1 {
package { "bison":
        ensure=>"installed",
}
exec { "puppet test":
        command=>"/bin/touch /tmp/puppet-test",
}
file { "/tmp/test.txt":
        ensure => "present",
        source => "puppet:///modules/test/test.txt"
}
}
/etc/puppet/modules/test/manifests/init.pp
中的代码只是
import“*”
; 而
/etc/puppet/manifests/site.pp
中的代码如下:

/etc/puppet/--
             |-/manifests/site.pp
             |-/modules/test/--  
                              |-/files/text.txt
                              |-/manifests/init.pp
                              |-/manifests/test.pp
import "test"
node default {
        include "test1"
}
import "test"
node "uys0119" {
        include "test1"
}
当我在客户端节点uys0119中执行命令
puppet-agent--test--server uys0115
时。 它成功执行并在目录/tmp/中创建了两个文件puppet test和test.txt。 在服务器节点中,当我执行命令
puppet apply site.pp
时,它也成功执行并创建了两个文件。但是,终端发出两条警告信息:

warning: Could not retrieve fact fqdn
warning: Host is missing hostname and/or domain: uys0115
warning: Could not retrieve fact fqdn
warning: Host is missing hostname and/or domain: uys0115
warning: Host is missing hostname and/or domain: uys0115
Could not find default node or by name with 'uys0115' on node uys0115
当我在
/etc/puppet/manifests/site.pp
中更改代码时,如下所示:

/etc/puppet/--
             |-/manifests/site.pp
             |-/modules/test/--  
                              |-/files/text.txt
                              |-/manifests/init.pp
                              |-/manifests/test.pp
import "test"
node default {
        include "test1"
}
import "test"
node "uys0119" {
        include "test1"
}
并在服务器节点中执行命令
puppet apply site.pp
,输出错误消息失败:

warning: Could not retrieve fact fqdn
warning: Host is missing hostname and/or domain: uys0115
warning: Could not retrieve fact fqdn
warning: Host is missing hostname and/or domain: uys0115
warning: Host is missing hostname and/or domain: uys0115
Could not find default node or by name with 'uys0115' on node uys0115
但是客户端节点也可以成功地执行命令
puppet-agent--test--server uys0115
。有人能解释一下吗?
如果我希望服务器节点向客户端节点发送一些拒绝,并驱动一些客户端节点响应服务器并产生结果。使用木偶时我该怎么做?谁能给我举个例子吗?非常感谢

服务器傀儡同时充当傀儡主节点和傀儡节点

当您按如下方式编辑site.pp时:

import "test"
node default {
    include "test1"
}
连接到puppet master的所有puppet节点将执行类“test1”中定义的操作。因此,您在
uys0115
uys0119
中找到了两个文件(将其视为傀儡节点)

将site.pp更改为以下内容时:

import "test"
node "uys0119" {
        include "test1"
}
puppet节点
uys0115
在site.pp中找不到其定义(因为它只定义
uys0119
),puppet主机输出错误信息如下:

Could not find default node or by name with 'uys0115' on node uys0115
这是一个修改过的站点。pp可以消除此错误:

import "test"
node "uys0119" {
        include "test1"
}
node "uys0115" {
        include "test1"
}
在puppet主/从模式下,您最好使用fqdn,例如
uys0115.localdomain
,那么以下警告将不会显示

warning: Host is missing hostname and/or domain: uys0115