Install NGINX Unit on FreeBSD

This commit is contained in:
Alessandro Fael Garcia 2018-07-18 14:59:14 -07:00
parent a5fe8d20b2
commit 0fef56b4fa
4 changed files with 41 additions and 8 deletions

View File

@ -1,17 +1,20 @@
---
# Start NGINX
- name: "(Handler: All OSs) Start NGINX"
service:
name: nginx
state: started
# Reload NGINX
- name: "(Handler: All OSs) Reload NGINX"
service:
name: nginx
state: reloaded
- name: "(Handler: All OSs) Start NGINX Unit"
- name: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
service:
name: unit
name: unitd
state: started
- name: "(Handler: FreeBSD) Start NGINX Unit"
service:
name: unitd
state: started

View File

@ -1,7 +1,16 @@
---
- name: "(Install: All OSs) Install NGINX Unit Modules"
- name: "(Install: Debian/Ubuntu/CentOS/RedHat) Install NGINX Unit Modules"
package:
name: "{{ item }}"
state: present
with_items: "{{ unit_modules }}"
notify: "(Handler: All OSs) Start NGINX Unit"
when: ansible_os_family != "FreeBSD"
notify: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
- name: "(Install: FreeBSD) Install NGINX Unit Modules"
portinstall:
name: "{{ item }}"
state: present
with_items: "{{ unit_modules }}"
when: ansible_os_family == "FreeBSD"
notify: "(Handler: FreeBSD) Start NGINX Unit"

View File

@ -5,11 +5,22 @@
- import_tasks: setup-redhat.yml
when: ansible_os_family == "RedHat"
- name: "(Install: All OSs) Install NGINX Unit"
- import_tasks: setup-freebsd.yml
when: ansible_os_family == "FreeBSD"
- name: "(Install: Debian/Ubuntu/CentOS/RedHat) Install NGINX Unit"
package:
name: unit
state: present
notify: "(Handler: All OSs) Start NGINX Unit"
when: ansible_os_family != "FreeBSD"
notify: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
- name: "(Install: FreeBSD) Install NGINX Unit"
portinstall:
name: unit
state: present
when: ansible_os_family == "FreeBSD"
notify: "(Handler: FreeBSD) Start NGINX Unit"
- import_tasks: install-modules.yml
when: unit_modules is defined and unit_modules

View File

@ -0,0 +1,10 @@
---
- name: "(Install: FreeBSD) Fetch Ports"
command: portsnap fetch --interactive
args:
creates: /var/db/portsnap/INDEX
- name: "(Install: FreeBSD) Extract Ports"
command: portsnap extract
args:
creates: /usr/ports