summaryrefslogtreecommitdiffstats
path: root/roles/common-web/tasks
diff options
context:
space:
mode:
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