mirror of
https://github.com/geerlingguy/ansible-role-nginx.git
synced 2025-02-14 00:52:04 +01:00
Merge pull request #156 from spreedly/restart_via_handler
Don't start service in tasks. Defer to handlers to allow further configuration outside of role.
This commit is contained in:
commit
79650c5886
@ -150,6 +150,11 @@ Configures Nginx's [`log_format`](http://nginx.org/en/docs/http/ngx_http_log_mod
|
||||
|
||||
(For RedHat/CentOS only) Set this to `false` to disable the installation of the `nginx` yum repository. This could be necessary if you want the default OS stable packages, or if you use Satellite.
|
||||
|
||||
nginx_service_state: started
|
||||
nginx_service_enabled: yes
|
||||
|
||||
By default, this role will ensure Nginx is running and enabled at boot after Nginx is configured. You can use these variables to override this behavior if installing in a container or further control over the service state is required.
|
||||
|
||||
## Overriding configuration templates
|
||||
|
||||
If you can't customize via variables because an option isn't exposed, you can override the template used to generate the virtualhost configuration files or the `nginx.conf` file.
|
||||
|
@ -12,6 +12,9 @@ nginx_ppa_version: stable
|
||||
# The name of the nginx package to install.
|
||||
nginx_package_name: "nginx"
|
||||
|
||||
nginx_service_state: started
|
||||
nginx_service_enabled: true
|
||||
|
||||
nginx_conf_template: "nginx.conf.j2"
|
||||
nginx_vhost_template: "vhost.j2"
|
||||
|
||||
|
@ -41,5 +41,8 @@
|
||||
notify:
|
||||
- reload nginx
|
||||
|
||||
- name: Ensure nginx is started and enabled to start at boot.
|
||||
service: name=nginx state=started enabled=yes
|
||||
- name: Ensure nginx service is running as configured.
|
||||
service:
|
||||
name: nginx
|
||||
state: "{{ nginx_service_state }}"
|
||||
enabled: "{{ nginx_service_enabled }}"
|
||||
|
Loading…
Reference in New Issue
Block a user