Skip to content

Commit 53c15dc

Browse files
authored
Automatically create NGINX client body temp path directory (#206)
1 parent cc03036 commit 53c15dc

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Remove parameters deprecated in release `0.4.0`. To recap, these are `nginx_conf
88

99
FEATURES:
1010

11-
Add `backup` variable to template and upload parameters. Set to `false` if you don't want to keep backups of your previous NGINX config files.
11+
* Add `backup` variable to template and upload parameters. Set to `false` if you don't want to keep backups of your previous NGINX config files.
12+
* Automatically create a NGINX `client_body_temp_path` directory if your NGINX config uses the directive.
1213

1314
BUG FIXES:
1415

molecule/default/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
client_body_in_file_only: false
132132
client_body_in_single_buffer: false
133133
client_body_temp_path:
134-
path: /var/cache/nginx
134+
path: /var/cache/nginx/client
135135
level: 2
136136
client_body_timeout: 60s
137137
client_header_buffer_size: 1k

molecule/default/verify.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@
2626
register: this
2727
failed_when: "'Hello World' not in this.content"
2828

29+
- name: Check client body cache directory exists
30+
stat:
31+
path: /var/cache/nginx/client
32+
check_mode: true
33+
register: stat_result
34+
failed_when: not stat_result.stat.exists
35+
36+
- name: Check proxy cache directory exists
37+
stat:
38+
path: /var/cache/nginx/proxy
39+
check_mode: true
40+
register: stat_result
41+
failed_when: not stat_result.stat.exists
42+
2943
- name: Check default.conf exists
3044
stat:
3145
path: /etc/nginx/conf.d/default.conf

tasks/config/template-config.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@
4343
when: nginx_config_main_template_enable | bool
4444
notify: (Handler - NGINX Config) Run NGINX
4545

46+
- name: Ensure NGINX client body cache directories exist
47+
file:
48+
path: "{{ item.config.core.client_body_temp_path.path }}"
49+
state: directory
50+
owner: "{{ nginx_config_main_template.user | default('nginx') }}"
51+
mode: 0755
52+
loop:
53+
"{{ nginx_config_http_template }}"
54+
when:
55+
- nginx_config_http_template_enable | bool
56+
- item.config.core.client_body_temp_path.path is defined
57+
4658
- name: Ensure NGINX proxy cache directories exist
4759
file:
4860
path: "{{ item.1.path }}"
@@ -53,7 +65,7 @@
5365
- "{{ nginx_config_http_template }}"
5466
- config.proxy.cache_path
5567
- skip_missing: true
56-
when: nginx_config_main_template_enable | bool
68+
when: nginx_config_http_template_enable | bool
5769

5870
- name: Ensure NGINX HTTP directory exists
5971
file:

0 commit comments

Comments
 (0)