【发布时间】:2020-01-28 12:13:51
【问题描述】:
我有一个存储在 files_path 变量中的路径列表。 这是一项任务,我试图连接变量中的路径并使用连接添加路径的其余部分。
- name: Changing supervisor files path
replace:
path: /etc/supervisor/supervisord.conf
regexp: 'files(.*)'
replace: 'files = /etc/supervisor/conf.d/*.conf {{ supervisor_files_path | join(' ')/shared/supervisor/*.conf }}
notify: restart supervisor
when: files_path is defined
我得到的错误:
fatal: [127.0.0.1]: FAILED! => {"msg": "template error while templating string: unexpected '*'. String: files = /etc/supervisor/conf.d/*.conf {{ files_path | join(' ')/shared/supervisor/*.conf }}"}
问题在于代码中的第二颗星:/shared/supervisor/*.conf
我试图使用\* 或[*] 逃脱,但得到了同样的错误。
我应该如何改变这个?
【问题讨论】:
标签: regex join ansible supervisord