--- - name: Create Nginx vhost configurations ansible.builtin.template: src: nginx-vhost.conf.j2 dest: "/etc/nginx/sites-enabled/{{ item.key }}.conf" owner: root group: root mode: '0644' loop: "{{ servernames | dict2items }}" notify: Restart Nginx