diff --git a/CHANGELOG.md b/CHANGELOG.md index ccf8ede..7e3f8b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 0.21.1 (Unreleased) + +FEATURES: + +Support installing NGINX OSS in Amazon Linux. + +ENHANCEMENTS: + +* Update the README and Ansible metadata matrix of supported distributions. +* Update the Molecule tests to include the newly supported distributions and remove distributions that are no longer supported. + ## 0.21.0 (August 11, 2021) BREAKING CHANGES: diff --git a/README.md b/README.md index 46405e7..752e98e 100644 --- a/README.md +++ b/README.md @@ -55,15 +55,18 @@ The NGINX Ansible role supports all platforms supported by [NGINX Open Source](h ```yaml Alpine: - - 3.10 - 3.11 - 3.12 - 3.13 + - 3.14 +Amazon Linux: + - 2 CentOS: - 7.4+ - 8 Debian: - buster + - bullseye Red Hat: - 7.4+ - 8 @@ -71,10 +74,9 @@ SUSE/SLES: - 12 - 15 Ubuntu: - - xenial - bionic - focal - - groovy + - hirsute ``` ### NGINX Plus diff --git a/meta/main.yml b/meta/main.yml index b3e1c5e..879a79e 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -23,20 +23,22 @@ galaxy_info: - name: Debian versions: - buster + - bullseye - name: EL versions: - 7 - 8 - name: FreeBSD versions: - - 11.2 + - 11.4 - 12.1 + - 13 - name: Ubuntu versions: - xenial - bionic - focal - - groovy + - hirsute - name: SLES versions: - 12 diff --git a/molecule/common/Dockerfile.j2 b/molecule/common/Dockerfile.j2 index a84fd9d..e1dd2b8 100644 --- a/molecule/common/Dockerfile.j2 +++ b/molecule/common/Dockerfile.j2 @@ -17,7 +17,7 @@ ENV {{ var }} {{ value }} RUN \ if [ $(command -v apt-get) ]; then \ apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y aptitude bash ca-certificates curl iproute2 python-apt python3 python3-apt procps sudo systemd systemd-sysv vim \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y aptitude bash ca-certificates curl iproute2 python3 python3-apt procps sudo systemd systemd-sysv vim \ && apt-get clean; \ elif [ $(command -v dnf) ]; then \ dnf makecache \ @@ -25,7 +25,7 @@ RUN \ && dnf clean all; \ elif [ $(command -v yum) ]; then \ yum makecache fast \ - && yum install -y bash iproute sudo /usr/bin/python /usr/bin/python2-config vim yum-plugin-ovl \ + && yum install -y bash iproute initscripts sudo /usr/bin/python /usr/bin/python2-config vim yum-plugin-ovl \ && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf \ && yum clean all; \ elif [ $(command -v zypper) ]; then \ diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 0a5f798..29a82a2 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -4,15 +4,15 @@ pre_tasks: - name: Set repo if Alpine set_fact: - version: "=1.19.8-r1" + version: "=1.21.1-r1" when: ansible_facts['os_family'] == "Alpine" - name: Set repo if Debian set_fact: - version: "=1.19.8-1~{{ ansible_facts['distribution_release'] }}" + version: "=1.21.1-1~{{ ansible_facts['distribution_release'] }}" when: ansible_facts['os_family'] == "Debian" - name: Set repo if Red Hat set_fact: - version: "-1.19.8-1.el{{ ansible_facts['distribution_major_version'] }}.ngx" + version: "-1.21.1-1.{{ (ansible_facts['distribution']=='Amazon') | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx" when: ansible_facts['os_family'] == "RedHat" - name: Enable NGINX @CentOS-AppStream dnf modules shell: diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index d9d5b4a..b6b31a9 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -6,13 +6,6 @@ lint: | yamllint . ansible-lint --force-color platforms: - - name: alpine-3.10 - image: alpine:3.10 - dockerfile: ../common/Dockerfile.j2 - privileged: true - volumes: - - "/sys/fs/cgroup:/sys/fs/cgroup:rw" - command: "/sbin/init" - name: alpine-3.11 image: alpine:3.11 dockerfile: ../common/Dockerfile.j2 @@ -34,6 +27,20 @@ platforms: volumes: - "/sys/fs/cgroup:/sys/fs/cgroup:rw" command: "/sbin/init" + - name: alpine-3.14 + image: alpine:3.14 + dockerfile: ../common/Dockerfile.j2 + privileged: true + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: amazonlinux + image: amazonlinux:2 + dockerfile: ../common/Dockerfile.j2 + privileged: true + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" - name: centos-7 image: centos:7 dockerfile: ../common/Dockerfile.j2 @@ -55,8 +62,8 @@ platforms: volumes: - "/sys/fs/cgroup:/sys/fs/cgroup:rw" command: "/sbin/init" - - name: ubuntu-xenial - image: ubuntu:xenial + - name: debian-bullseye + image: debian:bullseye-slim dockerfile: ../common/Dockerfile.j2 privileged: true volumes: diff --git a/molecule/module/molecule.yml b/molecule/module/molecule.yml index d9d5b4a..b6b31a9 100644 --- a/molecule/module/molecule.yml +++ b/molecule/module/molecule.yml @@ -6,13 +6,6 @@ lint: | yamllint . ansible-lint --force-color platforms: - - name: alpine-3.10 - image: alpine:3.10 - dockerfile: ../common/Dockerfile.j2 - privileged: true - volumes: - - "/sys/fs/cgroup:/sys/fs/cgroup:rw" - command: "/sbin/init" - name: alpine-3.11 image: alpine:3.11 dockerfile: ../common/Dockerfile.j2 @@ -34,6 +27,20 @@ platforms: volumes: - "/sys/fs/cgroup:/sys/fs/cgroup:rw" command: "/sbin/init" + - name: alpine-3.14 + image: alpine:3.14 + dockerfile: ../common/Dockerfile.j2 + privileged: true + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: amazonlinux + image: amazonlinux:2 + dockerfile: ../common/Dockerfile.j2 + privileged: true + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" - name: centos-7 image: centos:7 dockerfile: ../common/Dockerfile.j2 @@ -55,8 +62,8 @@ platforms: volumes: - "/sys/fs/cgroup:/sys/fs/cgroup:rw" command: "/sbin/init" - - name: ubuntu-xenial - image: ubuntu:xenial + - name: debian-bullseye + image: debian:bullseye-slim dockerfile: ../common/Dockerfile.j2 privileged: true volumes: diff --git a/molecule/plus/converge.yml b/molecule/plus/converge.yml index aed358e..c96f91b 100644 --- a/molecule/plus/converge.yml +++ b/molecule/plus/converge.yml @@ -17,12 +17,12 @@ - cookie-flag - encrypted-session - geoip - - geoip2 + - "{{ ansible_facts['distribution'] == 'Amazon' | ternary('', 'geoip2') }}" - headers-more - image-filter - lua - njs - - opentracing + - "{{ ansible_facts['distribution'] == 'Amazon' | ternary('', 'opentracing') }}" - passenger - perl - prometheus diff --git a/molecule/plus/molecule.yml b/molecule/plus/molecule.yml index 701bd91..5c0ec25 100644 --- a/molecule/plus/molecule.yml +++ b/molecule/plus/molecule.yml @@ -34,6 +34,13 @@ platforms: volumes: - "/sys/fs/cgroup:/sys/fs/cgroup:rw" command: "/sbin/init" + - name: amazonlinux + image: amazonlinux:2 + dockerfile: ../common/Dockerfile.j2 + privileged: true + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" - name: centos-7 image: centos:7 dockerfile: ../common/Dockerfile.j2 diff --git a/molecule/source/molecule.yml b/molecule/source/molecule.yml index d9d5b4a..b6b31a9 100644 --- a/molecule/source/molecule.yml +++ b/molecule/source/molecule.yml @@ -6,13 +6,6 @@ lint: | yamllint . ansible-lint --force-color platforms: - - name: alpine-3.10 - image: alpine:3.10 - dockerfile: ../common/Dockerfile.j2 - privileged: true - volumes: - - "/sys/fs/cgroup:/sys/fs/cgroup:rw" - command: "/sbin/init" - name: alpine-3.11 image: alpine:3.11 dockerfile: ../common/Dockerfile.j2 @@ -34,6 +27,20 @@ platforms: volumes: - "/sys/fs/cgroup:/sys/fs/cgroup:rw" command: "/sbin/init" + - name: alpine-3.14 + image: alpine:3.14 + dockerfile: ../common/Dockerfile.j2 + privileged: true + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: amazonlinux + image: amazonlinux:2 + dockerfile: ../common/Dockerfile.j2 + privileged: true + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" - name: centos-7 image: centos:7 dockerfile: ../common/Dockerfile.j2 @@ -55,8 +62,8 @@ platforms: volumes: - "/sys/fs/cgroup:/sys/fs/cgroup:rw" command: "/sbin/init" - - name: ubuntu-xenial - image: ubuntu:xenial + - name: debian-bullseye + image: debian:bullseye-slim dockerfile: ../common/Dockerfile.j2 privileged: true volumes: diff --git a/tasks/opensource/install-redhat.yml b/tasks/opensource/install-redhat.yml index 25d2b94..82451f4 100644 --- a/tasks/opensource/install-redhat.yml +++ b/tasks/opensource/install-redhat.yml @@ -1,38 +1,20 @@ --- -- name: (CentOS/RHEL 6/7) Configure NGINX repository +- name: (Amazon Linux/CentOS/RHEL) Configure NGINX repository yum_repository: name: nginx - baseurl: "{{ nginx_repository | default(nginx_default_repository_redhat) }}" + baseurl: "{{ nginx_repository | + default(lookup('vars', 'nginx_default_repository_' + ((ansible_facts['distribution'] == 'Amazon') | ternary('amazon', 'redhat')))) }}" description: NGINX Repository enabled: true gpgcheck: true mode: 0644 - when: - - ansible_facts['distribution_major_version'] is version('8', '<') - - nginx_manage_repo | bool + module_hotfixes: true + when: nginx_manage_repo | bool -- name: (CentOS/RHEL 8) Configure NGINX repository - blockinfile: - path: /etc/yum.repos.d/nginx.repo - create: true - block: | - [nginx] - baseurl = {{ nginx_repository | default(nginx_default_repository_redhat) }} - enabled = 1 - gpgcheck = 1 - name = NGINX Repository - module_hotfixes = true - mode: 0644 - when: - - ansible_facts['distribution_major_version'] is version('8', '==') - - nginx_manage_repo | bool - -- name: (CentOS/RHEL) Install NGINX +- name: (Amazon Linux/CentOS/RHEL) Install NGINX yum: name: "nginx{{ nginx_version | default('') }}" state: "{{ nginx_state }}" - disablerepo: "*" - enablerepo: nginx update_cache: true ignore_errors: "{{ ansible_check_mode }}" notify: (Handler) Run NGINX diff --git a/vars/main.yml b/vars/main.yml index 61f5d55..3a4b7ab 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -2,7 +2,7 @@ # Supported NGINX Open Source distributions # https://nginx.org/en/docs/install.html nginx_distributions: [ - 'Alpine', 'CentOS', 'Debian', 'FreeBSD', 'RedHat', 'SLES', 'Ubuntu', + 'Alpine', 'Amazon', 'CentOS', 'Debian', 'FreeBSD', 'RedHat', 'SLES', 'Ubuntu', 'NetBSD', 'OpenBSD', 'DragonFlyBSD', 'HardenedBSD', ] @@ -19,6 +19,7 @@ nginx_default_signing_key_pgp: https://nginx.org/keys/nginx_signing.key # Default NGINX Open Source repositories nginx_default_repository_alpine: "https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\ alpine/v{{ ansible_facts['distribution_version'] | regex_search('^[0-9]+\\.[0-9]+') }}/main" +nginx_default_repository_amazon: "https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}/amzn2/$releasever/$basearch" nginx_default_repository_debian: - "deb [arch={{ (ansible_facts['architecture'] == 'aarch64') | ternary('arm64', 'amd64') }}] https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\ {{ ansible_facts['distribution'] | lower }}/ {{ ansible_facts['distribution_release'] }} nginx" @@ -53,7 +54,7 @@ nginx_debian_dependencies: [ # Red Hat dependencies nginx_redhat_dependencies: [ - 'ca-certificates', 'openssl', + 'ca-certificates', 'openssl', 'yum-utils', ] # SLES dependencies