DEPRECATION WARNING:
With the advent of Ansible collections and to reduce the overhead of this role, the decision has been made to split this role into three smaller roles:
- The NGINX Ansible role will keep working as is and be used to install and setup NGINX.
- There now is a separate role to manage and create NGINX configurations available here. Any new issues or PRs related to configuring NGINX should be submitted in the new NGINX Config repository. New issues or PRs related to configuring NGINX submitted in this repository will not be worked on. The NGINX configuration functionalities included in this role will be removed in an upcoming release.
- NGINX Unit has a separate role available here. Any new issues or PRs related to NGINX Unit should be submitted in the new NGINX Unit repository. New issues or PRs related to NGINX Unit submitted in this repository will not be worked on. The NGINX Unit functionalities included in this role will be removed in an upcoming release.
BREAKING CHANGES:
-
The Debian and Ubuntu repositories have slightly changed. You may run into some duplication issues when running the role on a preexisting target that already has had NGINX installed using the role. To fix this, manually remove the old repository source.
-
If you use
custom_options
you will now need to manually end each directive with a semicolon. -
The
status
directive is no longer supported in NGINX Plus, and thestub_status
directive has been reworked into a template. -
The listen directive structure in the
stream
template has been updated to the listen directive structure found in thehttp
template. You can now specify multiplelisten
directives in the sameserver
block as well as include any extralisten
options you might need.Old configuration example
listen_address: localhost listen_port: 80 udp_enable: false
New configuration example
listen: listen_localhost: ip: 0.0.0.0 # Wrap in square brackets for IPv6 addresses port: 80 ssl: false opts: [] # Listen opts like udp which will be added (ssl is automatically added if you specify 'ssl:').
The one major change is that instead of using
udp_enable: true
you will now need to useopts: [udp]
if you wish to enableudp
.
FEATURES:
- Add support to configure logrotate.
- Add support for Ubuntu Focal.
- Add support to configure SELinux.
- Two new variables have been introduced --
nginx_install
andnginx_configure
-- to let you choose whether you want to install NGINX, configure NGINX, or both.
ENHANCEMENTS:
- Molecule tests using Testinfra have been migrated to use Ansible instead.
- The role now uses
include_tasks
instead ofimport_tasks
when possible to speed up the role's execution time. - Improve configuration cleanup capabilities. You can now remove all
*.conf
files in a given directory, or specify a list of files you wish to delete. - Improve configuration templating capabilities:
- Add support for unix upstreams.
- Add PID templating option.
- Add support for down parameter in upstreams.
- Add option for custom error pages.
- Add SSL support to
stream
contexts.
BUG FIXES:
nginx_debug_output
would sometimes fail if NGINX had not been automatically started by the system upon installation.- If
http_demo_conf
was undefined the web server template interpolation would fail.