Skip to content

Commit 0fef56b

Browse files
committed
Install NGINX Unit on FreeBSD
1 parent a5fe8d2 commit 0fef56b

File tree

4 files changed

+41
-8
lines changed

4 files changed

+41
-8
lines changed

handlers/main.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
---
2-
# Start NGINX
32
- name: "(Handler: All OSs) Start NGINX"
43
service:
54
name: nginx
65
state: started
76

8-
# Reload NGINX
97
- name: "(Handler: All OSs) Reload NGINX"
108
service:
119
name: nginx
1210
state: reloaded
1311

14-
- name: "(Handler: All OSs) Start NGINX Unit"
12+
- name: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
1513
service:
16-
name: unit
14+
name: unitd
15+
state: started
16+
17+
- name: "(Handler: FreeBSD) Start NGINX Unit"
18+
service:
19+
name: unitd
1720
state: started

tasks/unit/install-modules.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
---
2-
- name: "(Install: All OSs) Install NGINX Unit Modules"
2+
- name: "(Install: Debian/Ubuntu/CentOS/RedHat) Install NGINX Unit Modules"
33
package:
44
name: "{{ item }}"
55
state: present
66
with_items: "{{ unit_modules }}"
7-
notify: "(Handler: All OSs) Start NGINX Unit"
7+
when: ansible_os_family != "FreeBSD"
8+
notify: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
9+
10+
- name: "(Install: FreeBSD) Install NGINX Unit Modules"
11+
portinstall:
12+
name: "{{ item }}"
13+
state: present
14+
with_items: "{{ unit_modules }}"
15+
when: ansible_os_family == "FreeBSD"
16+
notify: "(Handler: FreeBSD) Start NGINX Unit"

tasks/unit/install-unit.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,22 @@
55
- import_tasks: setup-redhat.yml
66
when: ansible_os_family == "RedHat"
77

8-
- name: "(Install: All OSs) Install NGINX Unit"
8+
- import_tasks: setup-freebsd.yml
9+
when: ansible_os_family == "FreeBSD"
10+
11+
- name: "(Install: Debian/Ubuntu/CentOS/RedHat) Install NGINX Unit"
912
package:
1013
name: unit
1114
state: present
12-
notify: "(Handler: All OSs) Start NGINX Unit"
15+
when: ansible_os_family != "FreeBSD"
16+
notify: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
17+
18+
- name: "(Install: FreeBSD) Install NGINX Unit"
19+
portinstall:
20+
name: unit
21+
state: present
22+
when: ansible_os_family == "FreeBSD"
23+
notify: "(Handler: FreeBSD) Start NGINX Unit"
1324

1425
- import_tasks: install-modules.yml
1526
when: unit_modules is defined and unit_modules

tasks/unit/setup-freebsd.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
- name: "(Install: FreeBSD) Fetch Ports"
3+
command: portsnap fetch --interactive
4+
args:
5+
creates: /var/db/portsnap/INDEX
6+
7+
- name: "(Install: FreeBSD) Extract Ports"
8+
command: portsnap extract
9+
args:
10+
creates: /usr/ports

0 commit comments

Comments
 (0)