ansible-role-nginx/tasks/conf/setup-rest-api.yml
Alessandro Fael Garcia 6047a1107d Refactor REST API deployment
This refactor should fix #17 and ensure that api.conf only gets created when rest_api_enable is set to true and that api.conf gets created in the correct location
2018-04-06 16:29:49 -07:00

23 lines
599 B
YAML

---
- name: "(Setup: NGINX Plus) Setup NGINX Plus API"
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"