Add parameter to cleanup existing NGINX configs (#103)
This commit is contained in:
parent
171b7d0cce
commit
589d668def
50
README.md
50
README.md
@ -186,7 +186,7 @@ nginx_install_from: nginx_repository
|
|||||||
|
|
||||||
# Choose where to fetch the NGINX signing key from.
|
# Choose where to fetch the NGINX signing key from.
|
||||||
# Default is the official NGINX signing key host.
|
# Default is the official NGINX signing key host.
|
||||||
nginx_signing_key: https://nginx.org/keys/nginx_signing.key
|
nginx_signing_key: http://nginx.org/keys/nginx_signing.key
|
||||||
|
|
||||||
# Specify source repository for NGINX Open Source.
|
# Specify source repository for NGINX Open Source.
|
||||||
# Only works if 'install_from' is set to 'nginx_repository'.
|
# Only works if 'install_from' is set to 'nginx_repository'.
|
||||||
@ -248,20 +248,12 @@ nginx_controller_api_endpoint: null
|
|||||||
nginx_unit_enable: false
|
nginx_unit_enable: false
|
||||||
nginx_unit_modules: null
|
nginx_unit_modules: null
|
||||||
|
|
||||||
# Enable NGINX status data.
|
# Remove previously existing NGINX configuration files.
|
||||||
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
# Use a list of paths you wish to remove.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
nginx_status_enable: false
|
nginx_cleanup_config: false
|
||||||
nginx_status_port: 8080
|
nginx_cleanup_config_path:
|
||||||
|
- /etc/nginx/conf.d
|
||||||
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
|
||||||
# Requires NGINX Plus.
|
|
||||||
# Default is false.
|
|
||||||
nginx_rest_api_enable: false
|
|
||||||
nginx_rest_api_location: /etc/nginx/conf.d/api.conf
|
|
||||||
nginx_rest_api_port: 8080
|
|
||||||
nginx_rest_api_write: false
|
|
||||||
nginx_rest_api_dashboard: false
|
|
||||||
|
|
||||||
# Enable uploading NGINX configuration files to your system.
|
# Enable uploading NGINX configuration files to your system.
|
||||||
# Default for uploading files is false.
|
# Default for uploading files is false.
|
||||||
@ -269,15 +261,15 @@ nginx_rest_api_dashboard: false
|
|||||||
# Upload the main NGINX configuration file.
|
# Upload the main NGINX configuration file.
|
||||||
nginx_main_upload_enable: false
|
nginx_main_upload_enable: false
|
||||||
nginx_main_upload_src: conf/nginx.conf
|
nginx_main_upload_src: conf/nginx.conf
|
||||||
nginx_main_upload_dest: /etc/nginx
|
nginx_main_upload_dest: /etc/nginx/
|
||||||
# Upload HTTP NGINX configuration files.
|
# Upload HTTP NGINX configuration files.
|
||||||
nginx_http_upload_enable: false
|
nginx_http_upload_enable: false
|
||||||
nginx_http_upload_src: conf/http/*.conf
|
nginx_http_upload_src: conf/http/*.conf
|
||||||
nginx_http_upload_dest: /etc/nginx/conf.d
|
nginx_http_upload_dest: /etc/nginx/conf.d/
|
||||||
# Upload Stream NGINX configuration files.
|
# Upload Stream NGINX configuration files.
|
||||||
nginx_stream_upload_enable: false
|
nginx_stream_upload_enable: false
|
||||||
nginx_stream_upload_src: conf/stream/*.conf
|
nginx_stream_upload_src: conf/stream/*.conf
|
||||||
nginx_stream_upload_dest: /etc/nginx/conf.d
|
nginx_stream_upload_dest: /etc/nginx/conf.d/
|
||||||
# Upload HTML files.
|
# Upload HTML files.
|
||||||
nginx_html_upload_enable: false
|
nginx_html_upload_enable: false
|
||||||
nginx_html_upload_src: www/*
|
nginx_html_upload_src: www/*
|
||||||
@ -321,8 +313,6 @@ nginx_main_template:
|
|||||||
# Enable creating dynamic templated NGINX HTTP configuration files.
|
# Enable creating dynamic templated NGINX HTTP configuration files.
|
||||||
# Defaults will not produce a valid configuration. Instead they are meant to showcase
|
# Defaults will not produce a valid configuration. Instead they are meant to showcase
|
||||||
# the options available for templating. Each key represents a new configuration file.
|
# the options available for templating. Each key represents a new configuration file.
|
||||||
# Comment out reverse_proxy or web_server depending on whether you wish to create a web server
|
|
||||||
# or load balancer configuration file.
|
|
||||||
nginx_http_template_enable: false
|
nginx_http_template_enable: false
|
||||||
nginx_http_template:
|
nginx_http_template:
|
||||||
default:
|
default:
|
||||||
@ -336,8 +326,8 @@ nginx_http_template:
|
|||||||
https_redirect: false
|
https_redirect: false
|
||||||
autoindex: false
|
autoindex: false
|
||||||
ssl:
|
ssl:
|
||||||
cert: ssl/default.crt
|
cert: /etc/ssl/certs/default.crt
|
||||||
key: ssl/default.key
|
key: /etc/ssl/private/default.key
|
||||||
web_server:
|
web_server:
|
||||||
locations:
|
locations:
|
||||||
default:
|
default:
|
||||||
@ -388,7 +378,6 @@ nginx_http_template:
|
|||||||
auth_basic: null
|
auth_basic: null
|
||||||
auth_basic_file: null
|
auth_basic_file: null
|
||||||
health_check_plus: false
|
health_check_plus: false
|
||||||
proxy_cache_enable: false
|
|
||||||
proxy_cache:
|
proxy_cache:
|
||||||
proxy_cache_path:
|
proxy_cache_path:
|
||||||
path: /var/cache/nginx
|
path: /var/cache/nginx
|
||||||
@ -401,7 +390,7 @@ nginx_http_template:
|
|||||||
upstream1:
|
upstream1:
|
||||||
name: backend
|
name: backend
|
||||||
lb_method: least_conn
|
lb_method: least_conn
|
||||||
zone_name: backend
|
zone_name: backend_mem_zone
|
||||||
zone_size: 64k
|
zone_size: 64k
|
||||||
sticky_cookie: false
|
sticky_cookie: false
|
||||||
servers:
|
servers:
|
||||||
@ -411,6 +400,21 @@ nginx_http_template:
|
|||||||
weight: 1
|
weight: 1
|
||||||
health_check: max_fails=1 fail_timeout=10s
|
health_check: max_fails=1 fail_timeout=10s
|
||||||
|
|
||||||
|
# Enable NGINX status data.
|
||||||
|
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
||||||
|
# Default is false.
|
||||||
|
nginx_status_enable: false
|
||||||
|
nginx_status_port: 8080
|
||||||
|
|
||||||
|
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
||||||
|
# Requires NGINX Plus.
|
||||||
|
# Default is false.
|
||||||
|
nginx_rest_api_enable: false
|
||||||
|
nginx_rest_api_location: /etc/nginx/conf.d/api.conf
|
||||||
|
nginx_rest_api_port: 8080
|
||||||
|
nginx_rest_api_write: false
|
||||||
|
nginx_rest_api_dashboard: false
|
||||||
|
|
||||||
# Enable creating dynamic templated NGINX stream configuration files.
|
# Enable creating dynamic templated NGINX stream configuration files.
|
||||||
# Defaults will not produce a valid configuration. Instead they are meant to showcase
|
# Defaults will not produce a valid configuration. Instead they are meant to showcase
|
||||||
# the options available for templating. Each key represents a new configuration file.
|
# the options available for templating. Each key represents a new configuration file.
|
||||||
|
@ -81,20 +81,12 @@ nginx_controller_api_endpoint: null
|
|||||||
nginx_unit_enable: false
|
nginx_unit_enable: false
|
||||||
nginx_unit_modules: null
|
nginx_unit_modules: null
|
||||||
|
|
||||||
# Enable NGINX status data.
|
# Remove previously existing NGINX configuration files.
|
||||||
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
# Use a list of paths you wish to remove.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
nginx_status_enable: false
|
nginx_cleanup_config: false
|
||||||
nginx_status_port: 8080
|
nginx_cleanup_config_path:
|
||||||
|
- /etc/nginx/conf.d
|
||||||
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
|
||||||
# Requires NGINX Plus.
|
|
||||||
# Default is false.
|
|
||||||
nginx_rest_api_enable: false
|
|
||||||
nginx_rest_api_location: /etc/nginx/conf.d/api.conf
|
|
||||||
nginx_rest_api_port: 8080
|
|
||||||
nginx_rest_api_write: false
|
|
||||||
nginx_rest_api_dashboard: false
|
|
||||||
|
|
||||||
# Enable uploading NGINX configuration files to your system.
|
# Enable uploading NGINX configuration files to your system.
|
||||||
# Default for uploading files is false.
|
# Default for uploading files is false.
|
||||||
@ -241,6 +233,21 @@ nginx_http_template:
|
|||||||
weight: 1
|
weight: 1
|
||||||
health_check: max_fails=1 fail_timeout=10s
|
health_check: max_fails=1 fail_timeout=10s
|
||||||
|
|
||||||
|
# Enable NGINX status data.
|
||||||
|
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
||||||
|
# Default is false.
|
||||||
|
nginx_status_enable: false
|
||||||
|
nginx_status_port: 8080
|
||||||
|
|
||||||
|
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
||||||
|
# Requires NGINX Plus.
|
||||||
|
# Default is false.
|
||||||
|
nginx_rest_api_enable: false
|
||||||
|
nginx_rest_api_location: /etc/nginx/conf.d/api.conf
|
||||||
|
nginx_rest_api_port: 8080
|
||||||
|
nginx_rest_api_write: false
|
||||||
|
nginx_rest_api_dashboard: false
|
||||||
|
|
||||||
# Enable creating dynamic templated NGINX stream configuration files.
|
# Enable creating dynamic templated NGINX stream configuration files.
|
||||||
# Defaults will not produce a valid configuration. Instead they are meant to showcase
|
# Defaults will not produce a valid configuration. Instead they are meant to showcase
|
||||||
# the options available for templating. Each key represents a new configuration file.
|
# the options available for templating. Each key represents a new configuration file.
|
||||||
|
7
tasks/conf/cleanup-config.yml
Normal file
7
tasks/conf/cleanup-config.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: "(Setup: All OSs) Remove NGINX configuration files"
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: absent
|
||||||
|
with_items:
|
||||||
|
- "{{ nginx_cleanup_config_path }}"
|
@ -10,6 +10,7 @@
|
|||||||
template:
|
template:
|
||||||
src: "{{ item.value.template_file }}"
|
src: "{{ item.value.template_file }}"
|
||||||
dest: "{{ item.value.html_file_location }}/{{ item.value.html_file_name }}"
|
dest: "{{ item.value.html_file_location }}/{{ item.value.html_file_name }}"
|
||||||
|
backup: yes
|
||||||
with_dict: "{{ nginx_html_demo_template }}"
|
with_dict: "{{ nginx_html_demo_template }}"
|
||||||
when: nginx_html_demo_template_enable
|
when: nginx_html_demo_template_enable
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
- import_tasks: plus/install-plus.yml
|
- import_tasks: plus/install-plus.yml
|
||||||
when: nginx_type == "plus"
|
when: nginx_type == "plus"
|
||||||
|
|
||||||
|
- import_tasks: conf/cleanup-config.yml
|
||||||
|
when: nginx_cleanup_config
|
||||||
|
|
||||||
- import_tasks: modules/install-modules.yml
|
- import_tasks: modules/install-modules.yml
|
||||||
when: true in nginx_modules.values()
|
when: true in nginx_modules.values()
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
roles:
|
roles:
|
||||||
- ansible-role-nginx
|
- ansible-role-nginx
|
||||||
vars:
|
vars:
|
||||||
|
nginx_debug_output: true
|
||||||
nginx_main_template_enable: true
|
nginx_main_template_enable: true
|
||||||
nginx_main_template:
|
nginx_main_template:
|
||||||
template_file: nginx.conf.j2
|
template_file: nginx.conf.j2
|
||||||
|
Loading…
Reference in New Issue
Block a user