ansible-role-nginx/handlers/main.yml

52 lines
1.1 KiB
YAML
Raw Permalink Normal View History

2018-01-10 23:40:01 +01:00
---
- name: (Handler) Systemd daemon-reload
systemd:
daemon_reload: yes
2020-09-24 04:21:15 +02:00
- name: (Handler) Start/reload NGINX
service:
name: nginx
state: reloaded
enabled: yes
when:
- nginx_start | bool
- not ansible_check_mode | bool
listen: (Handler) Run NGINX
2020-09-19 17:32:17 +02:00
- name: (Handler) Check NGINX
command: nginx -t
register: config_check
2020-09-17 17:00:27 +02:00
ignore_errors: yes
check_mode: no
2020-09-22 22:03:38 +02:00
changed_when: false
2020-09-19 17:32:17 +02:00
listen: (Handler) Run NGINX
2020-09-19 17:32:17 +02:00
- name: (Handler) Print NGINX error if syntax check fails
debug:
var: config_check.stderr_lines
failed_when: config_check.rc != 0
when:
- config_check.stderr_lines is defined
- config_check.rc != 0
2020-09-19 17:32:17 +02:00
listen: (Handler) Run NGINX
2020-09-17 17:00:27 +02:00
2020-09-19 17:32:17 +02:00
- name: (Handler) Start NGINX Amplify agent
service:
name: amplify-agent
state: started
2018-07-18 23:59:14 +02:00
2020-09-19 17:32:17 +02:00
- name: (DEPRECATED Handler - Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit
service:
name: unit
state: started
enabled: yes
2020-09-19 17:32:17 +02:00
- name: (DEPRECATED Handler - FreeBSD) Start NGINX Unit
service:
name: unitd
state: started
enabled: yes
2020-09-19 17:32:17 +02:00
- name: (Handler) Run logrotate
command: logrotate -f /etc/logrotate.d/nginx