Skip to content

Commit e9b8e57

Browse files
authored
Merge pull request #41 from nginxinc/(feature)/unit-add-distros
(feature)/unit add distros
2 parents 962518e + d9131f6 commit e9b8e57

File tree

8 files changed

+276
-213
lines changed

8 files changed

+276
-213
lines changed

README.md

Lines changed: 223 additions & 197 deletions
Large diffs are not rendered by default.

defaults/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ install_from: nginx_repository
1919
# Defaults are the official NGINX repositories.
2020
nginx_repository:
2121
debian:
22-
- deb https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
23-
- deb-src https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
22+
- deb https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
23+
- deb-src https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
2424
redhat:
25-
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
25+
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
2626
suse:
27-
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}sles/12
27+
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}sles/12
2828

2929
# Specify which branch of NGINX Open Source you want to install.
3030
# Options are 'mainline' or 'stable'.

handlers/main.yml

Lines changed: 6 additions & 3 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:
1614
name: unit
1715
state: started
16+
17+
- name: "(Handler: FreeBSD) Start NGINX Unit"
18+
service:
19+
name: unitd
20+
state: started

meta/main.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
---
12
galaxy_info:
23
author: Alessandro Fael Garcia
34
description: Official Ansible role for NGINX
4-
company: NGINX Inc
5+
company: NGINX, Inc.
56

67
license: Apache License, Version 2.0
78

@@ -10,22 +11,25 @@ galaxy_info:
1011
platforms:
1112
- name: Debian
1213
versions:
13-
- wheezy
1414
- jessie
1515
- stretch
1616
- name: Ubuntu
1717
versions:
18-
- precise
1918
- trusty
2019
- xenial
21-
- yakkety
20+
- artful
21+
- bionic
2222
- name: EL
2323
versions:
2424
- 6
2525
- 7
2626
- name: SLES
2727
versions:
2828
- 12
29+
- name: FreeBSD
30+
versions:
31+
- 10
32+
- 11
2933

3034
galaxy_tags:
3135
- nginx

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

tasks/unit/setup-redhat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- name: "(Install: Amazon Linux) Add NGINX Unit Repository"
1212
yum_repository:
1313
name: unit
14-
baseurl: https://packages.nginx.org/unit/amzn/$releasever/$basearch/
14+
baseurl: https://packages.nginx.org/unit/amzn{{ (ansible_distribution_version == "2") | ternary('2', '') }}/$releasever/$basearch/
1515
description: NGINX Unit Repository
1616
enabled: yes
1717
gpgcheck: yes

0 commit comments

Comments
 (0)