{% 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'] }} {% if 'checksum' in item -%} - source_hash: {{ item['checksum'] }} {% endif %} - user: root - group: root - mode: "0644" - makedirs: True - dir_mode: "0755" {% endfor %} {% endfor %}