Skip to content

Commit 77ccf86

Browse files
authored
Add access_log to status and API configuration files (#265)
1 parent 60796ab commit 77ccf86

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

defaults/main/template.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ nginx_http_template:
315315
nginx_status_enable: false
316316
nginx_status_location: /etc/nginx/conf.d/stub_status.conf
317317
nginx_status_port: 80
318+
nginx_status_log: false
318319

319320
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
320321
# Requires NGINX Plus.
@@ -323,6 +324,7 @@ nginx_rest_api_enable: false
323324
nginx_rest_api_template_file: http/api.conf.j2
324325
nginx_rest_api_file_location: /etc/nginx/conf.d/api.conf
325326
nginx_rest_api_port: 80
327+
nginx_rest_api_log: false
326328
nginx_rest_api_write: false
327329
nginx_rest_api_dashboard: false
328330

molecule/common/playbook_template.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
- accept_mutex off;
4848
stream_enable: true
4949

50+
nginx_status_enable: true
51+
nginx_status_location: /etc/nginx/conf.d/stub_status.conf
52+
nginx_status_port: 8080
53+
nginx_status_log: true
54+
5055
nginx_http_template_enable: true
5156
nginx_http_template:
5257
app:

tasks/conf/setup-status.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
listen 127.0.0.1:{{ nginx_status_port | default('80') }};
99
location /nginx_status {
1010
stub_status on;
11+
access_log {{ nginx_status_log | ternary("on", "off") }};
1112
allow 127.0.0.1;
1213
deny all;
1314
}
@@ -24,6 +25,7 @@
2425
listen 127.0.0.1:{{ nginx_status_port | default('80') }};
2526
location /status {
2627
status;
28+
access_log {{ nginx_status_log | ternary("on", "off") }};
2729
allow 127.0.0.1;
2830
deny all;
2931
}

tasks/conf/template-config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
when: nginx_http_template_enable | bool
5656
notify: "(Handler: All OSs) Reload NGINX"
5757

58-
5958
- name: "(Setup: All NGINX) Dynamically Generate NGINX API Configuration File"
6059
template:
6160
src: "{{ nginx_rest_api_template_file | default('http/api.conf.j2') }}"

templates/http/api.conf.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
server {
44
listen {{ nginx_rest_api_port | default('80') }};
5+
access_log {{ nginx_rest_api_log | ternary("on", "off") }};
56
location /api {
67
{% if nginx_rest_api_write %}
78
api write=on;

0 commit comments

Comments
 (0)