{% for package, args in pillar['packages'].items() %} {% if args['status'] != 'ignore' %} {{ package }}: pkg.{{ args['status'] }}: - name: {{ package }} - includes: [pattern] {% endif %} {% endfor %}