{% for dist, items in pillar['tlu-harvester']['images'].items() %} {% for item in items %} {% set filename = item['url'].split('/')[-1] %} Downloading image {{ filename }}: file.managed: - name: /srv/www/htdocs/images/{{ dist }}/{{ filename }} - source: {{ item['url'] }} - source_hash: {{ item['checksum'] }} - user: root - group: root - mode: "0644" - makedirs: True - dir_mode: "0755" {% endfor %} {% endfor %}