【发布时间】:2020-12-31 20:39:36
【问题描述】:
这是盐config.sls
{% set testval = ["172.16.49.169:5044", "172.16.51.156:5044"] %}
filebeat_config:
file.managed:
- name: /etc/filebeat/filebeat.yml
- source: salt://filebeat/files/filebeat.yml.tmpl
- template: jinja
- user: root
- mode: 600
- context:
logstash_hosts: {{ testval }}
渲染后,主机条目如下所示:
hosts: [u'172.16.49.169:5044', u'172.16.51.156:5044']
如何删除每个字符串前的 u'?
我试过{{ testval|tojson }}、{{ testval|json }}和- encoding: ascii/utf-8
【问题讨论】:
-
你能用
filebeat.yml.tmpl模板中的相关内容更新问题吗?
标签: salt-stack