Skip to content

Commit a4b8584

Browse files
authored
Pin Alpine and Debian OSS repositories (#471)
1 parent 16d3cb7 commit a4b8584

File tree

11 files changed

+52
-32
lines changed

11 files changed

+52
-32
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## 0.21.4 (Unreleased)
44

5+
FEATURES:
6+
7+
Pin repository data when installing NGINX OSS on Alpine and Debian distributions.
8+
9+
ENHANCEMENTS:
10+
11+
Add Alpine Linux 3.15 to list of tested and supported platforms.
12+
513
BUG FIXES:
614

715
When building NGINX from source, the original source FTP repository `ftp.pcre.org` is not available anymore, according to <http://pcre.org>. The FTP repository has been updated to use `ftp.exim.org` instead.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ The NGINX Ansible role supports all platforms supported by [NGINX Open Source](h
7373

7474
```yaml
7575
Alpine:
76-
- 3.11
7776
- 3.12
7877
- 3.13
7978
- 3.14
79+
- 3.15
8080
Amazon Linux:
8181
- 2
8282
CentOS:

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.21.1-r1"
7+
version: "=1.21.4-r1"
88
when: ansible_facts['os_family'] == "Alpine"
99
- name: Set repo if Debian
1010
set_fact:
11-
version: "=1.21.1-1~{{ ansible_facts['distribution_release'] }}"
11+
version: "=1.21.4-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.21.1-1.{{ (ansible_facts['distribution']=='Amazon') | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx"
15+
version: "-1.21.4-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: 7 additions & 7 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.11
10-
image: alpine:3.11
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.12
1710
image: alpine:3.12
1811
dockerfile: ../common/Dockerfile.j2
@@ -34,6 +27,13 @@ platforms:
3427
volumes:
3528
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
3629
command: "/sbin/init"
30+
- name: alpine-3.15
31+
image: alpine:3.15
32+
dockerfile: ../common/Dockerfile.j2
33+
privileged: true
34+
volumes:
35+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
36+
command: "/sbin/init"
3737
- name: amazonlinux-2
3838
image: amazonlinux:2
3939
dockerfile: ../common/Dockerfile.j2

molecule/module/molecule.yml

Lines changed: 7 additions & 7 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.11
10-
image: alpine:3.11
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.12
1710
image: alpine:3.12
1811
dockerfile: ../common/Dockerfile.j2
@@ -34,6 +27,13 @@ platforms:
3427
volumes:
3528
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
3629
command: "/sbin/init"
30+
- name: alpine-3.15
31+
image: alpine:3.15
32+
dockerfile: ../common/Dockerfile.j2
33+
privileged: true
34+
volumes:
35+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
36+
command: "/sbin/init"
3737
- name: amazonlinux-2
3838
image: amazonlinux:2
3939
dockerfile: ../common/Dockerfile.j2

molecule/source/molecule.yml

Lines changed: 7 additions & 7 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.11
10-
image: alpine:3.11
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.12
1710
image: alpine:3.12
1811
dockerfile: ../common/Dockerfile.j2
@@ -34,6 +27,13 @@ platforms:
3427
volumes:
3528
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
3629
command: "/sbin/init"
30+
- name: alpine-3.15
31+
image: alpine:3.15
32+
dockerfile: ../common/Dockerfile.j2
33+
privileged: true
34+
volumes:
35+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
36+
command: "/sbin/init"
3737
- name: amazonlinux-2
3838
image: amazonlinux:2
3939
dockerfile: ../common/Dockerfile.j2

tasks/keys/setup-keys.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- name: (Debian/Ubuntu) Add NGINX signing key
2121
apt_key:
2222
id: 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62
23+
keyring: /usr/share/keyrings/nginx-archive-keyring.gpg
2324
url: "{{ keysite }}"
2425
when: ansible_facts['os_family'] == "Debian"
2526

tasks/modules/install-modules.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- name: Install NGINX modules
1111
package:
1212
name: "nginx-{{ (nginx_type == 'plus') | ternary('plus-', '') }}module-{{ item.name | default(item) }}\
13-
{{ item.version | default(nginx_version) | default('') }}"
13+
{{ item.version | default(nginx_version) | default('') }}{{ (nginx_repository is not defined and ansible_facts['os_family'] == 'Alpine' and nginx_type != 'plus') | ternary('@nginx', '') }}"
1414
state: "{{ item.state | default('present') }}"
1515
loop: "{{ nginx_modules }}"
1616
when:

tasks/opensource/install-alpine.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
- name: (Alpine Linux) Install NGINX
1010
apk:
11-
name: "nginx{{ nginx_version | default('') }}"
12-
repository: "{{ nginx_repository | default(nginx_default_repository_alpine) }}"
11+
name: "nginx{{ nginx_repository is not defined | ternary('@nginx', '') }}{{ nginx_version | default('') }}"
1312
state: "{{ nginx_state }}"
1413
update_cache: true
1514
ignore_errors: "{{ ansible_check_mode }}"

tasks/opensource/install-debian.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88
loop: "{{ nginx_repository | default(nginx_default_repository_debian) }}"
99
when: nginx_manage_repo | bool
1010

11+
- name: (Debian/Ubuntu) Pin NGINX repository
12+
blockinfile:
13+
path: /etc/apt/preferences.d/99nginx
14+
create: true
15+
block: |
16+
Package: *
17+
Pin: origin nginx.org
18+
Pin: release o=nginx
19+
Pin-Priority: 900
20+
mode: 0644
21+
when: nginx_repository is not defined
22+
1123
- name: (Debian/Ubuntu) Install NGINX
1224
apt:
1325
name: "nginx{{ nginx_version | default('') }}"

vars/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ nginx_default_signing_key_rsa_pub: https://nginx.org/keys/nginx_signing.rsa.pub
1717
nginx_default_signing_key_pgp: https://nginx.org/keys/nginx_signing.key
1818

1919
# Default NGINX Open Source repositories
20-
nginx_default_repository_alpine: "https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
20+
nginx_default_repository_alpine: "@nginx http://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
2121
alpine/v{{ ansible_facts['distribution_version'] | regex_search('^[0-9]+\\.[0-9]+') }}/main"
2222
nginx_default_repository_amazon: "https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}/amzn2/$releasever/$basearch"
2323
nginx_default_repository_debian:
24-
- "deb [arch={{ (ansible_facts['architecture'] == 'aarch64') | ternary('arm64', 'amd64') }}] https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
24+
- "deb [arch={{ (ansible_facts['architecture'] == 'aarch64') | ternary('arm64', 'amd64') }} signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
2525
{{ ansible_facts['distribution'] | lower }}/ {{ ansible_facts['distribution_release'] }} nginx"
26-
- "deb-src https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
26+
- "deb-src [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
2727
{{ ansible_facts['distribution'] | lower }}/ {{ ansible_facts['distribution_release'] }} nginx"
2828
nginx_default_repository_redhat: "https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
2929
{{ (ansible_facts['distribution'] == 'CentOS') | ternary('centos', 'rhel') }}/\
@@ -34,7 +34,7 @@ nginx_default_repository_suse: "https://nginx.org/packages/{{ (nginx_branch == '
3434
# Default NGINX Plus repositories
3535
nginx_plus_default_repository_alpine: "https://pkgs.nginx.com/plus/alpine/v{{ ansible_facts['distribution_version'] | regex_search('^[0-9]+\\.[0-9]+') }}/main"
3636
nginx_plus_default_repository_amazon: "https://pkgs.nginx.com/plus/amzn{{ (ansible_facts['distribution_major_version'] is version('2', '==')) | ternary('2', '') }}/$releasever/$basearch"
37-
nginx_plus_default_repository_debian: "deb [arch={{ (ansible_facts['architecture'] == 'aarch64') | ternary('arm64', 'amd64') }}] https://pkgs.nginx.com/plus/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] }} nginx-plus"
37+
nginx_plus_default_repository_debian: "deb [arch={{ (ansible_facts['architecture'] == 'aarch64') | ternary('arm64', 'amd64') }} signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] https://pkgs.nginx.com/plus/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] }} nginx-plus"
3838
nginx_plus_default_repository_freebsd: "https://pkgs.nginx.com/plus/freebsd/${ABI}/latest"
3939
nginx_plus_default_repository_redhat: "https://pkgs.nginx.com/plus/{{ (ansible_facts['distribution'] == 'CentOS') | ternary('centos', 'rhel') }}/\
4040
{{ (ansible_facts['distribution_version'] is version('7.4', '>=')

0 commit comments

Comments
 (0)