0

我正在使用 Ansibleuri模块发送 REST API 查询。正文内容是从文件中提取的:

body: "{{ lookup('file',mp_config_path + item.file) }}"

我的文件中有一些变量 - 是否可以告诉 ansible 在将其发送到uri模块之前对其运行 Jinja2 过滤器?

4

1 回答 1

2

以及如何使用template查找

body: "{{ lookup('template',mp_config_path + item.file) }}"

或者:

- uri:
    body: "{{ item }}"
    # other parameters
  with_template: "{{ mp_config_path + item.file }}"
于 2017-01-18T10:39:43.993 回答