Skip to content

Commit 728555c

Browse files
authored
Merge pull request #71 from nginxinc/(fix)/stretch-signing-key
Add hkp signing key fallback option for Stretch
2 parents 63126c3 + af4450a commit 728555c

File tree

3 files changed

+99
-26
lines changed

3 files changed

+99
-26
lines changed

README.md

Lines changed: 97 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ This role has multiple variables. The defaults for all these variables are the f
170170
# Default is true.
171171
nginx_enable: true
172172

173+
# Print NGINX configuration file to terminal after executing playbook.
174+
nginx_debug_output: false
175+
173176
# Specify which version of NGINX you want to install.
174177
# Options are 'opensource' or 'plus'.
175178
# Default is 'opensource'.
@@ -186,12 +189,12 @@ nginx_install_from: nginx_repository
186189
# Defaults are the official NGINX repositories.
187190
nginx_repository:
188191
debian:
189-
- deb https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
190-
- deb-src https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
192+
- deb https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
193+
- deb-src https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
191194
redhat:
192-
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
195+
- https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
193196
suse:
194-
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}sles/12
197+
- https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}sles/12
195198

196199
# Specify which branch of NGINX Open Source you want to install.
197200
# Options are 'mainline' or 'stable'.
@@ -245,35 +248,110 @@ nginx_unit_modules: null
245248
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
246249
# Default is false.
247250
nginx_status_enable: false
251+
nginx_status_port: 8080
248252

249253
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
250254
# Requires NGINX Plus.
251255
# Default is false.
252256
nginx_rest_api_enable: false
257+
nginx_rest_api_location: /etc/nginx/conf.d/api.conf
258+
nginx_rest_api_port: 8080
253259
nginx_rest_api_write: false
254260
nginx_rest_api_dashboard: false
255261

256262
# Enable uploading NGINX configuration files to your system.
257263
# Default for uploading files is false.
258264
# Default location of files is the files folder within the NGINX Ansible role.
259-
nginx_main_push_enable: false
260-
nginx_main_push_location: conf/nginx.conf
261-
nginx_http_push_enable: false
262-
nginx_http_push_location: conf/http/*.conf
263-
nginx_stream_push_enable: false
264-
nginx_stream_push_location: conf/stream/*.conf
265-
266-
# Configuration variables to create a templated NGINX configuration.
265+
# Upload the main NGINX configuration file.
266+
nginx_main_upload_enable: false
267+
nginx_main_upload_src: conf/nginx.conf
268+
nginx_main_upload_dest: /etc/nginx
269+
# Upload HTTP NGINX configuration files.
270+
nginx_http_upload_enable: false
271+
nginx_http_upload_src: conf/http/*.conf
272+
nginx_http_upload_dest: /etc/nginx/conf.d
273+
# Upload Stream NGINX configuration files.
274+
nginx_stream_upload_enable: false
275+
nginx_stream_upload_src: conf/stream/*.conf
276+
nginx_stream_upload_dest: /etc/nginx/conf.d
277+
# Upload HTML files.
278+
nginx_html_upload_enable: false
279+
nginx_html_upload_src: www/*
280+
nginx_html_upload_dest: /usr/share/nginx/html
281+
# Upload SSL certificates and keys.
282+
nginx_ssl_upload_enable: false
283+
nginx_ssl_crt_upload_src: ssl/*.crt
284+
nginx_ssl_crt_upload_dest: /etc/ssl/certs/
285+
nginx_ssl_key_upload_src: ssl/*.key
286+
nginx_ssl_key_upload_dest: /etc/ssl/private/
287+
288+
# Enable crating dynamic templated NGINX HTMK demo websites.
289+
nginx_html_demo_template_enable: false
290+
nginx_html_demo_template:
291+
default:
292+
template_file: www/index.html.j2
293+
html_file_name: index.html
294+
html_file_location: /usr/share/nginx/html
295+
app_name: default
296+
297+
# Enable creating dynamic templated NGINX configuration files.
267298
# Defaults are the values found in a fresh NGINX installation.
268299
nginx_main_template_enable: false
269-
nginx_main_template_user: nginx
270-
nginx_main_template_worker_processes: auto
271-
nginx_main_template_error_level: warn
272-
nginx_main_template_worker_connections: 1024
300+
nginx_main_template:
301+
template_file: nginx.conf.j2
302+
conf_file_name: nginx.conf
303+
conf_file_location: /etc/nginx/
304+
user: nginx
305+
worker_processes: auto
306+
error_level: warn
307+
worker_connections: 1024
308+
http_enable: true
309+
http_settings:
310+
keepalive_timeout: 65
311+
cache: false
312+
rate_limit: false
313+
keyval: false
314+
stream_enable: false
315+
316+
# Enable creating dynamic templated NGINX HTTP configuration files.
317+
# Defaults will not produce a valid configuration. Instead they are meant to showcase
318+
# the options available for templating. Each key represents a new configuration file.
319+
# Comment out load_balancer or web_server depending on whether you wish to create a web server
320+
# or load balancer configuration file.
273321
nginx_http_template_enable: false
274-
nginx_http_template_keepalive_timeout: 65
275-
nginx_http_template_listen: 80
276-
nginx_http_template_server_name: localhost
322+
nginx_http_template:
323+
default:
324+
template_file: http/default.conf.j2
325+
conf_file_name: default.conf
326+
conf_file_location: /etc/nginx/conf.d/
327+
port: 8081
328+
server_name: localhost
329+
error_page: /usr/share/nginx/html
330+
ssl:
331+
cert: ssl/default.crt
332+
key: ssl/default.key
333+
web_server:
334+
html_file_location: /usr/share/nginx/html
335+
html_file_name: index.html
336+
http_demo_conf: false
337+
load_balancer:
338+
proxy_pass: backend
339+
health_check_plus: false
340+
upstreams:
341+
upstream1:
342+
name: backend
343+
lb_method: least_conn
344+
zone_name: backend
345+
zone_size: 64k
346+
sticky_cookie: false
347+
servers:
348+
server1:
349+
address: localhost
350+
port: 8081
351+
weight: 1
352+
health_check: max_fails=1 fail_timeout=10s
353+
354+
# Enable creating dynamic templated NGINX stream configuration files.
277355
nginx_stream_template_enable: false
278356
nginx_stream_template_listen: 12345
279357
```

tasks/keys/apt-key.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
---
2-
- set_fact: fallback_keyserver='hkp://p80.pool.sks-keyservers.net:80'
3-
when: (ansible_distribution == 'Debian' and ansible_distribution_release == 'jessie') or
4-
(ansible_distribution == 'Ubuntu' and ansible_distribution_release in ['trusty', 'xenial'])
5-
62
- name: "(Install: APT OSs) Add APT NGINX Signing Key"
73
apt_key:
8-
id: 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62
9-
keyserver: "{{ fallback_keyserver | default('hkps://hkps.pool.sks-keyservers.net:443') }}"
4+
url: "{{ 'http://nginx.org/keys/nginx_signing.key' | default('https://nginx.org/keys/nginx_signing.key') }}"

tasks/keys/rpm-key.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
- name: "(Install: RPM OSs) Add RPM NGINX Signing Key"
33
rpm_key:
4-
key: "{{ (ansible_os_family == 'RedHat' and ansible_distribution_major_version|int == 6) | ternary('http://nginx.org/keys/nginx_signing.key', 'https://nginx.org/keys/nginx_signing.key') }}"
4+
key: "{{ 'http://nginx.org/keys/nginx_signing.key' | default('https://nginx.org/keys/nginx_signing.key') }}"

0 commit comments

Comments
 (0)