fix bugs add handlers

This commit is contained in:
2024-11-24 19:44:14 +03:00
parent 24fbd9246f
commit 0474fb6047
9 changed files with 121 additions and 9 deletions

View File

@ -2,12 +2,16 @@
zypper:
name: nginx
state: present
notify:
- Restart Nginx
- name: Ensure Nginx is enabled and started
systemd:
name: nginx
enabled: yes
state: started
notify:
- Restart Nginx
- name: Create web root for SiteA
file:
@ -17,6 +21,8 @@
group: nginx
mode: '0755'
when: "'SiteA' in group_names"
notify:
- Restart Nginx
- name: Create web root for SiteB
file:
@ -26,18 +32,24 @@
group: nginx
mode: '0755'
when: "'SiteB' in group_names"
notify:
- Restart Nginx
- name: Deploy SiteA Configuration
template:
src: siteA.conf.j2
dest: /etc/nginx/conf.d/siteA.conf
when: "'SiteA' in group_names"
notify:
- Restart Nginx
- name: Deploy SiteB Configuration
template:
src: siteB.conf.j2
dest: /etc/nginx/conf.d/siteB.conf
when: "'SiteB' in group_names"
notify:
- Restart Nginx
- name: Deploy SiteA HTML
template:
@ -49,6 +61,8 @@
site_h2: "{{ siteA.site_h2 }}"
site_p: "{{ siteA.site_p }}"
when: "'SiteA' in group_names"
notify:
- Restart Nginx
- name: Deploy SiteB HTML
template:
@ -60,8 +74,13 @@
site_h2: "{{ siteB.site_h2 }}"
site_p: "{{ siteB.site_p }}"
when: "'SiteB' in group_names"
notify:
- Restart Nginx
- name: Reload Nginx
systemd:
name: nginx
state: reloaded
- name: Deploy Main Nginx Configuration
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
mode: '0644'
notify:
- Restart Nginx