diff --git a/README.md b/README.md index 12549b4..c6375cb 100644 --- a/README.md +++ b/README.md @@ -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" diff --git a/meta/main.yml b/meta/main.yml index fab65e4..a7f79fc 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index 2363838..6c420fe 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 diff --git a/tasks/setup-OpenBSD.yml b/tasks/setup-OpenBSD.yml new file mode 100644 index 0000000..c660301 --- /dev/null +++ b/tasks/setup-OpenBSD.yml @@ -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 diff --git a/vars/OpenBSD.yml b/vars/OpenBSD.yml new file mode 100644 index 0000000..a5a5c9d --- /dev/null +++ b/vars/OpenBSD.yml @@ -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"