Created
November 22, 2019 17:11
-
-
Save msaladna/bd8a5f493d4687441b8a061e61dc4023 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
gather_facts: no | |
vars: | |
subexpr: myvar | |
powerdns_driver: mysql | |
powerdns_config_file: /etc/pdns/pdns.conf | |
dict: | |
"a{{ subexpr }}-def": "C visible" | |
"myvar-b": "{{ subexpr_undef | default('foo') }}" | |
"myvar-c": >- | |
"{{ subexpr }}" | |
tasks: | |
- set_fact: | |
var2: "{{ dict | combine({}) }}" | |
- debug: msg="{{ item.key }} - {{ item.value }}" | |
loop: "{{ var2 | dict2items }}" |
My broken variation:
ok: [localhost] => (item={'key': u'myvar-c', 'value': u'"myvar"'}) =>
msg: myvar-c - "myvar"
ok: [localhost] => (item={'key': u'myvar-b', 'value': u'foo'}) =>
msg: myvar-b - foo
ok: [localhost] => (item={'key': u'a{{ subexpr }}-def', 'value': u'C visible'}) =>
msg: a{{ subexpr }}-def - C visible
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
my output: