首页 > 解决方案 > 将json文件分配给循环jinja2 ansible内的变量

问题描述

我正在尝试使用 --set-string 将 json 文件分配给 ansible 循环内的变量,然后运行 ​​helm upgrade 命令。但它给了 -

此命令需要 2 个参数:版本名称、图表路径\n错误:插件 \"tiller\" exited with error" 错误。

  {% for file in v.value.files %}
  --set-string config[{{ loopOut.index0 }}].files[{{ loop.index0 }}].name={{ file }}
  {% set args = args|combine(v.value.args) %}
  --set-string config[{{ loopOut.index0 }}].files[{{ loop.index0 }}].value=
  {{ lookup('file','../files/initData.json')| from_json }}
  {% endfor %}

其中 loopOut 是外部循环变量,其中我有这个当前循环。我在这里做错了什么?我什至试着把

 "{{ lookup('file','../files/initData.json')| from_json }}" in quotes

但这也无济于事。

标签: ansiblejinja2kubernetes-helmjinja2-cli

解决方案


推荐阅读