{% if pillar['firewalld']['services'] is defined %} {% for service, args in pillar['firewalld']['services'].items() %} Adding {{ service }} firewalld service: firewalld.service: - name: {{ service }} - ports: {{ args['ports'] }} {% endfor %} {% endif %} {% if pillar['firewalld']['zones'] is defined %} {% for zone, args in pillar['firewalld']['zones'].items() %} configure {{ zone }} firewalld zone: firewalld.present: - name: {{ zone }} - default: {{ args['default'] if args['default'] is defined else False }} {% if args['services'] is defined %} - services: {% for service, args in args['services'].items() -%} - {{ service }} {% endfor %} {% endif %} {% endfor %} {% endif %}