2014-05-07 16:51:02 +00:00
|
|
|
---
|
2014-05-07 19:16:09 +00:00
|
|
|
- name: Add nginx upstream repo key
|
|
|
|
apt_key: url=http://nginx.org/keys/nginx_signing.key state=present
|
2014-05-07 19:20:43 +00:00
|
|
|
- name: Add nginx upstream repository
|
2014-05-07 19:16:09 +00:00
|
|
|
apt_repository: repo='deb http://nginx.org/packages/debian/ wheezy nginx' state=present update_cache=yes
|
2014-05-07 19:27:47 +00:00
|
|
|
- name: Install nginx package
|
2014-05-07 22:01:54 +00:00
|
|
|
apt: pkg=nginx state=latest
|
2014-05-07 19:24:01 +00:00
|
|
|
- name: Stop nginx for now and also make it start on boot
|
|
|
|
service: name=nginx state=stopped enabled=yes
|
2014-05-07 19:01:11 +00:00
|
|
|
- name: Make nginx related dirs
|
|
|
|
file: path={{ item }} state=directory
|
|
|
|
with_items:
|
|
|
|
- /etc/nginx/global
|
2014-05-07 19:27:47 +00:00
|
|
|
- /etc/nginx/sites-available
|
|
|
|
- /etc/nginx/sites-enabled
|
2014-05-07 19:01:11 +00:00
|
|
|
- /srv/www/catch-all
|
|
|
|
- name: Clean out default vhost file in enabled and available dirs
|
|
|
|
file: path={{ item }} state=absent
|
|
|
|
with_items:
|
|
|
|
- /etc/nginx/sites-enabled/default
|
|
|
|
- /etc/nginx/sites-available/default
|
|
|
|
- name: Copy over all nginx configuration files
|
2014-05-07 17:44:03 +00:00
|
|
|
copy: src={{ item.name }} dest={{ item.dir }}
|
|
|
|
with_items:
|
2014-05-07 19:01:11 +00:00
|
|
|
- { name: 'nginx.conf', dir: '/etc/nginx/nginx.conf' }
|
|
|
|
- { name: '0-catch-all', dir: '/etc/nginx/sites-available/0-catch-all' }
|
2014-05-07 17:44:03 +00:00
|
|
|
- { name: 'cloudflare.conf', dir: '/etc/nginx/global/cloudflare.conf' }
|
|
|
|
- { name: 'php-generic.conf', dir: '/etc/nginx/global/php-generic.conf' }
|
|
|
|
- { name: 'security-generic.conf', dir: '/etc/nginx/global/security-generic.conf' }
|
|
|
|
- { name: 'wordpress-generic.conf', dir: '/etc/nginx/global/wordpress-generic.conf' }
|
|
|
|
- { name: 'wordpress-security.conf', dir: '/etc/nginx/global/wordpress-security.conf' }
|
2014-05-07 19:01:11 +00:00
|
|
|
- name: Symlink the default catch-all vhost
|
|
|
|
file: src=/etc/nginx/sites-available/0-catch-all dest=/etc/nginx/sites-enabled/0-catch-all state=link
|
2014-05-07 16:51:02 +00:00
|
|
|
notify:
|
|
|
|
- start nginx
|