--- - name: "(Setup: NGINX Plus) Setup NGINX Plus API" blockinfile: path: "{{ (nginx_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 nginx_rest_api_write %} api write=on; {% else %} api; {% endif %} } {% if nginx_rest_api_dashboard %} location = /dashboard.html { root /usr/share/nginx/html; } {% endif %} } notify: "(Handler: All OSs) Reload NGINX"