---
- name: Add www-data to Redmine group
  user:
    name: www-data
    groups: "{{ redmine_user }}"
    append: True
  tags:
    - redmine
    - nginx

- name: Copy nginx vhost
  template:
    src: nginx.conf.j2
    dest: "/etc/nginx/sites-available/{{ redmine_user }}.conf"
    mode: "0644"
  notify: reload nginx
  tags:
    - redmine
    - nginx

- name: Enable nginx vhost
  file:
    src: "/etc/nginx/sites-available/{{ redmine_user }}.conf"
    dest: "/etc/nginx/sites-enabled/{{ redmine_user }}.conf"
    state: link
  notify: reload nginx
  tags:
    - redmine
    - nginx
