1

Now I know that consul-template can manage config file content when there's a change in k/v of consul, but what about create one? For example, a system has many users, and each user has his own config file, will consul-template able to create one config file for each user? If their config files share the same template.

Allen Jz
  • 101
  • 2
  • 9

1 Answers1

0

consul-template can use a config source, for example consul-template.json:

...
template {
  source      = "/usr/local/app/etc/backends.cfg.ctmpl"
  destination = "/usr/local/app/etc/backends.cfg"
  command     = "chown app_owner:app_group /usr/local/app/etc/backends.cfg && systemctl reload service"
}

template {
  source      = "/usr/local/app/etc/frontends.cfg.ctmpl"
  destination = "/usr/local/app/etc/frontends.cfg"
  command     = "chown app_owner:app_group /usr/local/app/etc/frontends.cfg && systemctl reload service"
}
...

so you could create one consul-template config to manage the config of another consul template, at least in theory.