Skip to content

Commit 9760f98

Browse files
committed
Add NGINX Plus tests to TravisCI (#327)
1 parent 2ca5ce8 commit 9760f98

File tree

19 files changed

+73
-32
lines changed

19 files changed

+73
-32
lines changed

.travis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ jobs:
2424
- name: (CentOS) Cleanup config and try to install modules
2525
env:
2626
scenario: module_centos
27+
- name: (Debian/Ubuntu) Install NGINX Plus
28+
env:
29+
scenario: plus
30+
- name: (Alpine Linux) Install NGINX Plus
31+
env:
32+
scenario: plus_alpine
33+
- name: (CentOS) Install NGINX Plus
34+
env:
35+
scenario: plus_centos
2736
- name: (Debian/Ubuntu) Install stable branch and push a config
2837
env:
2938
scenario: stable_push
@@ -73,6 +82,5 @@ install:
7382
- pip install docker==4.3.1
7483
script:
7584
- travis_wait 50 molecule test -s $scenario
76-
7785
notifications:
7886
webhooks: https://galaxy.ansible.com/api/v1/notifications/

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## 0.17.0 (September 19, 2020)
3+
## 0.17.0 (September 20, 2020)
44

55
BREAKING CHANGES:
66

@@ -16,10 +16,12 @@ FEATURES:
1616
* Three new tags have been introduced -- `nginx_setup_license`, `nginx_install` and `nginx_check_support`.
1717
* Add Alpine 3.12 to the list of supported platforms.
1818
* Remove Alpine 3.8 from the list of supported platforms.
19+
* Add NGINX Plus tests to TravisCI
1920

2021
ENHANCEMENTS:
2122

2223
* Added handlers to check for NGINX syntax validity and fail if any errors are detected.
24+
* Switch to using `ansible_facts` wherever possible.
2325
* Major backend refactoring to reduce the number of files and tasks.
2426
* You can now specify an `nginx_repository` for NGINX Plus too.
2527
* Moved "constant" variables to `vars/main.yml`.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ Working functional playbook examples can be found in the **`molecule/common/`**
181181

182182
- **[molecule/common/playbooks/default_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/default_converge.yml):** Install a specific version of NGINX and set up logrotate
183183
- **[molecule/common/playbooks/module_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/module_converge.yml):** Install various NGINX supported modules
184+
- **[molecule/common/playbooks/plus_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/plus_converge.yml):** Install NGINX Plus and various NGINX Plus supported modules
184185
- **[molecule/common/playbooks/source_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/source_converge.yml):** Install NGINX from source
185186
- **[molecule/common/playbooks/stable_push_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/stable_push_converge.yml):** Install NGINX using the stable branch and push a preexisting config from your system to your NGINX instance
186187
- **[molecule/common/playbooks/template_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/template_converge.yml):** Use the NGINX configuration templating variables to create an NGINX configuration file

defaults/main/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ nginx_debug_output: false
2626
# Default is 'opensource'.
2727
nginx_type: opensource
2828

29-
# Specify which version of NGINX you want to install.
30-
# Default is empty.
29+
# (Optional) Specify which version of NGINX you want to install.
30+
# Default is to install the latest release.
3131
# nginx_version: "=19-1~bionic"
3232
# For NGINX Plus and modules you'll need a wilcard like below (which installs plus-20 and modules)
3333
# nginx_version: "-20*"
@@ -57,11 +57,11 @@ nginx_install_source_pcre: false
5757
nginx_install_source_openssl: true
5858
nginx_install_source_zlib: false
5959

60-
# Choose where to fetch the NGINX signing key from.
60+
# (Optional) Choose where to fetch the NGINX signing key from.
6161
# Default is the official NGINX signing key host.
6262
# nginx_signing_key: http://nginx.org/keys/nginx_signing.key
6363

64-
# Specify repository for NGINX Open Source or NGINX Plus.
64+
# (Optional) Specify repository for NGINX Open Source or NGINX Plus.
6565
# Only works if 'install_from' is set to 'nginx_repository' when installing NGINX Open Source.
6666
# Defaults are the official NGINX repositories.
6767
# nginx_repository: deb [arch=amd64] https://nginx.org/packages/mainline/debian/ buster nginx
@@ -83,8 +83,8 @@ nginx_license:
8383
nginx_setup_license: true
8484

8585
# Remove NGINX Plus license and repository after installation for security purposes.
86-
# Default is false.
87-
nginx_remove_license: false
86+
# Default is true.
87+
nginx_remove_license: true
8888

8989
# Install NGINX Modules.
9090
# You can select any of the modules listed below. Beware of NGINX Plus only modules (these are marked).

handlers/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
---
2+
- name: (Handler) Systemd daemon-reload
3+
systemd:
4+
daemon_reload: yes
5+
26
- name: (Handler) Check NGINX
37
command: nginx -t
48
register: config
@@ -12,10 +16,6 @@
1216
when: config.rc != 0
1317
listen: (Handler) Run NGINX
1418

15-
- name: (Handler) Systemd daemon-reload
16-
systemd:
17-
daemon_reload: yes
18-
1919
- name: (Handler) Start/Reload NGINX
2020
service:
2121
name: nginx
@@ -24,7 +24,7 @@
2424
when:
2525
- nginx_start | bool
2626
- not ansible_check_mode | bool
27-
listen: "(Handler) Run NGINX"
27+
listen: (Handler) Run NGINX
2828

2929
- name: (Handler) Start NGINX Amplify agent
3030
service:

molecule/common/playbooks/plus_converge.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
vars:
99
nginx_type: plus
1010
nginx_license:
11-
certificate: ../../ansible-role-nginx/files/license/nginx-repo.crt
12-
key: ../../ansible-role-nginx/files/license/nginx-repo.key
11+
certificate: license/nginx-repo.crt
12+
key: license/nginx-repo.key
13+
nginx_remove_license: false
1314
nginx_modules:
1415
- auth-spnego
1516
- brotli
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
- name: Prepare
3+
hosts: localhost
4+
gather_facts: false
5+
tasks:
6+
- name: Create ephemeral license certificate file from b64 decoded env var
7+
copy:
8+
content: "{{ lookup('env','NGINX_CRT') | b64decode }}"
9+
dest: ../../../files/license/nginx-repo.crt
10+
force: no
11+
mode: 0444
12+
13+
- name: Create ephemeral license key file from b64 decoded env var
14+
copy:
15+
content: "{{ lookup('env','NGINX_KEY') | b64decode }}"
16+
dest: ../../../files/license/nginx-repo.key
17+
force: no
18+
mode: 0444

molecule/common/playbooks/plus_verify.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
- name: Verify
33
hosts: all
44
tasks:
5+
- name: Check if NGINX is installed
6+
package:
7+
name: nginx-plus
8+
check_mode: yes
9+
register: install
10+
failed_when: (install is changed) or (install is failed)
11+
512
- name: Check if NGINX service is running
613
service:
714
name: nginx

molecule/plus/molecule.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ platforms:
4444
provisioner:
4545
name: ansible
4646
playbooks:
47+
prepare: ../common/playbooks/plus_prepare.yml
4748
converge: ../common/playbooks/plus_converge.yml
4849
verify: ../common/playbooks/plus_verify.yml

molecule/plus_alpine/molecule.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ platforms:
3030
provisioner:
3131
name: ansible
3232
playbooks:
33+
prepare: ../common/playbooks/plus_prepare.yml
3334
converge: ../common/playbooks/plus_converge.yml
3435
verify: ../common/playbooks/plus_verify.yml

0 commit comments

Comments
 (0)