假设我具有以下文件的角色org.foo
:
defaults/main.yml
:
service_conf:
includes:
- "thing.conf"
main:
host: "foo.example.com"
port: 1234
# plus a whole bunch more
templates/service.conf.j2
:
{% for value in service_conf.includes %}
include '{{ value }}'
{% endfor %}
{% for key,value in service_conf.main.iteritems() %}
{{ key }} = '{{ value }}'
{% endfor %}
在某个时候我想要执行的任务:
service_conf.includes
service_conf.main
中的条目我该怎么做?
我已经像下面那样尝试过set_fact
,但是最终替换了默认值而不是对其进行了修改。
- name: adjust config
set_fact:
service_conf:
main:
host: 'app.domain.com'
port: '5678'
tls: 'yes'
when: condition = 'happened'