--- - include_tasks: setup_Debian.yml - name: nginx.conf template: src: nginx.conf.j2 dest: /etc/nginx/nginx.conf notify: reload nginx - name: default vhost template: src: default-vhost.conf.j2 dest: /etc/nginx/sites-available/default notify: reload nginx - name: vhosts template: src: vhost.conf.j2 dest: /etc/nginx/sites-available/{{vhost.name}} notify: reload nginx with_items: "{{ nginx_vhosts }}" loop_control: loop_var: vhost - name: enable vhosts file: src: ../sites-available/{{vhost.name}} dest: /etc/nginx/sites-enabled/{{vhost.name}} state: link notify: reload nginx with_items: "{{ nginx_vhosts }}" loop_control: loop_var: vhost - name: ensure nginx is started service: name: nginx state: started