sample:
high:
name: high-volume
alias: hi-vl
hi-vl:
ab1:
add:
range: 0
range1: 0
remove:
range: -1
range1: -1To iterate and get the values from jinja2 template i am using the code below:
{% for key, value in sample.iteritems() %} {% set al = value.alias %} {% for key1, value1 in al.iteritems() %}When I execute this template to generate the YAML file I get the error:
"msg": "AnsibleUndefinedVariable: 'unicode object' has no attribute 'iteritems'"}The set variable is changing the variable as unicode.
If I substitute the direct
valueinstead ofvalue.aliasin the set statement the iteration works fine.I tried using filters like
to_yaml,tojsonbut they convert to string and not render as dict.Has anyone faced this issue?