Skip to content

Commit 894fe47

Browse files
authored
Add support for installing NGINX OSS in Amazon Linux (#435)
1 parent e42253f commit 894fe47

File tree

12 files changed

+91
-65
lines changed

12 files changed

+91
-65
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## 0.21.1 (Unreleased)
4+
5+
FEATURES:
6+
7+
Support installing NGINX OSS in Amazon Linux.
8+
9+
ENHANCEMENTS:
10+
11+
* Update the README and Ansible metadata matrix of supported distributions.
12+
* Update the Molecule tests to include the newly supported distributions and remove distributions that are no longer supported.
13+
314
## 0.21.0 (August 11, 2021)
415

516
BREAKING CHANGES:

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,28 @@ The NGINX Ansible role supports all platforms supported by [NGINX Open Source](h
5555

5656
```yaml
5757
Alpine:
58-
- 3.10
5958
- 3.11
6059
- 3.12
6160
- 3.13
61+
- 3.14
62+
Amazon Linux:
63+
- 2
6264
CentOS:
6365
- 7.4+
6466
- 8
6567
Debian:
6668
- buster
69+
- bullseye
6770
Red Hat:
6871
- 7.4+
6972
- 8
7073
SUSE/SLES:
7174
- 12
7275
- 15
7376
Ubuntu:
74-
- xenial
7577
- bionic
7678
- focal
77-
- groovy
79+
- hirsute
7880
```
7981

8082
### NGINX Plus

meta/main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,22 @@ galaxy_info:
2323
- name: Debian
2424
versions:
2525
- buster
26+
- bullseye
2627
- name: EL
2728
versions:
2829
- 7
2930
- 8
3031
- name: FreeBSD
3132
versions:
32-
- 11.2
33+
- 11.4
3334
- 12.1
35+
- 13
3436
- name: Ubuntu
3537
versions:
3638
- xenial
3739
- bionic
3840
- focal
39-
- groovy
41+
- hirsute
4042
- name: SLES
4143
versions:
4244
- 12

molecule/common/Dockerfile.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ ENV {{ var }} {{ value }}
1717
RUN \
1818
if [ $(command -v apt-get) ]; then \
1919
apt-get update \
20-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y aptitude bash ca-certificates curl iproute2 python-apt python3 python3-apt procps sudo systemd systemd-sysv vim \
20+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y aptitude bash ca-certificates curl iproute2 python3 python3-apt procps sudo systemd systemd-sysv vim \
2121
&& apt-get clean; \
2222
elif [ $(command -v dnf) ]; then \
2323
dnf makecache \
2424
&& dnf --assumeyes install bash iproute sudo /usr/bin/dnf-3 /usr/bin/python3 /usr/bin/python3-config vim \
2525
&& dnf clean all; \
2626
elif [ $(command -v yum) ]; then \
2727
yum makecache fast \
28-
&& yum install -y bash iproute sudo /usr/bin/python /usr/bin/python2-config vim yum-plugin-ovl \
28+
&& yum install -y bash iproute initscripts sudo /usr/bin/python /usr/bin/python2-config vim yum-plugin-ovl \
2929
&& sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf \
3030
&& yum clean all; \
3131
elif [ $(command -v zypper) ]; then \

molecule/default/converge.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
pre_tasks:
55
- name: Set repo if Alpine
66
set_fact:
7-
version: "=1.19.8-r1"
7+
version: "=1.21.1-r1"
88
when: ansible_facts['os_family'] == "Alpine"
99
- name: Set repo if Debian
1010
set_fact:
11-
version: "=1.19.8-1~{{ ansible_facts['distribution_release'] }}"
11+
version: "=1.21.1-1~{{ ansible_facts['distribution_release'] }}"
1212
when: ansible_facts['os_family'] == "Debian"
1313
- name: Set repo if Red Hat
1414
set_fact:
15-
version: "-1.19.8-1.el{{ ansible_facts['distribution_major_version'] }}.ngx"
15+
version: "-1.21.1-1.{{ (ansible_facts['distribution']=='Amazon') | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx"
1616
when: ansible_facts['os_family'] == "RedHat"
1717
- name: Enable NGINX @CentOS-AppStream dnf modules
1818
shell:

molecule/default/molecule.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ lint: |
66
yamllint .
77
ansible-lint --force-color
88
platforms:
9-
- name: alpine-3.10
10-
image: alpine:3.10
11-
dockerfile: ../common/Dockerfile.j2
12-
privileged: true
13-
volumes:
14-
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
15-
command: "/sbin/init"
169
- name: alpine-3.11
1710
image: alpine:3.11
1811
dockerfile: ../common/Dockerfile.j2
@@ -34,6 +27,20 @@ platforms:
3427
volumes:
3528
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
3629
command: "/sbin/init"
30+
- name: alpine-3.14
31+
image: alpine:3.14
32+
dockerfile: ../common/Dockerfile.j2
33+
privileged: true
34+
volumes:
35+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
36+
command: "/sbin/init"
37+
- name: amazonlinux
38+
image: amazonlinux:2
39+
dockerfile: ../common/Dockerfile.j2
40+
privileged: true
41+
volumes:
42+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
43+
command: "/usr/sbin/init"
3744
- name: centos-7
3845
image: centos:7
3946
dockerfile: ../common/Dockerfile.j2
@@ -55,8 +62,8 @@ platforms:
5562
volumes:
5663
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
5764
command: "/sbin/init"
58-
- name: ubuntu-xenial
59-
image: ubuntu:xenial
65+
- name: debian-bullseye
66+
image: debian:bullseye-slim
6067
dockerfile: ../common/Dockerfile.j2
6168
privileged: true
6269
volumes:

molecule/module/molecule.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ lint: |
66
yamllint .
77
ansible-lint --force-color
88
platforms:
9-
- name: alpine-3.10
10-
image: alpine:3.10
11-
dockerfile: ../common/Dockerfile.j2
12-
privileged: true
13-
volumes:
14-
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
15-
command: "/sbin/init"
169
- name: alpine-3.11
1710
image: alpine:3.11
1811
dockerfile: ../common/Dockerfile.j2
@@ -34,6 +27,20 @@ platforms:
3427
volumes:
3528
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
3629
command: "/sbin/init"
30+
- name: alpine-3.14
31+
image: alpine:3.14
32+
dockerfile: ../common/Dockerfile.j2
33+
privileged: true
34+
volumes:
35+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
36+
command: "/sbin/init"
37+
- name: amazonlinux
38+
image: amazonlinux:2
39+
dockerfile: ../common/Dockerfile.j2
40+
privileged: true
41+
volumes:
42+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
43+
command: "/usr/sbin/init"
3744
- name: centos-7
3845
image: centos:7
3946
dockerfile: ../common/Dockerfile.j2
@@ -55,8 +62,8 @@ platforms:
5562
volumes:
5663
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
5764
command: "/sbin/init"
58-
- name: ubuntu-xenial
59-
image: ubuntu:xenial
65+
- name: debian-bullseye
66+
image: debian:bullseye-slim
6067
dockerfile: ../common/Dockerfile.j2
6168
privileged: true
6269
volumes:

molecule/plus/converge.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
- cookie-flag
1818
- encrypted-session
1919
- geoip
20-
- geoip2
20+
- "{{ ansible_facts['distribution'] == 'Amazon' | ternary('', 'geoip2') }}"
2121
- headers-more
2222
- image-filter
2323
- lua
2424
- njs
25-
- opentracing
25+
- "{{ ansible_facts['distribution'] == 'Amazon' | ternary('', 'opentracing') }}"
2626
- passenger
2727
- perl
2828
- prometheus

molecule/plus/molecule.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ platforms:
3434
volumes:
3535
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
3636
command: "/sbin/init"
37+
- name: amazonlinux
38+
image: amazonlinux:2
39+
dockerfile: ../common/Dockerfile.j2
40+
privileged: true
41+
volumes:
42+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
43+
command: "/usr/sbin/init"
3744
- name: centos-7
3845
image: centos:7
3946
dockerfile: ../common/Dockerfile.j2

molecule/source/molecule.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ lint: |
66
yamllint .
77
ansible-lint --force-color
88
platforms:
9-
- name: alpine-3.10
10-
image: alpine:3.10
11-
dockerfile: ../common/Dockerfile.j2
12-
privileged: true
13-
volumes:
14-
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
15-
command: "/sbin/init"
169
- name: alpine-3.11
1710
image: alpine:3.11
1811
dockerfile: ../common/Dockerfile.j2
@@ -34,6 +27,20 @@ platforms:
3427
volumes:
3528
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
3629
command: "/sbin/init"
30+
- name: alpine-3.14
31+
image: alpine:3.14
32+
dockerfile: ../common/Dockerfile.j2
33+
privileged: true
34+
volumes:
35+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
36+
command: "/sbin/init"
37+
- name: amazonlinux
38+
image: amazonlinux:2
39+
dockerfile: ../common/Dockerfile.j2
40+
privileged: true
41+
volumes:
42+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
43+
command: "/usr/sbin/init"
3744
- name: centos-7
3845
image: centos:7
3946
dockerfile: ../common/Dockerfile.j2
@@ -55,8 +62,8 @@ platforms:
5562
volumes:
5663
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
5764
command: "/sbin/init"
58-
- name: ubuntu-xenial
59-
image: ubuntu:xenial
65+
- name: debian-bullseye
66+
image: debian:bullseye-slim
6067
dockerfile: ../common/Dockerfile.j2
6168
privileged: true
6269
volumes:

tasks/opensource/install-redhat.yml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,20 @@
11
---
2-
- name: (CentOS/RHEL 6/7) Configure NGINX repository
2+
- name: (Amazon Linux/CentOS/RHEL) Configure NGINX repository
33
yum_repository:
44
name: nginx
5-
baseurl: "{{ nginx_repository | default(nginx_default_repository_redhat) }}"
5+
baseurl: "{{ nginx_repository |
6+
default(lookup('vars', 'nginx_default_repository_' + ((ansible_facts['distribution'] == 'Amazon') | ternary('amazon', 'redhat')))) }}"
67
description: NGINX Repository
78
enabled: true
89
gpgcheck: true
910
mode: 0644
10-
when:
11-
- ansible_facts['distribution_major_version'] is version('8', '<')
12-
- nginx_manage_repo | bool
11+
module_hotfixes: true
12+
when: nginx_manage_repo | bool
1313

14-
- name: (CentOS/RHEL 8) Configure NGINX repository
15-
blockinfile:
16-
path: /etc/yum.repos.d/nginx.repo
17-
create: true
18-
block: |
19-
[nginx]
20-
baseurl = {{ nginx_repository | default(nginx_default_repository_redhat) }}
21-
enabled = 1
22-
gpgcheck = 1
23-
name = NGINX Repository
24-
module_hotfixes = true
25-
mode: 0644
26-
when:
27-
- ansible_facts['distribution_major_version'] is version('8', '==')
28-
- nginx_manage_repo | bool
29-
30-
- name: (CentOS/RHEL) Install NGINX
14+
- name: (Amazon Linux/CentOS/RHEL) Install NGINX
3115
yum:
3216
name: "nginx{{ nginx_version | default('') }}"
3317
state: "{{ nginx_state }}"
34-
disablerepo: "*"
35-
enablerepo: nginx
3618
update_cache: true
3719
ignore_errors: "{{ ansible_check_mode }}"
3820
notify: (Handler) Run NGINX

vars/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Supported NGINX Open Source distributions
33
# https://nginx.org/en/docs/install.html
44
nginx_distributions: [
5-
'Alpine', 'CentOS', 'Debian', 'FreeBSD', 'RedHat', 'SLES', 'Ubuntu',
5+
'Alpine', 'Amazon', 'CentOS', 'Debian', 'FreeBSD', 'RedHat', 'SLES', 'Ubuntu',
66
'NetBSD', 'OpenBSD', 'DragonFlyBSD', 'HardenedBSD',
77
]
88

@@ -19,6 +19,7 @@ nginx_default_signing_key_pgp: https://nginx.org/keys/nginx_signing.key
1919
# Default NGINX Open Source repositories
2020
nginx_default_repository_alpine: "https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
2121
alpine/v{{ ansible_facts['distribution_version'] | regex_search('^[0-9]+\\.[0-9]+') }}/main"
22+
nginx_default_repository_amazon: "https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}/amzn2/$releasever/$basearch"
2223
nginx_default_repository_debian:
2324
- "deb [arch={{ (ansible_facts['architecture'] == 'aarch64') | ternary('arm64', 'amd64') }}] https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
2425
{{ ansible_facts['distribution'] | lower }}/ {{ ansible_facts['distribution_release'] }} nginx"
@@ -53,7 +54,7 @@ nginx_debian_dependencies: [
5354

5455
# Red Hat dependencies
5556
nginx_redhat_dependencies: [
56-
'ca-certificates', 'openssl',
57+
'ca-certificates', 'openssl', 'yum-utils',
5758
]
5859

5960
# SLES dependencies

0 commit comments

Comments
 (0)