diff --git a/README.md b/README.md index 923d2b4..1c875cc 100644 --- a/README.md +++ b/README.md @@ -173,13 +173,13 @@ nginx_enable: true # Specify which version of NGINX you want to install. # Options are 'opensource' or 'plus'. # Default is 'opensource'. -type: opensource +nginx_type: opensource # Specify repository origin for NGINX Open Source. # Options are 'nginx_repository' or 'os_repository'. -# Only works if 'type' is set to 'opensource'. +# Only works if 'nginx_type' is set to 'opensource'. # Default is nginx_repository. -install_from: nginx_repository +nginx_install_from: nginx_repository # Specify source repository for NGINX Open Source. # Only works if 'install_from' is set to 'nginx_repository'. @@ -197,21 +197,21 @@ nginx_repository: # Options are 'mainline' or 'stable'. # Only works if 'install_from' is set to 'nginx_repository'. # Default is mainline. -branch: mainline +nginx_branch: mainline # Location of your NGINX Plus license in your local machine. # Default is the files folder within the NGINX Ansible role. -license: +nginx_license: certificate: license/nginx-repo.crt key: license/nginx-repo.key # Delete NGINX Plus license after installation for security purposes. # Default is true. -delete_license: true +nginx_delete_license: true # Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules. # Default is false. -modules: +nginx_modules: njs: false perl: false waf: false @@ -224,58 +224,58 @@ modules: # Use your NGINX Amplify API key. # Requires access to either the NGINX stub status or the NGINX Plus REST API. # Default is null. -amplify_enable: false -amplify_api_key: null +nginx_amplify_enable: false +nginx_amplify_api_key: null # Install NGINX Controller. # Use your NGINX Controller API key and NGINX Controller API endpoint. # Requires NGINX Plus and write access to the NGINX Plus REST API. # Default is null. -controller_enable: false -controller_api_key: null -controller_api_endpoint: null +nginx_controller_enable: false +nginx_controller_api_key: null +nginx_controller_api_endpoint: null # Install NGINX Unit and NGINX Unit modules. # Use a list of supported NGINX Unit modules. # Default is false. -unit_enable: false -unit_modules: 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. # Default is false. -status_enable: false +nginx_status_enable: false # Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard. # Requires NGINX Plus. # Default is false. -rest_api_enable: false -rest_api_write: false -rest_api_dashboard: false +nginx_rest_api_enable: false +nginx_rest_api_write: false +nginx_rest_api_dashboard: false # Enable uploading NGINX configuration files to your system. # Default for uploading files is false. # Default location of files is the files folder within the NGINX Ansible role. -main_push_enable: false -main_push_location: conf/nginx.conf -http_push_enable: false -http_push_location: conf/http/*.conf -stream_push_enable: false -stream_push_location: conf/stream/*.conf +nginx_main_push_enable: false +nginx_main_push_location: conf/nginx.conf +nginx_http_push_enable: false +nginx_http_push_location: conf/http/*.conf +nginx_stream_push_enable: false +nginx_stream_push_location: conf/stream/*.conf # Configuration variables to create a templated NGINX configuration. # Defaults are the values found in a fresh NGINX installation. -main_template_enable: false -main_template_user: nginx -main_template_worker_processes: auto -main_template_error_level: warn -main_template_worker_connections: 1024 -http_template_enable: false -http_template_keepalive_timeout: 65 -http_template_listen: 80 -http_template_server_name: localhost -stream_template_enable: false -stream_template_listen: 12345 +nginx_main_template_enable: false +nginx_main_template_user: nginx +nginx_main_template_worker_processes: auto +nginx_main_template_error_level: warn +nginx_main_template_worker_connections: 1024 +nginx_http_template_enable: false +nginx_http_template_keepalive_timeout: 65 +nginx_http_template_listen: 80 +nginx_http_template_server_name: localhost +nginx_stream_template_enable: false +nginx_stream_template_listen: 12345 ``` Dependencies @@ -315,7 +315,7 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a roles: - role: nginxinc.nginx vars: - type: plus + nginx_type: plus ``` This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a localhost to install NGINX Plus and the NGINX Controller agent. @@ -326,12 +326,12 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a roles: - role: nginxinc.nginx vars: - type: plus - rest_api_enable: true - rest_api_write: true - controller_enable: true - controller_api_key: - controller_api_endpoint: https:///1.4 + nginx_type: plus + nginx_rest_api_enable: true + nginx_rest_api_write: true + nginx_controller_enable: true + nginx_controller_api_key: + nginx_controller_api_endpoint: https:///1.4 ``` This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a localhost to install NGINX Unit and the PHP/Perl NGINX Unit language modules. @@ -344,8 +344,8 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a - role: nginxinc.nginx vars: nginx_enable: false - unit_enable: true - unit_modules: + nginx_unit_enable: true + nginx_unit_modules: - unit-php - unit-perl ``` diff --git a/defaults/main.yml b/defaults/main.yml index c2c6ef5..911d91e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,13 +6,13 @@ nginx_enable: true # Specify which version of NGINX you want to install. # Options are 'opensource' or 'plus'. # Default is 'opensource'. -type: opensource +nginx_type: opensource # Specify repository origin for NGINX Open Source. # Options are 'nginx_repository' or 'os_repository'. -# Only works if 'type' is set to 'opensource'. +# Only works if 'nginx_type' is set to 'opensource'. # Default is nginx_repository. -install_from: nginx_repository +nginx_install_from: nginx_repository # Specify source repository for NGINX Open Source. # Only works if 'install_from' is set to 'nginx_repository'. @@ -30,21 +30,21 @@ nginx_repository: # Options are 'mainline' or 'stable'. # Only works if 'install_from' is set to 'nginx_repository'. # Default is mainline. -branch: mainline +nginx_branch: mainline # Location of your NGINX Plus license in your local machine. # Default is the files folder within the NGINX Ansible role. -license: +nginx_license: certificate: license/nginx-repo.crt key: license/nginx-repo.key # Delete NGINX Plus license after installation for security purposes. # Default is true. -delete_license: true +nginx_delete_license: true # Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules. # Default is false. -modules: +nginx_modules: njs: false perl: false waf: false @@ -57,55 +57,55 @@ modules: # Use your NGINX Amplify API key. # Requires access to either the NGINX stub status or the NGINX Plus REST API. # Default is null. -amplify_enable: false -amplify_api_key: null +nginx_amplify_enable: false +nginx_amplify_api_key: null # Install NGINX Controller. # Use your NGINX Controller API key and NGINX Controller API endpoint. # Requires NGINX Plus and write access to the NGINX Plus REST API. # Default is null. -controller_enable: false -controller_api_key: null -controller_api_endpoint: null +nginx_controller_enable: false +nginx_controller_api_key: null +nginx_controller_api_endpoint: null # Install NGINX Unit and NGINX Unit modules. # Use a list of supported NGINX Unit modules. # Default is false. -unit_enable: false -unit_modules: 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. # Default is false. -status_enable: false +nginx_status_enable: false # Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard. # Requires NGINX Plus. # Default is false. -rest_api_enable: false -rest_api_write: false -rest_api_dashboard: false +nginx_rest_api_enable: false +nginx_rest_api_write: false +nginx_rest_api_dashboard: false # Enable uploading NGINX configuration files to your system. # Default for uploading files is false. # Default location of files is the files folder within the NGINX Ansible role. -main_push_enable: false -main_push_location: conf/nginx.conf -http_push_enable: false -http_push_location: conf/http/*.conf -stream_push_enable: false -stream_push_location: conf/stream/*.conf +nginx_main_push_enable: false +nginx_main_push_location: conf/nginx.conf +nginx_http_push_enable: false +nginx_http_push_location: conf/http/*.conf +nginx_stream_push_enable: false +nginx_stream_push_location: conf/stream/*.conf # Configuration variables to create a templated NGINX configuration. # Defaults are the values found in a fresh NGINX installation. -main_template_enable: false -main_template_user: nginx -main_template_worker_processes: auto -main_template_error_level: warn -main_template_worker_connections: 1024 -http_template_enable: false -http_template_keepalive_timeout: 65 -http_template_listen: 80 -http_template_server_name: localhost -stream_template_enable: false -stream_template_listen: 12345 +nginx_main_template_enable: false +nginx_main_template_user: nginx +nginx_main_template_worker_processes: auto +nginx_main_template_error_level: warn +nginx_main_template_worker_connections: 1024 +nginx_http_template_enable: false +nginx_http_template_keepalive_timeout: 65 +nginx_http_template_listen: 80 +nginx_http_template_server_name: localhost +nginx_stream_template_enable: false +nginx_stream_template_listen: 12345 diff --git a/tasks/conf/push-config.yml b/tasks/conf/push-config.yml index b996889..e1ab3c7 100644 --- a/tasks/conf/push-config.yml +++ b/tasks/conf/push-config.yml @@ -5,13 +5,13 @@ dest: /etc/nginx/nginx.conf backup: yes notify: "(Handler: All OSs) Reload NGINX" - when: main_push_enable + when: nginx_main_push_enable - name: "(Setup: All NGINX) Ensure NGINX HTTP Directory Exists" file: path: /etc/nginx/conf.d/http state: directory - when: http_push_enable + when: nginx_http_push_enable - name: "(Setup: All NGINX) Upload NGINX HTTP Configuration Files" copy: @@ -21,13 +21,13 @@ with_fileglob: - "{{ http_push_location }}" notify: "(Handler: All OSs) Reload NGINX" - when: http_push_enable + when: nginx_http_push_enable - name: "(Setup: All NGINX) Ensure NGINX Stream Directory Exists" file: path: /etc/nginx/conf.d/stream state: directory - when: stream_push_enable + when: nginx_stream_push_enable - name: "(Setup: All NGINX) Upload NGINX Stream Configuration Files" copy: @@ -37,4 +37,4 @@ with_fileglob: - "{{ stream_push_location }}" notify: "(Handler: All OSs) Reload NGINX" - when: stream_push_enable + when: nginx_stream_push_enable diff --git a/tasks/conf/setup-status.yml b/tasks/conf/setup-status.yml index e1f609a..7a373a7 100644 --- a/tasks/conf/setup-status.yml +++ b/tasks/conf/setup-status.yml @@ -12,7 +12,7 @@ deny all; } } - when: type == "opensource" + when: nginx_type == "opensource" notify: "(Handler: All OSs) Reload NGINX" - name: "(Setup: NGINX Plus) Enable NGINX Plus Status" @@ -28,5 +28,5 @@ deny all; } } - when: type == "plus" + when: nginx_type == "plus" notify: "(Handler: All OSs) Reload NGINX" diff --git a/tasks/conf/template-config.yml b/tasks/conf/template-config.yml index 49c8756..c7ecef7 100644 --- a/tasks/conf/template-config.yml +++ b/tasks/conf/template-config.yml @@ -4,14 +4,14 @@ src: nginx.conf.j2 dest: /etc/nginx/nginx.conf backup: yes - when: main_template_enable + when: nginx_main_template_enable notify: "(Handler: All OSs) Reload NGINX" - name: "(Setup: All NGINX) Ensure NGINX HTTP Directory Exists" file: path: /etc/nginx/conf.d/http state: directory - when: http_template_enable + when: nginx_http_template_enable - name: "(Setup: All NGINX) Dynamically Generate NGINX HTTP Configuration Files" template: @@ -20,14 +20,14 @@ backup: yes with_fileglob: - "../templates/http/*.j2" - when: http_template_enable + when: nginx_http_template_enable notify: "(Handler: All OSs) Reload NGINX" - name: "(Setup: All NGINX) Ensure NGINX Stream Directory Exists" file: path: /etc/nginx/conf.d/stream state: directory - when: stream_template_enable + when: nginx_stream_template_enable - name: "(Setup: All NGINX) Dynamically Generate NGINX Stream Configuration Files" template: @@ -36,5 +36,5 @@ backup: yes with_fileglob: - "../templates/stream/*.j2" - when: stream_template_enable + when: nginx_stream_template_enable notify: "(Handler: All OSs) Reload NGINX" diff --git a/tasks/main.yml b/tasks/main.yml index 925589e..6544143 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -11,33 +11,33 @@ block: - import_tasks: opensource/install-oss.yml - when: type == "opensource" + when: nginx_type == "opensource" - import_tasks: plus/install-plus.yml - when: type == "plus" + when: nginx_type == "plus" - import_tasks: modules/install-modules.yml when: true in modules.values() - import_tasks: conf/push-config.yml - when: main_push_enable or http_push_enable or stream_push_enable + when: nginx_main_push_enable or nginx_http_push_enable or nginx_stream_push_enable - import_tasks: conf/template-config.yml - when: main_template_enable or http_template_enable or stream_template_enable + when: nginx_main_template_enable or nginx_http_template_enable or nginx_stream_template_enable - import_tasks: conf/setup-status.yml - when: status_enable + when: nginx_status_enable - import_tasks: conf/setup-rest-api.yml - when: rest_api_enable and type == "plus" + when: nginx_rest_api_enable and nginx_type == "plus" when: nginx_enable - import_tasks: amplify/install-amplify.yml - when: amplify_enable and amplify_api_key is defined and amplify_api_key + when: nginx_amplify_enable and nginx_amplify_api_key is defined and nginx_amplify_api_key - import_tasks: controller/install-controller.yml - when: controller_enable and controller_api_key is defined and controller_api_key and controller_api_endpoint is defined and controller_api_endpoint + when: nginx_controller_enable and nginx_controller_api_key is defined and nginx_controller_api_key and nginx_controller_api_endpoint is defined and nginx_controller_api_endpoint - import_tasks: unit/install-unit.yml - when: unit_enable + when: nginx_unit_enable diff --git a/tasks/modules/install-geoip.yml b/tasks/modules/install-geoip.yml index 3dd08f3..f03c6d6 100644 --- a/tasks/modules/install-geoip.yml +++ b/tasks/modules/install-geoip.yml @@ -3,13 +3,13 @@ package: name: nginx-module-geoip state: present - when: type == "opensource" + when: nginx_type == "opensource" - name: "(Install: All OSs) Install NGINX Plus GeoIP Module" package: name: nginx-plus-module-geoip state: present - when: type == "plus" + when: nginx_type == "plus" - name: "(Setup: All NGINX) Load NGINX GeoIP Module" blockinfile: diff --git a/tasks/modules/install-image-filter.yml b/tasks/modules/install-image-filter.yml index ab89bc6..bb4cf13 100644 --- a/tasks/modules/install-image-filter.yml +++ b/tasks/modules/install-image-filter.yml @@ -3,13 +3,13 @@ package: name: nginx-module-image-filter state: present - when: type == "opensource" + when: nginx_type == "opensource" - name: "(Install: All OSs) Install NGINX Plus Image Filter Module" package: name: nginx-plus-module-image-filter state: present - when: type == "plus" + when: nginx_type == "plus" - name: "(Setup: All NGINX) Load NGINX Image Filter Module" lineinfile: diff --git a/tasks/modules/install-modules.yml b/tasks/modules/install-modules.yml index 52ae7c0..0f0f747 100644 --- a/tasks/modules/install-modules.yml +++ b/tasks/modules/install-modules.yml @@ -18,4 +18,4 @@ when: modules.xslt | default(false) - import_tasks: install-waf.yml - when: modules.waf | default(false) and type == "plus" + when: modules.waf | default(false) and nginx_type == "plus" diff --git a/tasks/modules/install-njs.yml b/tasks/modules/install-njs.yml index 54ab926..d8b9eea 100644 --- a/tasks/modules/install-njs.yml +++ b/tasks/modules/install-njs.yml @@ -3,13 +3,13 @@ package: name: nginx-module-njs state: present - when: type == "opensource" + when: nginx_type == "opensource" - name: "(Install: All OSs) Install NGINX Plus JavaScript Module" package: name: nginx-plus-module-njs state: present - when: type == "plus" + when: nginx_type == "plus" - name: "(Setup: All NGINX) Load NGINX JavaScript Module" blockinfile: diff --git a/tasks/modules/install-perl.yml b/tasks/modules/install-perl.yml index e14ef06..e30c804 100644 --- a/tasks/modules/install-perl.yml +++ b/tasks/modules/install-perl.yml @@ -3,13 +3,13 @@ package: name: nginx-module-perl state: present - when: type == "opensource" + when: nginx_type == "opensource" - name: "(Install: All OSs) Install NGINX Plus Perl Module" package: name: nginx-plus-module-perl state: present - when: type == "plus" + when: nginx_type == "plus" - name: "(Setup: All NGINX) Load NGINX Perl Module" lineinfile: diff --git a/tasks/modules/install-rtmp.yml b/tasks/modules/install-rtmp.yml index 70c7831..6cd8a1d 100644 --- a/tasks/modules/install-rtmp.yml +++ b/tasks/modules/install-rtmp.yml @@ -3,13 +3,13 @@ package: name: nginx-module-rtmp state: present - when: type == "opensource" + when: nginx_type == "opensource" - name: "(Install: All OSs) Install NGINX Plus RTMP Module" package: name: nginx-plus-module-rtmp state: present - when: type == "plus" + when: nginx_type == "plus" - name: "(Setup: All NGINX) Load NGINX RTMP Module" lineinfile: diff --git a/tasks/modules/install-xslt.yml b/tasks/modules/install-xslt.yml index 270d115..e383c1c 100644 --- a/tasks/modules/install-xslt.yml +++ b/tasks/modules/install-xslt.yml @@ -3,13 +3,13 @@ package: name: nginx-module-xslt state: present - when: type == "opensource" + when: nginx_type == "opensource" - name: "(Install: All OSs) Install NGINX Plus XSLT Module" package: name: nginx-plus-module-xslt state: present - when: type == "plus" + when: nginx_type == "plus" - name: "(Setup: All NGINX) Load NGINX XSLT Module" lineinfile: diff --git a/tasks/opensource/install-oss.yml b/tasks/opensource/install-oss.yml index 2f40f47..aa2d6fd 100644 --- a/tasks/opensource/install-oss.yml +++ b/tasks/opensource/install-oss.yml @@ -34,5 +34,5 @@ package: name: nginx state: present - when: install_from == "os_repository" + when: nginx_install_from == "os_repository" notify: "(Handler: All OSs) Start NGINX" diff --git a/tasks/plus/install-plus.yml b/tasks/plus/install-plus.yml index c71db4d..9755711 100644 --- a/tasks/plus/install-plus.yml +++ b/tasks/plus/install-plus.yml @@ -20,4 +20,4 @@ notify: "(Handler: All OSs) Start NGINX" - import_tasks: delete-license.yml - when: delete_license + when: nginx_delete_license diff --git a/tasks/unit/install-unit.yml b/tasks/unit/install-unit.yml index a616832..4093fe8 100644 --- a/tasks/unit/install-unit.yml +++ b/tasks/unit/install-unit.yml @@ -23,4 +23,4 @@ notify: "(Handler: FreeBSD) Start NGINX Unit" - import_tasks: install-modules.yml - when: unit_modules is defined and unit_modules + when: nginx_unit_modules is defined and nginx_unit_modules diff --git a/tests/playbooks/nginx-push.yml b/tests/playbooks/nginx-push.yml index 92b753b..fb32e18 100644 --- a/tests/playbooks/nginx-push.yml +++ b/tests/playbooks/nginx-push.yml @@ -5,7 +5,7 @@ roles: - ansible-role-nginx vars: - main_push_enable: true - main_push_location: ../files/nginx.conf - http_push_enable: true - http_push_location: ../files/http/*.conf + nginx_main_push_enable: true + nginx_main_push_location: ../files/nginx.conf + nginx_http_push_enable: true + nginx_http_push_location: ../files/http/*.conf diff --git a/tests/playbooks/nginx-stable.yml b/tests/playbooks/nginx-stable.yml index 27ef08c..a6967a2 100644 --- a/tests/playbooks/nginx-stable.yml +++ b/tests/playbooks/nginx-stable.yml @@ -5,4 +5,4 @@ roles: - ansible-role-nginx vars: - branch: stable + nginx_branch: stable diff --git a/tests/playbooks/nginx-template.yml b/tests/playbooks/nginx-template.yml index 1c95862..ba29177 100644 --- a/tests/playbooks/nginx-template.yml +++ b/tests/playbooks/nginx-template.yml @@ -5,6 +5,6 @@ roles: - ansible-role-nginx vars: - http_template_enable: true - http_template_keepalive_timeout: 70 - http_template_listen: 82 + nginx_http_template_enable: true + nginx_http_template_keepalive_timeout: 70 + nginx_http_template_listen: 82 diff --git a/tests/playbooks/nginx-unit.yml b/tests/playbooks/nginx-unit.yml index 762373a..82e4900 100644 --- a/tests/playbooks/nginx-unit.yml +++ b/tests/playbooks/nginx-unit.yml @@ -6,7 +6,7 @@ - ansible-role-nginx vars: nginx_enable: false - unit_enable: true - unit_modules: + nginx_unit_enable: true + nginx_unit_modules: - unit-php - unit-perl