General optimations

This commit is contained in:
2025-07-09 10:17:32 +02:00
parent a69b2c9cb2
commit af3767fdfa
72 changed files with 377 additions and 618 deletions

View File

@@ -1,3 +1,14 @@
---
- name: Validate Nginx configuration
command: nginx -t
register: nginx_test
changed_when: false
failed_when: nginx_test.rc != 0
listen: restart nginx
- name: restart nginx
service: name=nginx state=restarted enabled=yes
service:
name: nginx
state: restarted
enabled: yes
listen: restart nginx

View File

@@ -6,14 +6,12 @@
- nginx-mod-stream
state: present
notify: restart nginx
when: run_once_nginx is not defined
- name: "Delete {{nginx.directories.configuration}} directory, when mode_reset"
file:
path: "{{ nginx.directories.configuration }}"
state: absent
when: mode_reset | bool and run_once_nginx is not defined
when: run_once_srv_web_core is not defined
- name: "reset (if enabled)"
include_tasks: reset.yml
when: mode_reset | bool and run_once_srv_web_core is not defined
- name: Ensure nginx configuration directories are present
file:
path: "{{ item }}"
@@ -28,7 +26,7 @@
(nginx.directories.http.values() | list) +
[ nginx.directories.streams ]
}}
when: run_once_nginx is not defined
when: run_once_srv_web_core is not defined
- name: Ensure nginx data storage directories are present
file:
@@ -40,7 +38,7 @@
mode: '0755'
loop: >
{{ nginx.directories.data.values() | list }}
when: run_once_nginx is not defined
when: run_once_srv_web_core is not defined
- name: "Include tasks to create cache directories"
include_tasks: cache_directories.yml
@@ -50,13 +48,13 @@
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
notify: restart nginx
when: run_once_nginx is not defined
when: run_once_srv_web_core is not defined
- name: flush nginx service
meta: flush_handlers
when: run_once_nginx is not defined
when: run_once_srv_web_core is not defined
- name: run the nginx tasks once
- name: run {{ role_name }} once
set_fact:
run_once_nginx: true
when: run_once_nginx is not defined
run_once_srv_web_core: true
when: run_once_srv_web_core is not defined

View File

@@ -0,0 +1,4 @@
- name: "Delete {{nginx.directories.configuration}} directory, when mode_reset"
file:
path: "{{ nginx.directories.configuration }}"
state: absent