Hi,

I am wondering if it possible to do this kind of form in a playbook. I know 
how to do it in a template:

If I have some  data of the form:
mydict:
  - entry1:
      data: xyzzy
      filename: scroll.txt
  - entry2:
       data: boom
       filename: sound.txt

things:
  - entry1
  - entry2

In a template, I can to do this:
{% for item in things %}
data = {{ mydict[item]['data'] }}
filename = {{ mydict[item]['filename'] }}
{% endfor %}

What I want to do is in a role task is
- name test copy from variable
  copy:
    content: "{{ mydict[item]['data'] }}
    dest: "{{ target_dir }}/{{ mydict[item]['filename'] }}'
  with_items: things

I can't seem to find the right way to get this to work in a playbook. All 
my attempts with dots and brackets have failed.
Can someone explain how to represent this in a playbook?

thanks in advance,
jerry

-- 
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/edc011dd-47be-46a1-932b-01d9e6c2c327%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to