Skip to content

Commit f9f15e5

Browse files
authored
Add support for configuration snippets (#59)
Resolves #5
1 parent c32d373 commit f9f15e5

File tree

6 files changed

+34
-1
lines changed

6 files changed

+34
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
## 0.3.3 (Unreleased)
44

5+
FEATURES:
6+
7+
Add support for configuration snippets.
8+
59
ENHANCEMENTS:
610

711
* Add support for NGINX GRPC directives.
812
* Add support for NGINX GZIP directives.
9-
* Added support for upstream server `backup` parameter in http and stream template.
13+
* Add support for upstream server `backup` parameter in http and stream template.
1014
* Only run GitHub actions Galaxy CI/CD workflow when a new release is published.
1115
* Update list of supported platforms.
1216

defaults/main/upload.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ nginx_config_ssl_upload_crt_src: ssl/*.crt
2424
nginx_config_ssl_upload_crt_dest: /etc/ssl/certs/
2525
nginx_config_ssl_upload_key_src: ssl/*.key
2626
nginx_config_ssl_upload_key_dest: /etc/ssl/private/
27+
# Upload individual NGINX snippets.
28+
nginx_config_snippet_upload_enable: false
29+
nginx_config_snippet_upload:
30+
- src: config/snippets/snippet.conf
31+
dest: /etc/nginx/snippets # You can optionally also include the file name

files/config/snippets/.gitkeep

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
location /snippet {
2+
}

molecule/stable_push/converge.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@
1313
nginx_config_main_upload_src: ../common/files/nginx.conf
1414
nginx_config_http_upload_enable: true
1515
nginx_config_http_upload_src: ../common/files/http/*.conf
16+
nginx_config_snippet_upload_enable: true
17+
nginx_config_snippet_upload:
18+
- src: ../common/files/snippets/location_snippet.conf
19+
dest: /etc/nginx/snippets

tasks/config/upload-config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
---
2+
- name: Upload NGINX config snippets
3+
block:
4+
- name: Ensure NGINX config snippet directories exist
5+
file:
6+
path: "{{ item.dest | dirname if item.dest.endswith('.conf') else item.dest }}"
7+
state: directory
8+
mode: 0755
9+
loop: "{{ nginx_config_snippet_upload }}"
10+
11+
- name: Upload NGINX config snippet files
12+
copy:
13+
src: "{{ item.src }}"
14+
dest: "{{ item.dest }}"
15+
backup: yes
16+
mode: 0644
17+
loop: "{{ nginx_config_snippet_upload }}"
18+
when: nginx_config_snippet_upload_enable
19+
220
- name: Upload NGINX main config
321
block:
422
- name: Ensure NGINX main directory exists

0 commit comments

Comments
 (0)