---

- name: Install Nginx
  apt: name=nginx update_cache={{ update_apt_cache }} state=installed
  tags: packages

- name: Create the Nginx configuration file
  template: src=nginx_site_config.jinja
            dest=/etc/nginx/sites-available/{{ application_name }}
            backup=yes
  notify: reload nginx

- name: Ensure that the default site is disabled
  command: rm /etc/nginx/sites-enabled/default
           removes=/etc/nginx/sites-enabled/default
  notify: reload nginx

- name: Ensure that the application site is enabled
  command: ln -s /etc/nginx/sites-available/{{ application_name }}
           /etc/nginx/sites-enabled/{{ application_name }}
           creates=/etc/nginx/sites-enabled/{{ application_name }}
  notify: reload nginx

- name: Ensure Nginx service is started
  service: name=nginx state=started enabled=yes

---

- name: Install Nginx
  apt: name=nginx update_cache={{ update_apt_cache }} state=installed
  tags: packages

- name: Create the Nginx configuration file
  template: src=nginx_site_config.jinja
            dest=/etc/nginx/sites-available/{{ application_name }}
            backup=yes
  notify: reload nginx

- name: Ensure that the default site is disabled
  action: file path=/etc/nginx/sites-enabled/default state=absent
  notify: reload nginx

- name: Ensure that the application site is enabled
  action: file src=/etc/nginx/sites-available/{{ application_name }}
           dest=/etc/nginx/sites-enabled/{{ application_name }}
           state=link
  notify: reload nginx

- name: Ensure Nginx service is started
  service: name=nginx state=started enabled=yes

Replace ansible nginx symlink provisions
Replace ansible nginx symlink provisions
