小编dev*_*a.y的帖子

您将如何使用 Hashicorp 的 Nomad '模板节' 通过 Nomad 作业文件生成 nginx 配置文件?

假设 Consul 和 Nomad 已配置为在资源池上运行。您将如何仅出于生成 Nginx 'default.conf' 文件的目的而呈现模板文件。

以下面的模板节配置为例;Nomad 无法生成 default.conf '文件';而是创建了一个 default.conf '目录'。

template {
    source        = "/path/to/tmp.ctmpl"
    destination   = "folder/default.conf"
    change_mode   = "restart"
    change_signal = "SIGINT"
}
Run Code Online (Sandbox Code Playgroud)

我要么错过了一个技巧,要么误解了“模板节”的功能。

模板生成目录而不是文件的问题之一是,您无法将目录挂载到配置文件路径。因此,运行使用 Nomad docker 驱动程序和示例“docker”卷配置的任务会导致错误。

volumes = ["/path/to/job/folder/default.conf:/etc/nginx/conf.d/default.conf" ]
Run Code Online (Sandbox Code Playgroud)

还是不可能让模板节生成配置文件?

*Ps 使用 Nomad 构建 0.5.5 **

nginx docker consul consul-template nomad

3
推荐指数
1
解决办法
7245
查看次数

标签 统计

consul ×1

consul-template ×1

docker ×1

nginx ×1

nomad ×1