0
这似乎是一个错误。但在将问题发布到安全的github项目之前,我在这里问。查找模块无法使用regex_replace过滤器计算模板的值
剧本:
- hosts: localhost
tasks:
- template: >
dest=/tmp/test.xml
src=test.xml.j2
- debug: msg="{{ lookup('template', 'test.xml.j2') }}"
vars:
- command: 'echo "word1 word2"'
test.xml.j2
<command>ssh {{ command| regex_replace('"(.*)"', '"\\"\1\\""') }} #1</command>
<command>ssh {{ command| regex_replace('"(.*)"', '"\\"\\1\\""') }} #2</command>
测试命令
ansible-playbook test.yml -D -C
预期的结果:在这两个任务
实际结果相同的结果( ansible 2 .3.1.0):
- 逸出一次时,模板模块无法显示第一参考
- 逸出两次时,查找模块无法提领第二参考