diff --git a/README.md b/README.md index ec18524..704a88a 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ nginx_install_from: nginx_repository # Choose where to fetch the NGINX signing key from. # 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. # 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_modules: null -# Enable NGINX status data. -# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus. +# Remove previously existing NGINX configuration files. +# Use a list of paths you wish to remove. # 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 +nginx_cleanup_config: false +nginx_cleanup_config_path: + - /etc/nginx/conf.d # Enable uploading NGINX configuration files to your system. # Default for uploading files is false. @@ -269,15 +261,15 @@ nginx_rest_api_dashboard: false # Upload the main NGINX configuration file. nginx_main_upload_enable: false nginx_main_upload_src: conf/nginx.conf -nginx_main_upload_dest: /etc/nginx +nginx_main_upload_dest: /etc/nginx/ # Upload HTTP NGINX configuration files. nginx_http_upload_enable: false 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. nginx_stream_upload_enable: false 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. nginx_html_upload_enable: false nginx_html_upload_src: www/* @@ -321,8 +313,6 @@ nginx_main_template: # Enable creating dynamic templated NGINX HTTP configuration files. # 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. -# 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: default: @@ -336,8 +326,8 @@ nginx_http_template: https_redirect: false autoindex: false ssl: - cert: ssl/default.crt - key: ssl/default.key + cert: /etc/ssl/certs/default.crt + key: /etc/ssl/private/default.key web_server: locations: default: @@ -388,7 +378,6 @@ nginx_http_template: auth_basic: null auth_basic_file: null health_check_plus: false - proxy_cache_enable: false proxy_cache: proxy_cache_path: path: /var/cache/nginx @@ -401,7 +390,7 @@ nginx_http_template: upstream1: name: backend lb_method: least_conn - zone_name: backend + zone_name: backend_mem_zone zone_size: 64k sticky_cookie: false servers: @@ -411,6 +400,21 @@ nginx_http_template: weight: 1 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. # 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. diff --git a/defaults/main.yml b/defaults/main.yml index c6e23bb..81ca90f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -81,20 +81,12 @@ nginx_controller_api_endpoint: null nginx_unit_enable: false nginx_unit_modules: null -# Enable NGINX status data. -# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus. +# Remove previously existing NGINX configuration files. +# Use a list of paths you wish to remove. # 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 +nginx_cleanup_config: false +nginx_cleanup_config_path: + - /etc/nginx/conf.d # Enable uploading NGINX configuration files to your system. # Default for uploading files is false. @@ -241,6 +233,21 @@ nginx_http_template: weight: 1 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. # 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. diff --git a/tasks/conf/cleanup-config.yml b/tasks/conf/cleanup-config.yml new file mode 100644 index 0000000..fe81e83 --- /dev/null +++ b/tasks/conf/cleanup-config.yml @@ -0,0 +1,7 @@ +--- +- name: "(Setup: All OSs) Remove NGINX configuration files" + file: + path: "{{ item }}" + state: absent + with_items: + - "{{ nginx_cleanup_config_path }}" diff --git a/tasks/conf/template-config.yml b/tasks/conf/template-config.yml index 34d2b96..c6b06a4 100644 --- a/tasks/conf/template-config.yml +++ b/tasks/conf/template-config.yml @@ -10,6 +10,7 @@ template: src: "{{ item.value.template_file }}" dest: "{{ item.value.html_file_location }}/{{ item.value.html_file_name }}" + backup: yes with_dict: "{{ nginx_html_demo_template }}" when: nginx_html_demo_template_enable diff --git a/tasks/main.yml b/tasks/main.yml index 27344a0..4251a75 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -27,6 +27,9 @@ - import_tasks: plus/install-plus.yml when: nginx_type == "plus" + - import_tasks: conf/cleanup-config.yml + when: nginx_cleanup_config + - import_tasks: modules/install-modules.yml when: true in nginx_modules.values() diff --git a/tests/playbooks/nginx-stream-template.yml b/tests/playbooks/nginx-stream-template.yml index 90fd94c..e244e7e 100644 --- a/tests/playbooks/nginx-stream-template.yml +++ b/tests/playbooks/nginx-stream-template.yml @@ -5,6 +5,7 @@ roles: - ansible-role-nginx vars: + nginx_debug_output: true nginx_main_template_enable: true nginx_main_template: template_file: nginx.conf.j2