---
- name: Add nginx apt key
  apt_key:
    url='http://nginx.org/keys/nginx_signing.key'
  sudo: yes

- name: Add nginx apt repo
  apt_repository:
    repo="deb http://nginx.org/packages/{{ ansible_lsb.id|lower }}/ {{ ansible_lsb.codename }} nginx"
    update_cache=yes
  sudo: yes
  
- name: Install Nginx apt package
  apt: pkg=nginx state=latest
  sudo: yes

- name: Disable default servers
  file:
    path=/etc/nginx/conf.d/{{ item.path }}
    state=absent
  with_items:
    - { path: 'default.conf' }
    - { path: 'example_ssl.conf' }
  sudo: yes
