厨师中的节点特定属性

Node specific attributes in chef

我是第一次设置 Chef 服务器,想知道我应该在哪里存储每个节点唯一的配置信息。例如,每个服务器都有一个包含客户端特定信息的应用程序,但每个服务器的信息都不同。我需要一个看起来像这样的映射:

node1 : application1 : client1,client2,client3
node2 : application1 : client3,client5,client9
node3 : application1 : client1,client7,client8

提前致谢。

您可以将此信息放在节点配置本身中。

因此,在 nodes/node1-hostname.json 中,您将拥有:

{
    "application1": {
        "clients": ["client1", "client2", "client3"],
    },
    "run_list": [
        "recipe[webserver]",
        "recipe[your_recipe]"
    ]
}

然后在 nodes/node2-hostname.jsonnodes/node3-hostname.json 里面你会有他们特定的配置。