---
  - name: Install nginx
    become: true
    apt:  pkg=nginx state=latest

  - name: Create nginx ssl directory
    file: path="{{ item }}" state=directory owner=root group=root mode=0733
    with_items:
     - "/etc/nginx/ssl"

  - name: Create self-signed SSL cert
    command: openssl req -new -nodes -x509 -subj "/C=US/ST=Texas/L=Austin/O=IT/CN=${ansible_fqdn}" -days 3650 -keyout /etc/nginx/ssl/server.key -out /etc/nginx/ssl/server.crt -extensions v3_ca creates=/etc/nginx/ssl/server.crt
    notify: restart nginx

  - name: Change default nginx site
    become: true
    template: src=default.j2 dest=/etc/nginx/sites-available/default
    notify: restart nginx

  - name: Turn sendfile off on nginx for local development
    become: true
    replace:
      dest: /etc/nginx/nginx.conf
      regexp: 'sendfile on;'
      replace: 'sendfile off;'
    when: app_env == "development"
---
  - name: Install nginx
    become: true
    apt:  pkg=nginx state=latest

  - name: Create nginx ssl directory
    file: path="{{ item }}" state=directory owner=root group=root mode=0744
    with_items:
     - "/etc/nginx/ssl"

  - name: Create self-signed SSL cert
    command: openssl req -new -nodes -x509 -subj "/C=US/ST=Texas/L=Austin/O=IT/CN=${ansible_fqdn}" -days 3650 -keyout /etc/nginx/ssl/server.key -out /etc/nginx/ssl/server.crt -extensions v3_ca creates=/etc/nginx/ssl/server.crt
    notify: restart nginx

  - name: Change default nginx site
    become: true
    template: src=default.j2 dest=/etc/nginx/sites-available/default
    notify: restart nginx

  - name: Turn sendfile off on nginx for local development
    become: true
    replace:
      dest: /etc/nginx/nginx.conf
      regexp: 'sendfile on;'
      replace: 'sendfile off;'
    when: app_env == "development"
Make the SSL directory 744, not 733.
Make the SSL directory 744, not 733.
