---
- name: Ensure Nginx cache directory exists
  file: path="{{ nginx_cache_dir }}"
        state=directory
        owner="{{ ansible_ssh_user }}"
        group=mmw
        mode=0775
  notify:
    - Restart Nginx

- name: Configure Nginx site
  template: src=nginx-app.conf.j2
            dest=/etc/nginx/sites-available/mmw-app.conf
  notify:
    - Restart Nginx

- name: Enable Nginx site
  file: src=/etc/nginx/sites-available/mmw-app.conf
        dest=/etc/nginx/sites-enabled/mmw-app
        state=link
  notify:
    - Restart Nginx

---
- name: Ensure Nginx cache directory exists
  file: path="{{ nginx_cache_dir }}"
        state=directory
        owner=www-data
        group=www-data
  notify:
    - Restart Nginx

- name: Configure Nginx site
  template: src=nginx-app.conf.j2
            dest=/etc/nginx/sites-available/mmw-app.conf
  notify:
    - Restart Nginx

- name: Enable Nginx site
  file: src=/etc/nginx/sites-available/mmw-app.conf
        dest=/etc/nginx/sites-enabled/mmw-app
        state=link
  notify:
    - Restart Nginx

Change owner of nginx cache directory
Change owner of nginx cache directory

`www-data` is the more appropriate owner of this dir.
