Skip to content

Commit 98974fb

Browse files
committed
Implement support to select NGINX repository
Resolve #32 - Initial options include using the default NGINX packages included in the host system or using the NGINX packages included in the NGINX repository
1 parent aef307f commit 98974fb

File tree

3 files changed

+42
-18
lines changed

3 files changed

+42
-18
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,18 @@ This role has multiple variables. The defaults for all these variables are the f
8484
# Default is 'opensource'.
8585
type: opensource
8686

87+
# Specify source respository for NGINX Open Source.
88+
# Options are 'nginx_repository' or 'os_repository'.
89+
# Default is nginx_repository.
90+
install_from: nginx_repository
91+
8792
# Specify which branch of NGINX Open Source you want to install.
8893
# Options are 'mainline' or 'stable'.
94+
# Only works if 'install_from' is set to 'nginx_repository'.
8995
# Default is mainline.
9096
branch: mainline
9197

92-
# Install nginscript, perl, waf (NGINX Plus only), geoip, image-filter, rtmp and/or xslt modules.
98+
# Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules.
9399
# Default is false.
94100
modules:
95101
njs: false

defaults/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
# Default is 'opensource'.
55
type: opensource
66

7+
# Specify source respository for NGINX Open Source.
8+
# Options are 'nginx_repository' or 'os_repository'.
9+
# Default is nginx_repository.
10+
install_from: nginx_repository
11+
712
# Specify which branch of NGINX Open Source you want to install.
813
# Options are 'mainline' or 'stable'.
14+
# Only works if 'install_from' is set to 'nginx_repository'.
915
# Default is mainline.
1016
branch: mainline
1117

tasks/opensource/install-oss.yml

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,38 @@
11
---
2-
- import_tasks: setup-debian.yml
3-
when: ansible_os_family == "Debian"
2+
- name: ""
3+
block:
44

5-
- import_tasks: setup-redhat.yml
6-
when: ansible_os_family == "RedHat"
5+
- import_tasks: setup-debian.yml
6+
when: ansible_os_family == "Debian"
77

8-
- import_tasks: setup-suse.yml
9-
when: ansible_os_family == "Suse"
8+
- import_tasks: setup-redhat.yml
9+
when: ansible_os_family == "RedHat"
1010

11-
- import_tasks: setup-freebsd.yml
12-
when: ansible_os_family == "FreeBSD"
11+
- import_tasks: setup-suse.yml
12+
when: ansible_os_family == "Suse"
1313

14-
- name: "(Install: Debian/Ubuntu/CentOS/RedHat) Install NGINX"
15-
package:
16-
name: nginx
17-
state: present
18-
when: ansible_os_family != "FreeBSD"
19-
notify: "(Handler: All OSs) Start NGINX"
14+
- import_tasks: setup-freebsd.yml
15+
when: ansible_os_family == "FreeBSD"
2016

21-
- name: "(Install: FreeBSD) Install NGINX"
22-
portinstall:
17+
- name: "(Install: Debian/Ubuntu/CentOS/RedHat) Install NGINX"
18+
package:
19+
name: nginx
20+
state: present
21+
when: ansible_os_family != "FreeBSD"
22+
notify: "(Handler: All OSs) Start NGINX"
23+
24+
- name: "(Install: FreeBSD) Install NGINX"
25+
portinstall:
26+
name: nginx
27+
state: present
28+
when: ansible_os_family == "FreeBSD"
29+
notify: "(Handler: All OSs) Start NGINX"
30+
31+
when: install_from == "nginx_repository"
32+
33+
- name: "(Install: Debian/Ubuntu/CentOS/RedHat/FreeBSD) Install NGINX"
34+
package:
2335
name: nginx
2436
state: present
25-
when: ansible_os_family == "FreeBSD"
37+
when: install_from == "os_repository"
2638
notify: "(Handler: All OSs) Start NGINX"

0 commit comments

Comments
 (0)