Add OpenBSD support

This commit is contained in:
Edwin Steele 2017-02-02 05:21:57 +11:00
parent 3d8591fa17
commit 32d536242d
5 changed files with 31 additions and 4 deletions

View File

@ -2,9 +2,9 @@
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-nginx.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-nginx)
Installs Nginx on RedHat/CentOS or Debian/Ubuntu Linux, or FreeBSD servers.
Installs Nginx on RedHat/CentOS or Debian/Ubuntu Linux, FreeBSD or OpenBSD servers.
This role installs and configures the latest version of Nginx from the Nginx yum repository (on RedHat-based systems) or via apt (on Debian-based systems) or pkgng (on FreeBSD systems). You will likely need to do extra setup work after this role has installed Nginx, like adding your own [virtualhost].conf file inside `/etc/nginx/conf.d/`, describing the location and options to use for your particular website.
This role installs and configures the latest version of Nginx from the Nginx yum repository (on RedHat-based systems) or via apt (on Debian-based systems) or pkgng (on FreeBSD systems) or pkg_add (on OpenBSD systems). You will likely need to do extra setup work after this role has installed Nginx, like adding your own [virtualhost].conf file inside `/etc/nginx/conf.d/`, describing the location and options to use for your particular website.
## Requirements
@ -53,7 +53,7 @@ If you are configuring Nginx as a load balancer, you can define one or more upst
nginx_user: "nginx"
The user under which Nginx will run. Defaults to `nginx` for RedHat, and `www-data` for Debian.
The user under which Nginx will run. Defaults to `nginx` for RedHat, `www-data` for Debian and `www` on FreeBSD and OpenBSD.
nginx_worker_processes: "{{ ansible_processor_vcpus|default(ansible_processor_count) }}"
nginx_worker_connections: "1024"

View File

@ -3,7 +3,7 @@ dependencies: []
galaxy_info:
author: geerlingguy
description: Nginx installation for Linux and FreeBSD.
description: Nginx installation for Linux, FreeBSD and OpenBSD.
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 1.8
@ -25,6 +25,10 @@ galaxy_info:
- 10.1
- 10.0
- 9.3
- name: OpenBSD
versions:
- 5.9
- 6.0
galaxy_tags:
- development
- web

View File

@ -21,6 +21,9 @@
- include: setup-FreeBSD.yml
when: ansible_os_family == 'FreeBSD'
- include: setup-OpenBSD.yml
when: ansible_os_family == 'OpenBSD'
# Vhost configuration.
- include: vhosts.yml

10
tasks/setup-OpenBSD.yml Normal file
View File

@ -0,0 +1,10 @@
---
- name: Ensure nginx is installed.
openbsd_pkg:
name: "{{ nginx_package_name }}"
state: present
- name: Create logs directory.
file:
path: /var/log/nginx
state: directory

10
vars/OpenBSD.yml Normal file
View File

@ -0,0 +1,10 @@
---
root_group: wheel
nginx_conf_path: /etc/nginx/conf.d
nginx_conf_file_path: /etc/nginx/nginx.conf
nginx_mime_file_path: /etc/nginx/mime.types
nginx_pidfile: /var/run/nginx.pid
nginx_vhost_path: /etc/nginx/sites-enabled
nginx_default_vhost_path: /etc/nginx/sites-enabled/default
nginx_package_name: "nginx--"
__nginx_user: "www"