fix bugs add handlers
This commit is contained in:
4
ansible/roles/nginx_proxy/handlers/main.yml
Normal file
4
ansible/roles/nginx_proxy/handlers/main.yml
Normal file
@ -0,0 +1,4 @@
|
||||
- name: Restart Nginx
|
||||
systemd:
|
||||
name: nginx
|
||||
state: restarted
|
@ -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 directory for error pages
|
||||
file:
|
||||
@ -16,19 +20,28 @@
|
||||
owner: nginx
|
||||
group: nginx
|
||||
mode: '0755'
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Deploy custom error page
|
||||
template:
|
||||
src: site_down.html.j2
|
||||
dest: /var/www/errors/site_down.html
|
||||
mode: '0644'
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Deploy Proxy Configuration
|
||||
template:
|
||||
src: proxy.conf.j2
|
||||
dest: /etc/nginx/conf.d/proxy.conf
|
||||
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
|
27
ansible/roles/nginx_proxy/templates/nginx.conf.j2
Normal file
27
ansible/roles/nginx_proxy/templates/nginx.conf.j2
Normal file
@ -0,0 +1,27 @@
|
||||
user nginx;
|
||||
worker_processes {{ nginx_worker_processes }};
|
||||
error_log {{ nginx_error_log }} {{ nginx_error_log_level }};
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections {{ nginx_worker_connections }};
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log {{ nginx_access_log }} main;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout {{ nginx_keepalive_timeout }};
|
||||
types_hash_max_size {{ nginx_types_hash_max_size }};
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
Reference in New Issue
Block a user