---
- name: Deploy Nginx site configurations
  hosts: hip
  become: yes
  vars:
    nginx_sites_enabled_path: /etc/nginx/sites-enabled

  tasks:
    - name: Copy all configs from templates to sites-enabled
      copy:
        src: "templates/nginx/sites-enabled/"
        dest: "{{ nginx_sites_enabled_path }}/"
        owner: root
        group: root
        mode: '0644'
      notify: reload nginx

  handlers:
    - name: reload nginx
      service:
        name: nginx
        state: reloaded
