相关疑难解决方法(0)

在 Puppet 中将一段文本添加到 /etc/hosts 文件的最佳方式是什么?

我还想保留手动编辑主机文件的能力,至少前 10 行。

#Public IP's - eth0
192.168.1.103   front-01
192.168.1.106   front-02

#Private IP's - eth1
192.169.40.201  priv0-0
192.169.40.202  priv0-1
192.169.40.207  priv1-0
192.169.40.208  priv1-1

#Virtual IP's - eth0:1
192.169.50.202  vip-01
192.169.50.205  vip-02
Run Code Online (Sandbox Code Playgroud)

将这些主机条目放在 /etc/hosts 的底部将是完美的。做这个的最好方式是什么?有没有比编写 8 个主机行清单更好的方法?

# create a simple hostname and ip host entry
host { 'front-01':
    ip => '192.168.1.103',
}
Run Code Online (Sandbox Code Playgroud)

可能有些服务器组在其 /etc/hosts 中需要不同的 IP 的 /hostnames。我会使用模板,但这意味着人们不能再在他们的 /etc/hosts 中进行手动更改,因为他们会被模板覆盖。

puppet

8
推荐指数
1
解决办法
9387
查看次数

标签 统计

puppet ×1