---
- name: Install nginx web server
  apt: name=nginx state=latest force=yes

- name: Remove default nginx vhost config file (if configured).
  file:
    path: /etc/nginx/sites-enabled/default
    state: absent
  notify: restart nginx

- name: Upload nginx.conf
  copy: src=nginx.conf dest=/etc/nginx/nginx.conf backup=yes
  notify: restart nginx

- name: Copy download.kiwix.org vhost
  copy: src=download.kiwix.org dest=/etc/nginx/sites-available/download.kiwix.org backup=yes
  notify: restart nginx

- name: Enable Virtual host
  file: src=/etc/nginx/sites-available/download.kiwix.org dest=/etc/nginx/sites-enabled/download.kiwix.org state=link
  notify: restart nginx

---
- name: Install nginx web server
  apt: name=nginx state=latest force=yes

- name: Remove default nginx vhost config file (if configured).
  file:
    path: /etc/nginx/sites-enabled/default
    state: absent
  notify: restart nginx

- name: Upload nginx.conf
  copy: src=nginx.conf dest=/etc/nginx/nginx.conf backup=yes
  notify: restart nginx

- name: Copy download.kiwix.org vhost
  copy: src=download.kiwix.org dest=/etc/nginx/sites-available/download.kiwix.org
  notify: restart nginx

- name: Enable Virtual host
  file: src=/etc/nginx/sites-available/download.kiwix.org dest=/etc/nginx/sites-enabled/download.kiwix.org state=link
  notify: restart nginx

- name: Copy download.kiwix.org vhost
  copy: src=catalog.yohanboniface.me dest=/etc/nginx/sites-available/catalog.yohanboniface.me
  notify: restart nginx

- name: Enable Virtual host
  file: src=/etc/nginx/sites-available/catalog.yohanboniface.me dest=/etc/nginx/sites-enabled/catalog.yohanboniface.me state=link
  notify: restart nginx

Copy and enable catalog.yohanboniface.me vhost
Copy and enable catalog.yohanboniface.me vhost
