-
What is the best/supposed way to generate configs for things like prometheus with iteration over hosts from inventory? Is any builtin templating (go text/template?) planned? It's possible to use external templating like https://github.com/kblomqvist/yasha (jinja2), but it's unclear how to connect it with data from inventory and exported variables |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
I don't understand the question. What exactly "prometheus with iteration over hosts from inventory" means? Can you explain the use case in more details, i.e., what is the problem you are trying to resolve? I guess this is about the playbook, what does something with pormetheus, but it is unclear to me what exactly it supposes to do (deploy promethesus? Use promethesus API to build inventory. React on prometheus's event in some way?) The "iteration over inventory" part is also confusing. In order to run a playbook for multiple hosts from inventory you can pass/set inventory group or tag, no need to generate anything for such iteration, except the inventory. |
Beta Was this translation helpful? Give feedback.
-
Ansible is used a lot to generate configs with it's jinjia templating. Example block form prometheus config:
Common practice is generate
It's ok to use precreated config on the local side, but the list of servers to generate the list should be taken from inventory. How to deal with those scenarios with |
Beta Was this translation helpful? Give feedback.
-
I understand what it does but need to understand why and how this would be useful in spot. To me, the list of hosts is the property of an inventory file rather than something that should be generated. If we need to run a playbook against all the servers in "production" group or on all servers tagged as "production" we can set In your example, all the template does is add the port to all the hosts in that "production" group. I struggle to see what the reason for doing it; in my view, this is something that inventory should be handling, i.e. if a custom (non-22) ssh port should be set, this has to be in the inventory or passed in as a direct list of targets. Theoretically, support of the templates can be added, however, this is a pretty complex thing from the user's point of view, and we need very compelling reasons to add it to the spot. The fact that ansible does templates is not a good enough reason by itself, our goal is not to repeat all the ansible's features. |
Beta Was this translation helpful? Give feedback.
-
see #105 |
Beta Was this translation helpful? Give feedback.
You can do it without running the spot twice. It can be done with a "local" command invoking the spot generator, i.e.