main.yml 462 Bytes
---
- name: have nginx installed
  sudo: yes
  apt: pkg=nginx

- name: don't have nginx default site enabled
  sudo: yes
  file: path=/etc/nginx/sites-enabled/default state=absent

- name: have config for our web app
  sudo: yes
  template: src=sites-enabled/webapp.j2 dest=/etc/nginx/sites-enabled/webapp.conf
  register: config_file

- name: restart nginx if our config has changed
  sudo: yes
  service: name=nginx state=restarted
  when: config_file.changed