2018-01-10 23:40:01 +01:00
|
|
|
---
|
2020-09-20 12:15:28 +02:00
|
|
|
- name: (Handler) Systemd daemon-reload
|
|
|
|
systemd:
|
2021-06-02 17:47:44 +02:00
|
|
|
daemon_reload: true
|
2020-09-20 12:15:28 +02:00
|
|
|
|
2020-09-24 04:21:15 +02:00
|
|
|
- name: (Handler) Start/reload NGINX
|
|
|
|
service:
|
|
|
|
name: nginx
|
|
|
|
state: reloaded
|
2021-06-02 17:47:44 +02:00
|
|
|
enabled: true
|
2020-09-24 04:21:15 +02:00
|
|
|
when:
|
|
|
|
- nginx_start | bool
|
2021-12-07 02:47:13 +01:00
|
|
|
- nginx_state != "absent"
|
2020-09-24 04:21:15 +02:00
|
|
|
- not ansible_check_mode | bool
|
|
|
|
listen: (Handler) Run NGINX
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Handler) Check NGINX
|
|
|
|
command: nginx -t
|
2021-03-22 18:44:21 +01:00
|
|
|
args:
|
2021-10-06 15:23:13 +02:00
|
|
|
chdir: "{{ ((ansible_facts['system'] | lower is not search('bsd')) | ternary('/etc/nginx', '/usr/local/sbin')) }}"
|
2020-10-28 20:12:57 +01:00
|
|
|
register: config_check
|
2021-06-02 17:47:44 +02:00
|
|
|
ignore_errors: true
|
|
|
|
check_mode: false
|
2020-09-22 22:03:38 +02:00
|
|
|
changed_when: false
|
2021-12-07 02:47:13 +01:00
|
|
|
when: nginx_state != "absent"
|
2020-09-19 17:32:17 +02:00
|
|
|
listen: (Handler) Run NGINX
|
2020-06-30 18:59:53 +02:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Handler) Print NGINX error if syntax check fails
|
2020-09-18 19:51:50 +02:00
|
|
|
debug:
|
2020-10-28 20:12:57 +01:00
|
|
|
var: config_check.stderr_lines
|
|
|
|
failed_when: config_check.rc != 0
|
|
|
|
when:
|
|
|
|
- config_check.stderr_lines is defined
|
|
|
|
- config_check.rc != 0
|
2021-12-07 02:47:13 +01:00
|
|
|
- nginx_state != "absent"
|
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
|
2019-08-03 12:53:21 +02:00
|
|
|
service:
|
|
|
|
name: amplify-agent
|
|
|
|
state: started
|
2018-07-18 23:59:14 +02:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Handler) Run logrotate
|
2020-08-20 01:50:22 +02:00
|
|
|
command: logrotate -f /etc/logrotate.d/nginx
|