Skip to content

Commit 7924099

Browse files
authored
Merge pull request #40 from nginxinc/(feature)/toggle-nginx-unit-install
Add nginx_enable variable
2 parents ba8e65d + 31c86e3 commit 7924099

File tree

6 files changed

+56
-42
lines changed

6 files changed

+56
-42
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ script:
133133
| grep -q 'changed=0.*failed=0'
134134
&& (echo 'Idempotence test: pass' && exit 0)
135135
|| (echo 'Idempotence test: fail' && exit 1)
136-
- 'sudo docker exec "$(cat ${container_id})" curl http://localhost/'
136+
- 'if [${playbook} != "unit"]; then sudo docker exec "$(cat ${container_id})" curl http://localhost/; fi'
137137
- 'sudo docker rm -f "$(cat ${container_id})"'
138138
notifications:
139139
webhooks: https://galaxy.ansible.com/api/v1/notifications/

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ Role Variables
102102
This role has multiple variables. The defaults for all these variables are the following:
103103

104104
---
105+
# Install NGINX.
106+
# Default is true.
107+
nginx_enable: true
108+
105109
# Specify which version of NGINX you want to install.
106110
# Options are 'opensource' or 'plus'.
107111
# Default is 'opensource'.
@@ -131,12 +135,6 @@ This role has multiple variables. The defaults for all these variables are the f
131135
# Default is mainline.
132136
branch: mainline
133137

134-
# Install NGINX Unit and NGINX Unit modules.
135-
# Use a list of supported NGINX Unit modules.
136-
# Default is false.
137-
unit_enable: false
138-
unit_modules: null
139-
140138
# Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules.
141139
# Default is false.
142140
modules:
@@ -195,6 +193,12 @@ This role has multiple variables. The defaults for all these variables are the f
195193
stream_template_enable: false
196194
stream_template_listen: 12345
197195

196+
# Install NGINX Unit and NGINX Unit modules.
197+
# Use a list of supported NGINX Unit modules.
198+
# Default is false.
199+
unit_enable: false
200+
unit_modules: null
201+
198202
Dependencies
199203
------------
200204

defaults/main.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
---
2+
# Install NGINX.
3+
# Default is true.
4+
nginx_enable: true
5+
26
# Specify which version of NGINX you want to install.
37
# Options are 'opensource' or 'plus'.
48
# Default is 'opensource'.
@@ -28,12 +32,6 @@ nginx_repository:
2832
# Default is mainline.
2933
branch: mainline
3034

31-
# Install NGINX Unit and NGINX Unit modules.
32-
# Use a list of supported NGINX Unit modules.
33-
# Default is false.
34-
unit_enable: false
35-
unit_modules: null
36-
3735
# Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules.
3836
# Default is false.
3937
modules:
@@ -91,3 +89,9 @@ http_template_listen: 80
9189
http_template_server_name: localhost
9290
stream_template_enable: false
9391
stream_template_listen: 12345
92+
93+
# Install NGINX Unit and NGINX Unit modules.
94+
# Use a list of supported NGINX Unit modules.
95+
# Default is false.
96+
unit_enable: false
97+
unit_modules: null

tasks/main.yml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,52 @@
55
- import_tasks: keys/rpm-key.yml
66
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"
77

8-
- import_tasks: opensource/install-oss.yml
9-
when: type == "opensource"
8+
- name: "(Install: Debian/Ubuntu/CentOS/RedHat/FreeBSD) Install NGINX"
9+
block:
1010

11-
- import_tasks: plus/install-plus.yml
12-
when: type == "plus"
11+
- import_tasks: opensource/install-oss.yml
12+
when: type == "opensource"
1313

14-
- import_tasks: modules/install-njs.yml
15-
when: modules.njs
14+
- import_tasks: plus/install-plus.yml
15+
when: type == "plus"
1616

17-
- import_tasks: modules/install-perl.yml
18-
when: modules.perl
17+
- import_tasks: modules/install-njs.yml
18+
when: modules.njs
1919

20-
- import_tasks: modules/install-geoip.yml
21-
when: modules.geoip
20+
- import_tasks: modules/install-perl.yml
21+
when: modules.perl
2222

23-
- import_tasks: modules/install-image-filter.yml
24-
when: modules.image_filter
23+
- import_tasks: modules/install-geoip.yml
24+
when: modules.geoip
2525

26-
- import_tasks: modules/install-rtmp.yml
27-
when: modules.rtmp
26+
- import_tasks: modules/install-image-filter.yml
27+
when: modules.image_filter
2828

29-
- import_tasks: modules/install-xslt.yml
30-
when: modules.xslt
29+
- import_tasks: modules/install-rtmp.yml
30+
when: modules.rtmp
3131

32-
- import_tasks: modules/install-waf.yml
33-
when: modules.waf and type == "plus"
32+
- import_tasks: modules/install-xslt.yml
33+
when: modules.xslt
3434

35-
- import_tasks: conf/push-config.yml
36-
when: main_push_enable or http_push_enable or stream_push_enable
35+
- import_tasks: modules/install-waf.yml
36+
when: modules.waf and type == "plus"
3737

38-
- import_tasks: conf/template-config.yml
39-
when: main_template_enable or http_template_enable or stream_template_enable
38+
- import_tasks: conf/push-config.yml
39+
when: main_push_enable or http_push_enable or stream_push_enable
4040

41-
- import_tasks: conf/setup-status.yml
42-
when: status_enable
41+
- import_tasks: conf/template-config.yml
42+
when: main_template_enable or http_template_enable or stream_template_enable
4343

44-
- import_tasks: conf/setup-rest-api.yml
45-
when: rest_api_enable and type == "plus"
44+
- import_tasks: conf/setup-status.yml
45+
when: status_enable
4646

47-
- import_tasks: amplify/install-amplify.yml
48-
when: amplify_enable and amplify_key is defined and amplify_key
47+
- import_tasks: conf/setup-rest-api.yml
48+
when: rest_api_enable and type == "plus"
49+
50+
- import_tasks: amplify/install-amplify.yml
51+
when: amplify_enable and amplify_key is defined and amplify_key
52+
53+
when: nginx_enable
4954

5055
- import_tasks: unit/install-unit.yml
5156
when: unit_enable

tasks/opensource/install-oss.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
- name: ""
2+
- name: "(Install: Debian/Ubuntu/CentOS/RedHat/FreeBSD) Install NGINX"
33
block:
44

55
- import_tasks: setup-debian.yml

tests/playbooks/nginx-unit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
roles:
66
- ansible-role-nginx
77
vars:
8+
nginx_enable: false
89
unit_enable: true
910
unit_modules:
1011
- unit-php

0 commit comments

Comments
 (0)