Issue #6 and PR #8: Make nginx user more flexible.

This commit is contained in:
Jeff Geerling 2015-01-02 11:47:26 -06:00
parent 45b749af83
commit fdc9a7da78
7 changed files with 16 additions and 6 deletions

View File

@ -12,7 +12,7 @@ None.
## Role Variables
Available variables are listed below, along with default values (see `vars/main.yml` and `defaults/main.yml`):
Available variables are listed below, along with default values (see `defaults/main.yml`):
nginx_remove_default_vhost: false
nginx_default_vhost_path: /etc/nginx/sites-enabled/default
@ -21,7 +21,7 @@ Whether to remove the 'default' virtualhost configuration supplied by Nginx. Use
nginx_user: "nginx"
The user under which Nginx will run.
The user under which Nginx will run. Defaults to `nginx` for RedHat, and `www-data` for Debian.
nginx_worker_processes: "1"
nginx_worker_connections: "8192"

View File

@ -1,5 +1,4 @@
---
nginx_user: "nginx"
nginx_worker_processes: "1"
nginx_worker_connections: "8192"
nginx_client_max_body_size: "64m"

View File

@ -1,4 +1,14 @@
---
# Variable setup.
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
- name: Define nginx_user.
set_fact:
nginx_user: "{{ __nginx_user }}"
when: nginx_user is not defined
# Nginx setup.
- name: Enable nginx repo (RedHat).
copy: >
src=nginx.repo

View File

@ -1,7 +1,5 @@
---
- hosts: localhost
remote_user: root
vars:
nginx_user: root
roles:
- ansible-role-nginx

2
vars/Debian.yml Normal file
View File

@ -0,0 +1,2 @@
---
__nginx_user: "www-data"

2
vars/RedHat.yml Normal file
View File

@ -0,0 +1,2 @@
---
__nginx_user: "nginx"

View File

@ -1 +0,0 @@
---