{% for vhost, config in pillar["vhosts"].items() %} Copy nginx configuration for {{ vhost }}: file.managed: - name: /usr/local/vhost-conf/{{ vhost }}/nginx.conf - source: salt://nginx-docker/files/default.conf - makedirs: True - template: jinja - vhost: {{ vhost }} Run nginx container for {{ vhost }}: docker_container.running: - name: nginx-{{ vhost }} - image: nginx:1.25 - start: True - restart: always - networks: - network-{{ vhost }} - binds: - webroot-{{ vhost }}:/app:rw,Z - /usr/local/vhost-conf/{{ vhost }}/nginx.conf:/etc/nginx/conf.d/default.conf:ro - port_bindings: - {{ config.nginx_port }}:80 {% endfor %}