How to divide prometheus.yml file in parts?

PRS asked:

I am using Prometheus for our monitoring and I have a lot of configs (our prometheus.yml main config file is 8000+ lines long).

I would like to divide this out into logical groupings so that it becomes much readable. I came to know that Prometheus doesn’t support this and we can use configuration management systems like Ansible.

Has anyone done this with their Prometheus config file using Ansible or any other way? If so, how did you do it?

My answer:


Ansible doesn’t have a built in module for modifying YAML files. But you can use something like kwoodson.yedit to make any desired changes to the configuration file.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.