Merge pull request #18 from nginxinc/(feature)/refactor-rest-api
Refactor REST API deployment
This commit is contained in:
commit
6f05bc4227
@ -31,14 +31,11 @@ amplify_key: null
|
||||
# Default is false.
|
||||
status_enable: false
|
||||
|
||||
# Enable NGINX Plus REST API and write access.
|
||||
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
||||
# Default is false.
|
||||
rest_api_enable: false
|
||||
rest_api_write: false
|
||||
|
||||
# Enable NGINX Plus dashboard. REST API also needs to be enabled.
|
||||
# Default is false.
|
||||
dashboard: false
|
||||
rest_api_dashboard: false
|
||||
|
||||
# Location of your NGINX Plus license in your local machine.
|
||||
# Default is the files folder within the NGINX Ansible role.
|
||||
@ -63,8 +60,8 @@ main_template_user: nginx
|
||||
main_template_worker_processes: auto
|
||||
main_template_error_level: warn
|
||||
main_template_worker_connections: 1024
|
||||
main_template_keepalive_timeout: 65
|
||||
http_template_enable: false
|
||||
http_template_keepalive_timeout: 65
|
||||
http_template_listen: 80
|
||||
http_template_server_name: localhost
|
||||
stream_template_enable: false
|
||||
|
@ -1,6 +1,22 @@
|
||||
---
|
||||
- name: "(Setup: NGINX Plus) Setup NGINX Plus API"
|
||||
template:
|
||||
src: api.conf.j2
|
||||
dest: "{{ (http_template_enable) | ternary('/etc/nginx/conf.d/http/api.conf','/etc/nginx/conf.d/api.conf') }}"
|
||||
blockinfile:
|
||||
path: "{{ (http_template_enable) | ternary('/etc/nginx/conf.d/http/api.conf','/etc/nginx/conf.d/api.conf') }}"
|
||||
create: yes
|
||||
block: |
|
||||
server {
|
||||
listen 8080;
|
||||
location /api {
|
||||
{% if rest_api_write %}
|
||||
api write=on;
|
||||
{% else %}
|
||||
api;
|
||||
{% endif %}
|
||||
}
|
||||
{% if rest_api_dashboard %}
|
||||
location = /dashboard.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
{% endif %}
|
||||
}
|
||||
notify: "(Handler: All OSs) Reload NGINX"
|
||||
|
@ -1,17 +0,0 @@
|
||||
{% if rest_api_enable %}
|
||||
server {
|
||||
listen 8080;
|
||||
location /api {
|
||||
{% if rest_api_write %}
|
||||
api write=on;
|
||||
{% else %}
|
||||
api;
|
||||
{% endif %}
|
||||
}
|
||||
{% if dashboard %}
|
||||
location = /dashboard.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
{% endif %}
|
||||
}
|
||||
{% endif %}
|
@ -23,7 +23,7 @@ http {
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout {{ main_template_keepalive_timeout }};
|
||||
keepalive_timeout {{ http_template_keepalive_timeout }};
|
||||
|
||||
#gzip on;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user