Add variable to set location of NGINX status conf file (#184)
This commit is contained in:
parent
7785babce1
commit
78c21d4346
50
README.md
50
README.md
@ -24,32 +24,33 @@ Alpine:
|
|||||||
versions:
|
versions:
|
||||||
- 3.8
|
- 3.8
|
||||||
- 3.9
|
- 3.9
|
||||||
|
- 3.10
|
||||||
CentOS:
|
CentOS:
|
||||||
versions:
|
|
||||||
- 6
|
|
||||||
- 7.4+
|
|
||||||
RedHat:
|
|
||||||
versions:
|
versions:
|
||||||
- 6
|
- 6
|
||||||
- 7.4+
|
- 7.4+
|
||||||
- 8
|
- 8
|
||||||
Debian:
|
Debian:
|
||||||
versions:
|
versions:
|
||||||
- jessie
|
|
||||||
- stretch
|
- stretch
|
||||||
- buster
|
- buster
|
||||||
Ubuntu:
|
|
||||||
versions:
|
|
||||||
- xenial
|
|
||||||
- bionic
|
|
||||||
SUSE/SLES:
|
|
||||||
versions:
|
|
||||||
- 12
|
|
||||||
- 15
|
|
||||||
FreeBSD:
|
FreeBSD:
|
||||||
versions:
|
versions:
|
||||||
- 11.2+
|
- 11.2+
|
||||||
- 12
|
- 12
|
||||||
|
RedHat:
|
||||||
|
versions:
|
||||||
|
- 6
|
||||||
|
- 7.4+
|
||||||
|
- 8
|
||||||
|
SUSE/SLES:
|
||||||
|
versions:
|
||||||
|
- 12
|
||||||
|
- 15
|
||||||
|
Ubuntu:
|
||||||
|
versions:
|
||||||
|
- xenial
|
||||||
|
- bionic
|
||||||
```
|
```
|
||||||
|
|
||||||
**NGINX Plus**
|
**NGINX Plus**
|
||||||
@ -59,6 +60,7 @@ Alpine:
|
|||||||
versions:
|
versions:
|
||||||
- 3.8
|
- 3.8
|
||||||
- 3.9
|
- 3.9
|
||||||
|
- 3.10
|
||||||
Amazon Linux:
|
Amazon Linux:
|
||||||
versions:
|
versions:
|
||||||
- 2018.03
|
- 2018.03
|
||||||
@ -69,9 +71,9 @@ CentOS:
|
|||||||
versions:
|
versions:
|
||||||
- 6.5+
|
- 6.5+
|
||||||
- 7.4+
|
- 7.4+
|
||||||
|
- 8
|
||||||
Debian:
|
Debian:
|
||||||
versions:
|
versions:
|
||||||
- jessie
|
|
||||||
- stretch
|
- stretch
|
||||||
- buster
|
- buster
|
||||||
FreeBSD:
|
FreeBSD:
|
||||||
@ -97,7 +99,7 @@ Ubuntu:
|
|||||||
- bionic
|
- bionic
|
||||||
```
|
```
|
||||||
|
|
||||||
**NGINX Amplify**
|
**NGINX Amplify Agent**
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Amazon Linux:
|
Amazon Linux:
|
||||||
@ -122,7 +124,7 @@ RedHat:
|
|||||||
- 7
|
- 7
|
||||||
```
|
```
|
||||||
|
|
||||||
**NGINX Controller**
|
**NGINX Controller Agent**
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Amazon Linux:
|
Amazon Linux:
|
||||||
@ -199,10 +201,13 @@ nginx_start: true
|
|||||||
# Print NGINX configuration file to terminal after executing playbook.
|
# Print NGINX configuration file to terminal after executing playbook.
|
||||||
nginx_debug_output: false
|
nginx_debug_output: false
|
||||||
|
|
||||||
# Specify which version of NGINX you want to install.
|
# Specify which type of NGINX you want to install.
|
||||||
# Options are 'opensource' or 'plus'.
|
# Options are 'opensource' or 'plus'.
|
||||||
# Default is 'opensource'.
|
# Default is 'opensource'.
|
||||||
nginx_type: opensource
|
nginx_type: opensource
|
||||||
|
# Specify which version of NGINX you want to install.
|
||||||
|
# Default is empty.
|
||||||
|
# nginx_version: =19-1~bionic
|
||||||
|
|
||||||
# Specify repository origin for NGINX Open Source.
|
# Specify repository origin for NGINX Open Source.
|
||||||
# Options are 'nginx_repository' or 'os_repository'.
|
# Options are 'nginx_repository' or 'os_repository'.
|
||||||
@ -595,17 +600,19 @@ nginx_http_template:
|
|||||||
|
|
||||||
# Enable NGINX status data.
|
# Enable NGINX status data.
|
||||||
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
||||||
|
# Note - 'status' has been deprecated since NGINX Plus R13.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
nginx_status_enable: false
|
nginx_status_enable: false
|
||||||
nginx_status_port: 8080
|
nginx_status_location: /etc/nginx/conf.d/stub_status.conf
|
||||||
|
nginx_status_port: 80
|
||||||
|
|
||||||
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
||||||
# Requires NGINX Plus.
|
# Requires NGINX Plus.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
nginx_rest_api_enable: false
|
nginx_rest_api_enable: false
|
||||||
nginx_rest_api_src: http/api.conf.j2
|
nginx_rest_api_template_file: http/api.conf.j2
|
||||||
nginx_rest_api_location: /etc/nginx/conf.d/api.conf
|
nginx_rest_api_file_location: /etc/nginx/conf.d/api.conf
|
||||||
nginx_rest_api_port: 8080
|
nginx_rest_api_port: 80
|
||||||
nginx_rest_api_write: false
|
nginx_rest_api_write: false
|
||||||
nginx_rest_api_dashboard: false
|
nginx_rest_api_dashboard: false
|
||||||
|
|
||||||
@ -837,6 +844,7 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a
|
|||||||
vars:
|
vars:
|
||||||
nginx_type: plus
|
nginx_type: plus
|
||||||
nginx_rest_api_enable: true
|
nginx_rest_api_enable: true
|
||||||
|
nginx_rest_api_port: 80
|
||||||
nginx_rest_api_write: true
|
nginx_rest_api_write: true
|
||||||
nginx_controller_enable: true
|
nginx_controller_enable: true
|
||||||
nginx_controller_api_key: <API_KEY_HERE>
|
nginx_controller_api_key: <API_KEY_HERE>
|
||||||
|
@ -409,17 +409,19 @@ nginx_http_template:
|
|||||||
|
|
||||||
# Enable NGINX status data.
|
# Enable NGINX status data.
|
||||||
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
||||||
|
# Note - 'status' has been deprecated since NGINX Plus R13.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
nginx_status_enable: false
|
nginx_status_enable: false
|
||||||
nginx_status_port: 8080
|
nginx_status_location: /etc/nginx/conf.d/stub_status.conf
|
||||||
|
nginx_status_port: 80
|
||||||
|
|
||||||
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
||||||
# Requires NGINX Plus.
|
# Requires NGINX Plus.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
nginx_rest_api_enable: false
|
nginx_rest_api_enable: false
|
||||||
nginx_rest_api_src: http/api.conf.j2
|
nginx_rest_api_template_file: http/api.conf.j2
|
||||||
nginx_rest_api_location: /etc/nginx/conf.d/api.conf
|
nginx_rest_api_file_location: /etc/nginx/conf.d/api.conf
|
||||||
nginx_rest_api_port: 8080
|
nginx_rest_api_port: 80
|
||||||
nginx_rest_api_write: false
|
nginx_rest_api_write: false
|
||||||
nginx_rest_api_dashboard: false
|
nginx_rest_api_dashboard: false
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
---
|
---
|
||||||
- name: "(Setup: NGINX Open Source) Enable NGINX Open Source Status"
|
- name: "(Setup: NGINX Open Source) Enable NGINX Open Source Status"
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: "{{ (nginx_http_template_enable) | ternary('/etc/nginx/conf.d/http/stub_status.conf','/etc/nginx/conf.d/stub_status.conf') }}"
|
path: "{{ nginx_status_location }}"
|
||||||
create: yes
|
create: yes
|
||||||
block: |
|
block: |
|
||||||
server {
|
server {
|
||||||
listen 127.0.0.1:{{ nginx_status_port | default('8080') }};
|
listen 127.0.0.1:{{ nginx_status_port | default('80') }};
|
||||||
location /nginx_status {
|
location /nginx_status {
|
||||||
stub_status on;
|
stub_status on;
|
||||||
allow 127.0.0.1;
|
allow 127.0.0.1;
|
||||||
@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
- name: "(Setup: NGINX Plus) Enable NGINX Plus Status"
|
- name: "(Setup: NGINX Plus) Enable NGINX Plus Status"
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: "{{ (nginx_http_template_enable) | ternary('/etc/nginx/conf.d/http/status.conf','/etc/nginx/conf.d/status.conf') }}"
|
path: "{{ nginx_status_location }}"
|
||||||
create: yes
|
create: yes
|
||||||
block: |
|
block: |
|
||||||
server {
|
server {
|
||||||
listen 127.0.0.1:{{ nginx_status_port | default('8080') }};
|
listen 127.0.0.1:{{ nginx_status_port | default('80') }};
|
||||||
location /status {
|
location /status {
|
||||||
status;
|
status;
|
||||||
allow 127.0.0.1;
|
allow 127.0.0.1;
|
||||||
|
@ -58,8 +58,8 @@
|
|||||||
|
|
||||||
- name: "(Setup: All NGINX) Dynamically Generate NGINX API Configuration File"
|
- name: "(Setup: All NGINX) Dynamically Generate NGINX API Configuration File"
|
||||||
template:
|
template:
|
||||||
src: "{{ nginx_rest_api_src | default('http/api.conf.j2') }}"
|
src: "{{ nginx_rest_api_template_file | default('http/api.conf.j2') }}"
|
||||||
dest: "{{ nginx_rest_api_location | default('/etc/nginx/conf.d/api.conf') }}"
|
dest: "{{ nginx_rest_api_file_location | default('/etc/nginx/conf.d/api.conf') }}"
|
||||||
backup: yes
|
backup: yes
|
||||||
notify: "(Handler: All OSs) Reload NGINX"
|
notify: "(Handler: All OSs) Reload NGINX"
|
||||||
when: nginx_rest_api_enable | bool
|
when: nginx_rest_api_enable | bool
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{{ ansible_managed | comment }}
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen {{ nginx_rest_api_port }};
|
listen {{ nginx_rest_api_port | default('80') }};
|
||||||
location /api {
|
location /api {
|
||||||
{% if nginx_rest_api_write %}
|
{% if nginx_rest_api_write %}
|
||||||
api write=on;
|
api write=on;
|
||||||
|
Loading…
Reference in New Issue
Block a user