Skip to content

Commit 35ad84e

Browse files
committed
Add stable Molecule test
1 parent b1b7f92 commit 35ad84e

File tree

22 files changed

+45
-33
lines changed

22 files changed

+45
-33
lines changed

.github/workflows/molecule.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ 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
3636
steps:
3737
- name: Check out the codebase
3838
if: ${{ !(contains(matrix.scenario, 'plus')) || (env.NGINX_CRT != 0 && env.NGINX_KEY != 0) }}

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ BUG FIXES:
4040
TESTS:
4141

4242
* 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`).
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`/`amd64` (either due to lack of support for a `cgroups` v2 backport or due to lack of builds for `aarch64`/`arm64`).
4444
* 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.
45+
* Combine the `module` Molecule scenario with the `default` scenario.
46+
* Add `stable` Molecule scenario.
47+
* Replace underscores with dashes in Molecule scenario names to improve naming consistency across the role.
4548

4649
## 0.23.2 (September 28, 2022)
4750

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,16 @@ 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 |
203203

204204
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`.
205205

molecule/default/converge.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
name: ansible-role-nginx
2525
vars:
2626
nginx_version: "{{ version }}"
27+
nginx_modules:
28+
- brotli
29+
- geoip
30+
- image-filter
31+
- name: njs
32+
state: present
33+
- perl
34+
- xslt
2735
nginx_service_modify: true
2836
nginx_service_timeout: 95
2937
nginx_logrotate_conf_enable: true

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.

tasks/modules/install-modules.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,34 @@
77
- '"geoip" in nginx_modules'
88
- nginx_install_epel_release | bool
99

10-
- name: (Amazon Linux 2/RHEL 7) Install GeoIP2 dependency
10+
- name: (Amazon Linux/RHEL 7) Install GeoIP2 dependency
1111
when:
1212
- (ansible_facts['distribution'] == "RedHat" and ansible_facts['distribution_major_version'] is version('7', '=='))
1313
or ansible_facts['distribution'] == "Amazon"
1414
- '"geoip2" in nginx_modules'
1515
block:
16-
- name: (Amazon Linux 2/RHEL 7) Check if libmaxminddb is available
16+
- name: (Amazon Linux/RHEL 7) Check if libmaxminddb is available
1717
ansible.builtin.yum:
1818
list: available
1919
register: packages
2020

21-
- name: (Amazon Linux 2/RHEL 7) Install libmaxminddb
21+
- name: (Amazon Linux/RHEL 7) Install libmaxminddb
2222
ansible.builtin.yum:
2323
name: https://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/libmaxminddb-1.2.0-6.el7.x86_64.rpm
2424
when: '"libmaxminddb" not in packages.results'
2525

26-
- name: (AlmaLinux/Amazon Linux 2/Oracle Linux/RHEL/Rocky Linux) Install GeoIP2 and/or OpenTracing EPEL dependency
26+
- name: (AlmaLinux/Amazon Linux/Oracle Linux/RHEL/Rocky Linux) Install GeoIP2 and/or OpenTracing EPEL dependency
2727
when:
2828
- ansible_facts['os_family'] == "RedHat"
2929
- ('"opentracing" in nginx_modules')
3030
- nginx_install_epel_release | bool
3131
block:
32-
- name: (AlmaLinux/Amazon Linux 2/Oracle Linux/RHEL/Rocky Linux) Import EPEL GPG key
32+
- name: (AlmaLinux/Amazon Linux/Oracle Linux/RHEL/Rocky Linux) Import EPEL GPG key
3333
ansible.builtin.rpm_key:
3434
state: present
3535
key: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ((ansible_facts['distribution'] == 'Amazon') | ternary('7', ansible_facts['distribution_major_version'])) }}
3636

37-
- name: (AlmaLinux/Amazon Linux 2/Oracle Linux/RHEL/Rocky Linux) Install EPEL
37+
- name: (AlmaLinux/Amazon Linux/Oracle Linux/RHEL/Rocky Linux) Install EPEL
3838
ansible.builtin.yum:
3939
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ((ansible_facts['distribution'] == 'Amazon') | ternary('7', ansible_facts['distribution_major_version'])) }}.noarch.rpm
4040

tasks/opensource/install-source.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
ansible.builtin.yum_repository:
2525
name: ol7_optional_latest
2626
description: Oracle Linux 7 optional repositories
27-
baseurl: https://yum.oracle.com/repo/OracleLinux/OL7/optional/latest/aarch64/
27+
baseurl: https://yum.oracle.com/repo/OracleLinux/OL7/optional/latest/$basearch/
2828
gpgcheck: true
2929
enabled: true
3030
when: ansible_facts['distribution'] == "OracleLinux" and ansible_facts['distribution_major_version'] is version('7', '==')

0 commit comments

Comments
 (0)