Skip to content

Commit 1cadc0b

Browse files
committed
Add stable and version Molecule scenarios (#581)
1 parent b1b7f92 commit 1cadc0b

File tree

26 files changed

+334
-54
lines changed

26 files changed

+334
-54
lines changed

.github/workflows/molecule.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ jobs:
2525
scenario:
2626
- default
2727
- downgrade
28-
- downgrade_plus
29-
- module
28+
- downgrade-plus
3029
- plus
3130
- source
31+
- stable
3232
- uninstall
33-
- uninstall_plus
33+
- uninstall-plus
3434
- upgrade
35-
- upgrade_plus
35+
- upgrade-plus
36+
- version
3637
steps:
3738
- name: Check out the codebase
3839
if: ${{ !(contains(matrix.scenario, 'plus')) || (env.NGINX_CRT != 0 && env.NGINX_KEY != 0) }}

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ ENHANCEMENTS:
3131

3232
BUG FIXES:
3333

34+
* Specifying a module version would result in an invalid package name on Alpine Linux.
3435
* Fix an issue when installing the GeoIP2 module on an UBI 7 container where the the `libmaxminddb` package dependency might not be available via `yum` (if it's not available, `libmaxminddb` is installed from an external source).
3536
* GitHub actions should now correctly skip \*plus\* scenarios only when the NGINX Plus license secrets are not present.
3637
* Update the versions of the various packages required to build NGINX from source. The version of `zlib` listed in the role was no longer available.
@@ -40,8 +41,11 @@ BUG FIXES:
4041
TESTS:
4142

4243
* Update GitHub actions to run on Ubuntu 22.04 (and thus support `cgroups` v2).
43-
* Explicitly specify `x86_64`/`amd64` as the platform used in the Amazon Linux 2/CentOS/Oracle Linux/RHEL 7/SLES 15 Molecule Docker images. This will ensure that tests work when run on different host architectures (e.g. newer Macbooks with `aarch64`/`arm64` processors) when running tests in distributions that only support `x86_64` (either due to lack of support for a `cgroups` v2 backport or due to lack of builds for `aarch64`).
44+
* Explicitly specify `x86_64`/`amd64` as the platform used in the Amazon Linux 2/CentOS/Oracle Linux/RHEL 7/SLES 15 Molecule Docker images. This will ensure that tests work when run on different host architectures (e.g. newer Macbooks with `aarch64`/`arm64` processors) when running tests in distributions that only support `x86_64`/`amd64` (either due to lack of support for a `cgroups` v2 backport or due to lack of builds for `aarch64`/`arm64`).
4445
* Explicitly test some distributions using `aarch64` and `s390x` as the Molecule platform. This should ensure the role works as intended across the various architectures that are officially supported.
46+
* Combine the `module` Molecule scenario with the `default` scenario.
47+
* Add `stable` and `version` Molecule scenario.
48+
* Replace underscores with dashes in Molecule scenario names to improve naming consistency across the role.
4549

4650
## 0.23.2 (September 28, 2022)
4751

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,17 @@ Working functional playbook examples can be found in the **[`molecule/`](https:/
190190

191191
| Name | Description |
192192
| ---- | ----------- |
193-
| **[`default/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/default/converge.yml)** | Install a specific version of NGINX and set up logrotate |
193+
| **[`default/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/default/converge.yml)** | Install a specific version of NGINX, install various NGINX supported modules, tweak systemd and set up logrotate |
194194
| **[`downgrade/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/downgrade/converge.yml)** | Downgrade to a specific version of NGINX |
195-
| **[`downgrade_plus/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/downgrade_plus/converge.yml)** | Downgrade to a specific version of NGINX Plus |
196-
| **[`module/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/module/converge.yml)** | Install various NGINX supported modules |
195+
| **[`downgrade-plus/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/downgrade-plus/converge.yml)** | Downgrade to a specific version of NGINX Plus |
197196
| **[`plus/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/plus/converge.yml)** | Install NGINX Plus and various NGINX Plus supported modules |
198197
| **[`source/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/source/converge.yml)** | Install NGINX from source |
198+
| **[`stable/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/stable/converge.yml)** | Install NGINX using the latest stable release |
199199
| **[`uninstall/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/uninstall/converge.yml)** | Uninstall NGINX |
200-
| **[`uninstall_plus/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/uninstall_plus/converge.yml)** | Uninstall NGINX Plus |
200+
| **[`uninstall-plus/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/uninstall-plus/converge.yml)** | Uninstall NGINX Plus |
201201
| **[`upgrade/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/upgrade/converge.yml)** | Upgrade NGINX |
202-
| **[`upgrade_plus/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/upgrade_plus/converge.yml)** | Upgrade NGINX Plus |
202+
| **[`upgrade-plus/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/upgrade-plus/converge.yml)** | Upgrade NGINX Plus |
203+
| **[`version/converge.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/version/converge.yml)** | Install a specific version of NGINX and various NGINX modules |
203204

204205
Do note that if you install this repository via Ansible Galaxy, you will have to replace the role variable in the sample playbooks from `ansible-role-nginx` to `nginxinc.nginx`.
205206

molecule/default/converge.yml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
---
22
- name: Converge
33
hosts: all
4-
pre_tasks:
5-
- name: Set repo if Alpine
6-
ansible.builtin.set_fact:
7-
version: =1.23.2-r1
8-
when: ansible_facts['os_family'] == "Alpine"
9-
- name: Set repo if Debian
10-
ansible.builtin.set_fact:
11-
version: =1.23.2-1~{{ ansible_facts['distribution_release'] }}
12-
when: ansible_facts['os_family'] == "Debian"
13-
- name: Set repo if Red Hat
14-
ansible.builtin.set_fact:
15-
version: -1.23.2-1.{{ (ansible_facts['distribution'] == "Amazon") | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx
16-
when: ansible_facts['os_family'] == "RedHat"
17-
- name: Set repo if SLES
18-
ansible.builtin.set_fact:
19-
version: =1.23.2-1.sles{{ ansible_facts['distribution_major_version'] }}.ngx
20-
when: ansible_facts['os_family'] == "Suse"
214
tasks:
225
- name: Install NGINX
236
ansible.builtin.include_role:
247
name: ansible-role-nginx
258
vars:
26-
nginx_version: "{{ version }}"
9+
nginx_modules:
10+
- brotli
11+
- geoip
12+
- image-filter
13+
- njs
14+
- perl
15+
- xslt
2716
nginx_service_modify: true
2817
nginx_service_timeout: 95
2918
nginx_logrotate_conf_enable: true

molecule/default/verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
chdir: "{{ ((ansible_facts['system'] | lower is not search('bsd')) | ternary('/etc/nginx', '/usr/local/sbin')) }}"
3131
changed_when: false
3232
register: version
33-
failed_when: version is not search('1.23.2')
33+
failed_when: version is not search('1.23.3')

molecule/module/converge.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

molecule/stable/converge.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
- name: Converge
3+
hosts: all
4+
tasks:
5+
- name: Install NGINX
6+
ansible.builtin.include_role:
7+
name: ansible-role-nginx
8+
vars:
9+
nginx_branch: stable
File renamed without changes.

molecule/module/verify.yml renamed to molecule/stable/verify.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@
2323
ansible.builtin.uri:
2424
url: http://localhost
2525
status_code: 200
26+
27+
- name: Verify correct version of NGINX has been installed
28+
ansible.builtin.command: nginx -v
29+
args:
30+
chdir: "{{ ((ansible_facts['system'] | lower is not search('bsd')) | ternary('/etc/nginx', '/usr/local/sbin')) }}"
31+
changed_when: false
32+
register: version
33+
failed_when: version is not search('1.22.1')
File renamed without changes.
File renamed without changes.

molecule/version/converge.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
- name: Converge
3+
hosts: all
4+
pre_tasks:
5+
- name: Set repo if Alpine
6+
ansible.builtin.set_fact:
7+
ngx_version: =1.23.2-r1
8+
njs: =1.23.2.7.9-r1
9+
when: ansible_facts['os_family'] == "Alpine"
10+
- name: Set repo if Debian
11+
ansible.builtin.set_fact:
12+
ngx_version: =1.23.2-1~{{ ansible_facts['distribution_release'] }}
13+
njs_version: =1.23.2+0.7.9-1~{{ ansible_facts['distribution_release'] }}
14+
when: ansible_facts['os_family'] == "Debian"
15+
- name: Set repo if Red Hat
16+
ansible.builtin.set_fact:
17+
ngx_version: -1.23.2-1.{{ (ansible_facts['distribution'] == "Amazon") | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx
18+
njs_version: -1.23.2+0.7.9-1.{{ (ansible_facts['distribution'] == "Amazon") | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx
19+
when: ansible_facts['os_family'] == "RedHat"
20+
- name: Set repo if SLES
21+
ansible.builtin.set_fact:
22+
ngx_version: =1.23.2-1.sles{{ ansible_facts['distribution_major_version'] }}.ngx
23+
njs_version: =1.23.2+0.7.9-1.sles{{ ansible_facts['distribution_major_version'] }}.ngx
24+
when: ansible_facts['os_family'] == "Suse"
25+
tasks:
26+
- name: Install NGINX
27+
ansible.builtin.include_role:
28+
name: ansible-role-nginx
29+
vars:
30+
nginx_version: "{{ ngx_version }}"
31+
nginx_modules:
32+
- name: brotli
33+
version: "{{ ngx_version }}"
34+
- name: geoip
35+
version: "{{ ngx_version }}"
36+
- name: image-filter
37+
version: "{{ ngx_version }}"
38+
- name: njs
39+
state: present
40+
version: "{{ njs_version }}"
41+
- name: perl
42+
version: "{{ ngx_version }}"
43+
- name: xslt
44+
version: "{{ ngx_version }}"
45+
nginx_service_modify: true
46+
nginx_service_timeout: 95
47+
nginx_logrotate_conf_enable: true
48+
nginx_logrotate_conf:
49+
paths:
50+
- /var/log/nginx/*.log
51+
options:
52+
- daily
53+
- missingok
54+
- rotate 14
55+
- compress
56+
- delaycompress
57+
- notifempty
58+
- sharedscripts

molecule/version/molecule.yml

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
---
2+
driver:
3+
name: docker
4+
lint: |
5+
set -e
6+
ansible-lint --force-color
7+
platforms:
8+
- name: almalinux-8
9+
image: almalinux:8
10+
dockerfile: ../common/Dockerfile.j2
11+
privileged: true
12+
cgroupns_mode: host
13+
volumes:
14+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
15+
command: /usr/sbin/init
16+
- name: almalinux-9
17+
image: almalinux:9
18+
dockerfile: ../common/Dockerfile.j2
19+
privileged: true
20+
cgroupns_mode: host
21+
volumes:
22+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
23+
command: /usr/sbin/init
24+
- name: alpine-3.14
25+
image: alpine:3.14
26+
dockerfile: ../common/Dockerfile.j2
27+
privileged: true
28+
cgroupns_mode: host
29+
volumes:
30+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
31+
command: /sbin/init
32+
- name: alpine-3.15
33+
image: alpine:3.15
34+
dockerfile: ../common/Dockerfile.j2
35+
privileged: true
36+
cgroupns_mode: host
37+
volumes:
38+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
39+
command: /sbin/init
40+
- name: alpine-3.16
41+
image: alpine:3.16
42+
platform: x86_64
43+
dockerfile: ../common/Dockerfile.j2
44+
privileged: true
45+
cgroupns_mode: host
46+
volumes:
47+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
48+
command: /sbin/init
49+
- name: alpine-3.17
50+
image: alpine:3.17
51+
platform: aarch64
52+
dockerfile: ../common/Dockerfile.j2
53+
privileged: true
54+
cgroupns_mode: host
55+
volumes:
56+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
57+
command: /sbin/init
58+
- name: amazonlinux-2
59+
image: amazonlinux:2
60+
platform: x86_64
61+
dockerfile: ../common/Dockerfile.j2
62+
privileged: true
63+
cgroupns_mode: host
64+
volumes:
65+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
66+
command: /usr/sbin/init
67+
- name: centos-7
68+
image: centos:7
69+
platform: x86_64
70+
dockerfile: ../common/Dockerfile.j2
71+
privileged: true
72+
cgroupns_mode: host
73+
volumes:
74+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
75+
command: /usr/sbin/init
76+
- name: debian-bullseye
77+
image: debian:bullseye-slim
78+
dockerfile: ../common/Dockerfile.j2
79+
privileged: true
80+
cgroupns_mode: host
81+
volumes:
82+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
83+
command: /sbin/init
84+
- name: oraclelinux-7
85+
image: oraclelinux:7
86+
platform: x86_64
87+
dockerfile: ../common/Dockerfile.j2
88+
privileged: true
89+
cgroupns_mode: host
90+
volumes:
91+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
92+
command: /usr/sbin/init
93+
- name: oraclelinux-8
94+
image: oraclelinux:8
95+
dockerfile: ../common/Dockerfile.j2
96+
privileged: true
97+
cgroupns_mode: host
98+
volumes:
99+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
100+
command: /usr/sbin/init
101+
- name: oraclelinux-9
102+
image: oraclelinux:9
103+
dockerfile: ../common/Dockerfile.j2
104+
privileged: true
105+
cgroupns_mode: host
106+
volumes:
107+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
108+
command: /usr/sbin/init
109+
- name: rhel-7
110+
image: registry.access.redhat.com/ubi7:7.9
111+
platform: x86_64
112+
dockerfile: ../common/Dockerfile.j2
113+
privileged: true
114+
cgroupns_mode: host
115+
volumes:
116+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
117+
command: /usr/sbin/init
118+
- name: rhel-8
119+
image: redhat/ubi8:8.7
120+
platform: s390x
121+
dockerfile: ../common/Dockerfile.j2
122+
privileged: true
123+
cgroupns_mode: host
124+
volumes:
125+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
126+
command: /usr/sbin/init
127+
- name: rhel-9
128+
image: redhat/ubi9:9.1.0
129+
platform: aarch64
130+
dockerfile: ../common/Dockerfile.j2
131+
privileged: true
132+
cgroupns_mode: host
133+
volumes:
134+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
135+
command: /usr/sbin/init
136+
- name: rockylinux-8
137+
image: rockylinux:8
138+
dockerfile: ../common/Dockerfile.j2
139+
privileged: true
140+
cgroupns_mode: host
141+
volumes:
142+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
143+
command: /usr/sbin/init
144+
- name: rockylinux-9
145+
image: rockylinux:9.0.20220720
146+
dockerfile: ../common/Dockerfile.j2
147+
privileged: true
148+
cgroupns_mode: host
149+
volumes:
150+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
151+
command: /usr/sbin/init
152+
- name: sles15
153+
image: registry.suse.com/bci/bci-base:15.4
154+
platform: x86_64
155+
dockerfile: ../common/Dockerfile.j2
156+
privileged: true
157+
cgroupns_mode: host
158+
volumes:
159+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
160+
command: /usr/sbin/init
161+
- name: ubuntu-bionic
162+
image: ubuntu:bionic
163+
platform: x86_64
164+
dockerfile: ../common/Dockerfile.j2
165+
privileged: true
166+
cgroupns_mode: host
167+
volumes:
168+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
169+
command: /sbin/init
170+
- name: ubuntu-focal
171+
image: ubuntu:focal
172+
platform: s390x
173+
dockerfile: ../common/Dockerfile.j2
174+
privileged: true
175+
cgroupns_mode: host
176+
volumes:
177+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
178+
command: /sbin/init
179+
- name: ubuntu-jammy
180+
image: ubuntu:jammy
181+
platform: aarch64
182+
dockerfile: ../common/Dockerfile.j2
183+
privileged: true
184+
cgroupns_mode: host
185+
volumes:
186+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
187+
command: /sbin/init
188+
provisioner:
189+
name: ansible
190+
log: true
191+
playbooks:
192+
converge: converge.yml
193+
verify: verify.yml

0 commit comments

Comments
 (0)