summaryrefslogtreecommitdiff
path: root/playbooks/tasks/test_and_restart_nginx.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/tasks/test_and_restart_nginx.yaml')
-rw-r--r--playbooks/tasks/test_and_restart_nginx.yaml10
1 files changed, 10 insertions, 0 deletions
diff --git a/playbooks/tasks/test_and_restart_nginx.yaml b/playbooks/tasks/test_and_restart_nginx.yaml
new file mode 100644
index 0000000..626db1d
--- /dev/null
+++ b/playbooks/tasks/test_and_restart_nginx.yaml
@@ -0,0 +1,10 @@
+- name: Test nginx configuration
+ ansible.builtin.command: nginx -t
+ register: nginx_config_test
+ changed_when: false
+
+- name: Restart nginx
+ ansible.builtin.systemd:
+ name: nginx
+ state: restarted
+ when: nginx_config_test.rc == 0