I have a YAML file that has default value for two dict defined as follows:

sample:
  high:
    name: high-volume
    alias: hi-vl

hi-vl:
  ab1:    
    add:
      range: 0
      range1: 0
    remove:
      range: -1
      range1: -1

To 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 value instead of value.alias in the set 
statement the iteration works fine.

I tried using filters like to_yaml, tojson but they convert to string and 
not render as dict.

Has anyone faced this issue?


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4acb191e-b5f6-4108-8ab6-11154e161e09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to