Files

32 lines
888 B
YAML
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
- name: install tools
apt: name={{item}} state=present update_cache=yes
with_items:
- python-httplib2
- name: install nginx
apt: name=nginx state=present update_cache=yes
- name: configure nginx sites
template: src=nginx.conf.j2 dest=/etc/nginx/sites-available/{{ item.key }} mode=0644
with_dict: "{{ sites }}"
notify: restart nginx
- name: get active sites
shell: ls /etc/nginx/sites-enabled
register: active
- name: de-activate sites
file: path=/etc/nginx/sites-enabled/{{ item }} state=absent
with_items: "{{ active.stdout_lines }}"
when: item not in sites
notify: restart nginx
- name: activate nginx sites
file: src=/etc/nginx/sites-available/{{ item.key }} dest=/etc/nginx/sites-enabled/{{ item.key }} state=link
with_dict: "{{ sites }}"
notify: restart nginx
- name: ensure nginx started
service: name=nginx state=started enabled=yes