---

#setup a named webserver on a host

- name: create symlink
  file: state=link src="{{ repo }}" dest="{{ server_root }}"


- name: create nginx vhost
  template: src=nginx.conf.j2 dest=/etc/nginx/sites-available/{{ server_hostname }}.conf
  notify:
   - reload nginx

- name: activate nginx vhost
  file: state=link src=/etc/nginx/sites-available/{{ server_hostname }}.conf dest=/etc/nginx/sites-enabled/{{ server_hostname }}.conf
  notify:
   - reload nginx

- name: update host file
  lineinfile: dest=/etc/hosts line='127.0.0.1 {{ server_hostname }}' owner=root group=root mode=0644