Skip to content

Commit

Permalink
Add OpenBSD support
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinsteele committed Feb 1, 2017
1 parent 3d8591f commit 32d5362
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,6 +25,10 @@ galaxy_info:
- 10.1
- 10.0
- 9.3
- name: OpenBSD
versions:
- 5.9
- 6.0
galaxy_tags:
- development
- web
3 changes: 3 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions tasks/setup-OpenBSD.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions vars/OpenBSD.yml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 32d5362

Please sign in to comment.