Skip to content

Commit 6645e08

Browse files
committed
Switch dictionaries to individual variables (#349)
1 parent a11e457 commit 6645e08

File tree

9 files changed

+33
-35
lines changed

9 files changed

+33
-35
lines changed

CHANGELOG.md

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

3+
## 0.18.1 (November 17, 2020)
4+
5+
ENHANCEMENTS:
6+
7+
Switch NGINX keysites and OSS default repository data from a dictionary to individual variables to prevent potential issues arisen from Jinja2 dictionary run-time evaluations.
8+
39
## 0.18.0 (November 13, 2020)
410

511
BREAKING CHANGES:

tasks/keys/setup-keys.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
block:
44
- name: (Alpine Linux) Set up NGINX signing key URL
55
set_fact:
6-
keysite: "{{ nginx_signing_key | default(nginx_default_signing_key['rsa_pub']) }}"
6+
keysite: "{{ nginx_signing_key | default(nginx_default_signing_key_rsa_pub) }}"
77

88
- name: (Alpine Linux) Download NGINX signing key
99
get_url:
@@ -14,7 +14,7 @@
1414

1515
- name: (Debian/Red Hat/SLES OSs) Set up NGINX signing key URL
1616
set_fact:
17-
keysite: "{{ nginx_signing_key | default(nginx_default_signing_key['pgp']) }}"
17+
keysite: "{{ nginx_signing_key | default(nginx_default_signing_key_pgp) }}"
1818
when: ansible_facts['os_family'] != "Alpine"
1919

2020
- name: (Debian/Ubuntu) Add NGINX signing key

tasks/opensource/install-alpine.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
lineinfile:
44
path: /etc/apk/repositories
55
insertafter: EOF
6-
line: "{{ repository }}"
6+
line: "{{ nginx_repository | default(nginx_default_repository_alpine) }}"
77

88
- name: (Alpine Linux) Install NGINX
99
apk:
1010
name: "nginx{{ nginx_version | default('') }}"
11-
repository: "{{ repository }}"
11+
repository: "{{ nginx_repository | default(nginx_default_repository_alpine) }}"
1212
state: "{{ nginx_state }}"
1313
update_cache: yes
1414
ignore_errors: "{{ ansible_check_mode }}"

tasks/opensource/install-debian.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
repo: "{{ item }}"
66
update_cache: yes
77
mode: 0644
8-
loop: "{{ repository }}"
8+
loop: "{{ nginx_repository | default(nginx_default_repository_debian) }}"
99

1010
- name: (Debian/Ubuntu) Install NGINX
1111
apt:

tasks/opensource/install-oss.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
- name: Install NGINX in Linux systems
33
block:
44
- name: Install NGINX from repository
5-
block:
6-
- name: Set NGINX repository
7-
set_fact:
8-
repository: "{{ nginx_repository | default(nginx_default_repository[ansible_facts['os_family'] | lower]) }}"
9-
10-
- name: Install NGINX from repository
11-
include_tasks: "{{ role_path }}/tasks/opensource/install-{{ ansible_facts['os_family'] | lower }}.yml"
5+
include_tasks: "{{ role_path }}/tasks/opensource/install-{{ ansible_facts['os_family'] | lower }}.yml"
126
when: nginx_install_from == "nginx_repository"
137

148
- name: Install NGINX from source

tasks/opensource/install-redhat.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- name: (CentOS/RHEL 6/7) Configure NGINX repository
33
yum_repository:
44
name: nginx
5-
baseurl: "{{ repository }}"
5+
baseurl: "{{ nginx_repository | default(nginx_default_repository_redhat) }}"
66
description: NGINX Repository
77
enabled: yes
88
gpgcheck: yes
@@ -15,7 +15,7 @@
1515
create: yes
1616
block: |
1717
[nginx]
18-
baseurl = {{ repository }}
18+
baseurl = {{ nginx_repository | default(nginx_default_repository_redhat) }}
1919
enabled = 1
2020
gpgcheck = 1
2121
name = NGINX Repository

tasks/opensource/install-suse.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- name: (SLES) Configure NGINX repository
33
zypper_repository:
44
name: "nginx-{{ nginx_branch }}"
5-
repo: "{{ repository }}"
5+
repo: "{{ nginx_repository | default(nginx_default_repository_suse) }}"
66

77
- name: (SLES) Install NGINX
88
zypper:

tasks/plus/install-suse.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- name: (SLES) {{ nginx_license_status is defined | ternary('Remove', 'Configure') }} NGINX Plus repository
1010
zypper_repository:
1111
name: nginx-plus
12-
repo: "{{ nginx_repository | default(nginx_plus_default_repository_sles) }}"
12+
repo: "{{ nginx_repository | default(nginx_plus_default_repository_suse) }}"
1313
state: "{{ nginx_license_status | default ('present') }}"
1414

1515
- name: (SLES) Install NGINX Plus

vars/main.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,32 @@ nginx_plus_distributions: [
1313
]
1414

1515
# Default NGINX signing key
16-
nginx_default_signing_key:
17-
rsa_pub: https://nginx.org/keys/nginx_signing.rsa.pub
18-
pgp: https://nginx.org/keys/nginx_signing.key
16+
nginx_default_signing_key_rsa_pub: https://nginx.org/keys/nginx_signing.rsa.pub
17+
nginx_default_signing_key_pgp: https://nginx.org/keys/nginx_signing.key
1918

2019
# Default NGINX Open Source repositories
21-
nginx_default_repository:
22-
alpine: "https://nginx.org/packages/{{ (nginx_branch == 'mainline')
23-
| ternary('mainline/', '') }}alpine/v{{ ansible_facts['distribution_version'] | regex_search('^[0-9]+\\.[0-9]+') }}/main"
24-
debian:
25-
- "deb [arch=amd64] https://nginx.org/packages/{{ (nginx_branch == 'mainline')
26-
| ternary('mainline/', '') }}{{ ansible_facts['distribution'] | lower }}/ {{ ansible_facts['distribution_release'] }} nginx"
27-
- "deb-src https://nginx.org/packages/{{ (nginx_branch == 'mainline')
28-
| ternary('mainline/', '') }}{{ ansible_facts['distribution'] | lower }}/ {{ ansible_facts['distribution_release'] }} nginx"
29-
redhat: "https://nginx.org/packages/{{ (nginx_branch == 'mainline')
30-
| ternary('mainline/', '') }}{{ (ansible_facts['distribution'] == 'CentOS')
31-
| ternary('centos', 'rhel') }}/{{ ansible_facts['distribution_major_version'] }}/$basearch/"
32-
suse: "https://nginx.org/packages/{{ (nginx_branch == 'mainline')
33-
| ternary('mainline/', '') }}sles/{{ ansible_facts['distribution_major_version'] }}"
20+
nginx_default_repository_alpine: "https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
21+
alpine/v{{ ansible_facts['distribution_version'] | regex_search('^[0-9]+\\.[0-9]+') }}/main"
22+
nginx_default_repository_debian:
23+
- "deb [arch=amd64] https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
24+
{{ ansible_facts['distribution'] | lower }}/ {{ ansible_facts['distribution_release'] }} nginx"
25+
- "deb-src https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
26+
{{ ansible_facts['distribution'] | lower }}/ {{ ansible_facts['distribution_release'] }} nginx"
27+
nginx_default_repository_redhat: "https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
28+
{{ (ansible_facts['distribution'] == 'CentOS') | ternary('centos', 'rhel') }}/\
29+
{{ ansible_facts['distribution_major_version'] }}/$basearch/"
30+
nginx_default_repository_suse: "https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}\
31+
sles/{{ ansible_facts['distribution_major_version'] }}"
3432

3533
# Default NGINX Plus repositories
3634
nginx_plus_default_repository_alpine: "https://plus-pkgs.nginx.com/alpine/v{{ ansible_facts['distribution_version'] | regex_search('^[0-9]+\\.[0-9]+') }}/main"
3735
nginx_plus_default_repository_amazon: "https://plus-pkgs.nginx.com/amzn{{ (ansible_facts['distribution_major_version'] is version('2', '==')) | ternary('2', '') }}/$releasever/$basearch"
3836
nginx_plus_default_repository_debian: "deb [arch=amd64] https://plus-pkgs.nginx.com/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] }} nginx-plus"
3937
nginx_plus_default_repository_freebsd: "https://plus-pkgs.nginx.com/freebsd/${ABI}/latest"
40-
nginx_plus_default_repository_redhat: "https://plus-pkgs.nginx.com/{{ (ansible_facts['distribution'] == 'CentOS')
41-
| ternary('centos', 'rhel') }}/{{ (ansible_facts['distribution_version'] is version('7.4', '>=')
38+
nginx_plus_default_repository_redhat: "https://plus-pkgs.nginx.com/{{ (ansible_facts['distribution'] == 'CentOS') | ternary('centos', 'rhel') }}/\
39+
{{ (ansible_facts['distribution_version'] is version('7.4', '>=')
4240
and ansible_facts['distribution_version'] is version('8', '<')) | ternary('7.4', ansible_facts['distribution_major_version']) }}/$basearch/"
43-
nginx_plus_default_repository_sles: "https://plus-pkgs.nginx.com/sles/{{ ansible_facts['distribution_major_version'] }}\
41+
nginx_plus_default_repository_suse: "https://plus-pkgs.nginx.com/sles/{{ ansible_facts['distribution_major_version'] }}\
4442
?ssl_clientcert=/etc/ssl/nginx/nginx-repo-bundle.crt&ssl_verify=peer"
4543

4644
# Alpine dependencies

0 commit comments

Comments
 (0)