是否有可能强迫函数to_nice_yaml避免生成别名?
Ansible模板中的下一行
scrape_configs:
{{ scrape_configs | to_nice_yaml(indent=2) | indent(2,False) }}哪里
common_relabeling:
- stuff1
- stuff2
scrape_configs:
- job_name: process_exporter
relabel_configs: "{{ common_relabeling }}"
- job_name: node_exporter
relabel_configs: "{{ common_relabeling }}"使用别名(见下文)在YAML文件中展开,我不确定Prometheus的配置解析器是否支持它。显然,我想在没有硬编码的情况下修复每个条目中的common_relabeling。
scrape_configs:
- job_name: process_exporter
relabel_configs: &id001
- stuff1
- stuff2
- job_name: node_exporter
relabel_configs: *id001发布于 2019-01-10 19:08:21
你可以把锚和别名留在原处。
Prometheus使用包gopkg.in/yaml.v2,如果您阅读该包的文档,您将看到它是基于libyaml的,它已经解析锚和别名十多年了。gopkg.in/yaml.v2的文档显式地声明锚是支持的
yaml包支持大多数YAML 1.1和1.2,包括对锚、标签的支持.
https://stackoverflow.com/questions/54132925
复制相似问题