aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Cholewiński <harry666t@gmail.com>2016-02-16 21:17:05 +0100
committerKamil Cholewiński <harry666t@gmail.com>2016-02-16 21:17:05 +0100
commit90f9394efa88137e6193aa7f867ce758c854833f (patch)
tree92c00a05d85df6bffe070f6f6968621a2cac138e
parent853fa34281d71c97e08c207369d8e2375bd7c271 (diff)
downloadcookbook-90f9394efa88137e6193aa7f867ce758c854833f.zip
cookbook-90f9394efa88137e6193aa7f867ce758c854833f.tar.gz
cookbook-90f9394efa88137e6193aa7f867ce758c854833f.tar.bz2
Port nginx role to OpenBSD
-rw-r--r--roles/nginx/handlers/main.yml2
-rw-r--r--roles/nginx/tasks/main.yml18
-rw-r--r--roles/nginx/templates/nginx.conf.j26
-rw-r--r--roles/nginx/vars/Debian.yml1
-rw-r--r--roles/nginx/vars/OpenBSD.yml8
5 files changed, 26 insertions, 9 deletions
diff --git a/roles/nginx/handlers/main.yml b/roles/nginx/handlers/main.yml
index a0cae59..9b165fc 100644
--- a/roles/nginx/handlers/main.yml
+++ b/roles/nginx/handlers/main.yml
@@ -1,6 +1,6 @@
---
- name: Reload nginx
- shell: nginx -t && service nginx reload
+ shell: nginx -t && nginx -s reload
- name: Restart nginx
service: name=nginx state=restarted
diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml
index 0189100..20fdd96 100644
--- a/roles/nginx/tasks/main.yml
+++ b/roles/nginx/tasks/main.yml
@@ -24,6 +24,18 @@
dest: /var/www/html/index.html
tags: install
+- name: Create directories
+ file:
+ dest: "{{ item.path }}"
+ mode: "{{ item.mode | default('0755') }}"
+ owner: "{{ item.owner | default('root') }}"
+ group: "{{ item.group | default(root_group) }}"
+ state: directory
+ with_items:
+ - { path: /etc/nginx/conf.d }
+ - { path: /etc/nginx/htpasswd, mode: "0710", group: "{{ httpd.user }}" }
+ tags: install
+
- name: Configure nginx
template:
src: "{{ item }}.j2"
@@ -43,10 +55,4 @@
notify: Reload nginx
tags: config
-- name: Create /etc/nginx/htpasswd
- file:
- dest: /etc/nginx/htpasswd
- state: directory
- tags: install
-
- meta: flush_handlers
diff --git a/roles/nginx/templates/nginx.conf.j2 b/roles/nginx/templates/nginx.conf.j2
index d107cc1..faa9ee2 100644
--- a/roles/nginx/templates/nginx.conf.j2
+++ b/roles/nginx/templates/nginx.conf.j2
@@ -2,8 +2,9 @@
# {{ ansible_managed }}
user {{ httpd.user }};
worker_processes 4;
-pid /run/nginx.pid;
+pid {{ httpd.pidfile }};
+worker_rlimit_nofile 1024;
events {
worker_connections 768;
# multi_accept on;
@@ -20,8 +21,9 @@ http {
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
- include /etc/nginx/mime.types;
+ include mime.types;
default_type application/octet-stream;
+ index index.html index.htm;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
diff --git a/roles/nginx/vars/Debian.yml b/roles/nginx/vars/Debian.yml
index 6ee5ca9..8d2f899 100644
--- a/roles/nginx/vars/Debian.yml
+++ b/roles/nginx/vars/Debian.yml
@@ -6,3 +6,4 @@ packages:
httpd:
user: www-data
+ pidfile: /run/nginx.pid
diff --git a/roles/nginx/vars/OpenBSD.yml b/roles/nginx/vars/OpenBSD.yml
new file mode 100644
index 0000000..351bc77
--- /dev/null
+++ b/roles/nginx/vars/OpenBSD.yml
@@ -0,0 +1,8 @@
+---
+packages:
+ nginx:
+ - nginx--
+
+httpd:
+ user: www
+ pidfile: /var/run/nginx.pid