ansible-playbooks/debian/roles/webservers-nginx/tasks/main.yml

36 lines
1.8 KiB
YAML
Raw Normal View History

2014-05-07 16:51:02 +00:00
---
2014-05-07 17:51:36 +00:00
- name: Add Dotdeb signing key
apt_key: url=http://www.dotdeb.org/dotdeb.gpg state=present
2014-05-07 16:51:02 +00:00
- name: Add Dotdeb repository
apt_repository: repo='deb http://packages.dotdeb.org wheezy all' state=present update_cache=yes
- name: Install nginx package
apt: pkg=nginx-full state=present
- name: Ensure nginx starts on boot
service: name=nginx enabled=yes
- name: Stop nginx for now
service: name=nginx state=stopped
- name: Clean out default vhost file in enabled dir
2014-05-07 16:51:02 +00:00
file: path=/etc/nginx/sites-enabled/default state=absent
- name: Clean out default vhost file in available dir
2014-05-07 16:51:02 +00:00
file: path=/etc/nginx/sites-available/default state=absent
- name: Make global nginx conf directory
file: path=/etc/nginx/global state=directory
- name: Copy our nginx.conf over
copy: src=nginx.conf dest=/etc/nginx/nginx.conf backup=yes
- name: Copy our default catch-all vhost over
2014-05-07 16:51:02 +00:00
copy: src=0-catch-all dest=/etc/nginx/sites-available/0-catch-all
- name: Symlink the default catch-all vhost
2014-05-07 17:03:30 +00:00
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
- name: Copy over global includes, make catchall dir, and start nginx
copy: src={{ item.name }} dest={{ item.dir }}
with_items:
- { 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' }
- name: Make catch-all vhost root dir
2014-05-07 17:58:47 +00:00
file: path=/srv/www/catch-all state=directory owner=www-data group=www-data
2014-05-07 16:51:02 +00:00
notify:
- start nginx