summaryrefslogtreecommitdiffstats
path: root/roles/common-web/tasks
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2013-12-15 22:54:56 +0100
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 02:51:26 +0200
commit540779286a899dee846784a8ffd0fdab756ac1e3 (patch)
tree74aa5483d2e9215306f32d1425a539ecad36ab96 /roles/common-web/tasks
parentfaee1bbc276b63a81f3b81eae0f02bcaffabca6d (diff)
Common web configuration.
Diffstat (limited to 'roles/common-web/tasks')
-rw-r--r--roles/common-web/tasks/main.yml60
1 files changed, 60 insertions, 0 deletions
diff --git a/roles/common-web/tasks/main.yml b/roles/common-web/tasks/main.yml
new file mode 100644
index 0000000..ac42af3
--- /dev/null
+++ b/roles/common-web/tasks/main.yml
@@ -0,0 +1,60 @@
+- name: Install Nginx
+ apt: pkg=nginx
+
+- name: Limit Nginx logging
+ lineinfile: "dest=/etc/logrotate.d/nginx create=yes
+ regexp='^\\s*rotate\\s'
+ line='\trotate 3'"
+ tags:
+ - logrotate
+
+- name: Delete /etc/nginx/*_params
+ file: path=/etc/nginx/{{ item }}_params state=absent
+ with_items:
+ - fastcgi
+ - proxy
+ - scgi
+ - uwsgi
+
+- name: Delete /etc/nginx/sites-{available,enabled}/default
+ file: path=/etc/nginx/sites-{{ item }}/default state=absent
+ with_items:
+ - enabled
+ - available
+
+- name: Create directory /etc/nginx/{fastcgi,ssl}
+ file: path=/etc/nginx/{{ item }}
+ state=directory
+ owner=root group=root
+ mode=0755
+ with_items:
+ - fastcgi
+ - ssl
+
+- name: Copy fastcgi parameters
+ copy: src=etc/nginx/fastcgi/{{ item }}
+ dest=/etc/nginx/fastcgi/{{ item }}
+ owner=root group=root
+ mode=0644
+ register: r1
+ with_items:
+ - params
+ - php
+ - php-ssl
+ notify:
+ - Restart Nginx
+
+- name: Copy SSL configuration
+ copy: src=etc/nginx/ssl/config
+ dest=/etc/nginx/ssl/config
+ owner=root group=root
+ mode=0644
+ register: r2
+ notify:
+ - Restart Nginx
+
+- name: Start Nginx
+ service: name=nginx state=started
+ when: not (r1.changed or r2.changed)
+
+- meta: flush_handlers