Skip to content

Commit 8a8f08a

Browse files
committed
Add NGINX Unit variables
* Add unit_enable variable to install NGINX Unit * Add unit_packages variable to determine whether NGINX Unit packages should be installed
1 parent 548fc3f commit 8a8f08a

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

defaults/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ type: opensource
99
# Default is mainline.
1010
branch: mainline
1111

12+
# Install NGINX Unit and NGINX Unit packages.
13+
# Default is false.
14+
unit_enable: false
15+
unit_packages: false
16+
1217
# Install nginscript, perl, waf (NGINX Plus only), geoip, image-filter, rtmp and/or xslt modules.
1318
# Default is false.
1419
modules:

tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@
4646

4747
- import_tasks: amplify/install-amplify.yml
4848
when: amplify_enable and amplify_key is defined and amplify_key
49+
50+
- import_tasks: unit/install-unit.yml
51+
when: unit_enable

tasks/unit/install-unit.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
state: present
1212
notify: "(Handler: All OSs) Start NGINX Unit"
1313

14-
- name: "(Install: All OSs) Install NGINX Unit"
14+
- name: "(Install: CentOS) Install NGINX Unit Packages"
1515
package:
1616
name: "{{ item }}"
1717
state: present
@@ -20,21 +20,21 @@
2020
- unit-python
2121
- unit-go
2222
- unit-perl
23-
when: ansible_distribution == "CentOS"
23+
when: ansible_distribution == "CentOS" and unit_packages
2424
notify: "(Handler: All OSs) Start NGINX Unit"
2525

26-
- name: "(Install: All OSs) Install NGINX Unit"
26+
- name: "(Install: RedHat) Install NGINX Unit Packages"
2727
package:
2828
name: "{{ item }}"
2929
state: present
3030
with_items:
3131
- unit-php
3232
- unit-python
3333
- unit-perl
34-
when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 6
34+
when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 6 and unit_packages
3535
notify: "(Handler: All OSs) Start NGINX Unit"
3636

37-
- name: "(Install: All OSs) Install NGINX Unit"
37+
- name: "(Install: RedHat) Install NGINX Unit Packages"
3838
package:
3939
name: "{{ item }}"
4040
state: present
@@ -43,10 +43,10 @@
4343
- unit-python
4444
- unit-go
4545
- unit-perl
46-
when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 6
46+
when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 7 and unit_packages
4747
notify: "(Handler: All OSs) Start NGINX Unit"
4848

49-
- name: "(Install: All OSs) Install NGINX Unit"
49+
- name: "(Install: Amazon Linux) Install NGINX Unit Packages"
5050
package:
5151
name: "{{ item }}"
5252
state: present
@@ -61,41 +61,41 @@
6161
when: ansible_distribution == "Amazon"
6262
notify: "(Handler: All OSs) Start NGINX Unit"
6363

64-
- name: "(Install: All OSs) Install NGINX Unit"
64+
- name: "(Install: Debian 8) Install NGINX Unit"
6565
package:
6666
name: "{{ item }}"
6767
state: present
6868
with_items:
6969
- unit-php
7070
- unit-python2.7
71-
- unit-python3.5
72-
- unit-go
71+
- unit-python3.4
7372
- unit-perl
74-
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int == 16
73+
when: ansible_distribution == "Debian" and ansible_distribution_major_version|int == 8 and unit_packages
7574
notify: "(Handler: All OSs) Start NGINX Unit"
7675

77-
- name: "(Install: All OSs) Install NGINX Unit"
76+
- name: "(Install: Debian 9) Install NGINX Unit"
7877
package:
7978
name: "{{ item }}"
8079
state: present
8180
with_items:
8281
- unit-php
8382
- unit-python2.7
84-
- unit-python3.4
83+
- unit-python3.5
84+
- unit-go1.7
85+
- unit-go1.8
8586
- unit-perl
86-
when: ansible_distribution == "Debian" and ansible_distribution_major_version|int == 8
87+
when: ansible_distribution == "Debian" and ansible_distribution_major_version|int == 9 and unit_packages
8788
notify: "(Handler: All OSs) Start NGINX Unit"
8889

89-
- name: "(Install: All OSs) Install NGINX Unit"
90+
- name: "(Install: Ubuntu) Install NGINX Unit"
9091
package:
9192
name: "{{ item }}"
9293
state: present
9394
with_items:
9495
- unit-php
9596
- unit-python2.7
9697
- unit-python3.5
97-
- unit-go1.7
98-
- unit-go1.8
98+
- unit-go
9999
- unit-perl
100-
when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 9
100+
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int == 16 and unit_packages
101101
notify: "(Handler: All OSs) Start NGINX Unit"

0 commit comments

Comments
 (0)