fix bugs
This commit is contained in:
parent
5bc41c853f
commit
bb79295969
@ -5,14 +5,6 @@
|
|||||||
notify:
|
notify:
|
||||||
- Restart Nginx
|
- 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
|
- name: Create directory for error pages
|
||||||
file:
|
file:
|
||||||
path: /var/www/errors
|
path: /var/www/errors
|
||||||
@ -45,3 +37,21 @@
|
|||||||
mode: '0644'
|
mode: '0644'
|
||||||
notify:
|
notify:
|
||||||
- Restart Nginx
|
- Restart Nginx
|
||||||
|
|
||||||
|
- name: Test Nginx Configuration
|
||||||
|
command: nginx -t
|
||||||
|
register: nginx_test
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Fail if Nginx Configuration Test Failed
|
||||||
|
fail:
|
||||||
|
msg: "Nginx configuration test failed. Check the configuration files."
|
||||||
|
when: nginx_test.rc != 0
|
||||||
|
|
||||||
|
- name: Ensure Nginx is enabled and started
|
||||||
|
systemd:
|
||||||
|
name: nginx
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
||||||
|
notify:
|
||||||
|
- Restart Nginx
|
@ -1,10 +1,10 @@
|
|||||||
user nginx;
|
user nginx;
|
||||||
worker_processes {{ nginx_worker_processes }};
|
worker_processes auto;
|
||||||
error_log {{ nginx_error_log }} {{ nginx_error_log_level }};
|
error_log /var/log/nginx/error.log warn;
|
||||||
pid /var/run/nginx.pid;
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections {{ nginx_worker_connections }};
|
worker_connections 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
@ -15,13 +15,13 @@ http {
|
|||||||
'$status $body_bytes_sent "$http_referer" '
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
access_log {{ nginx_access_log }} main;
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
sendfile on;
|
sendfile on;
|
||||||
tcp_nopush on;
|
tcp_nopush on;
|
||||||
tcp_nodelay on;
|
tcp_nodelay on;
|
||||||
keepalive_timeout {{ nginx_keepalive_timeout }};
|
keepalive_timeout 65;
|
||||||
types_hash_max_size {{ nginx_types_hash_max_size }};
|
types_hash_max_size 2048;
|
||||||
|
|
||||||
include /etc/nginx/conf.d/*.conf;
|
include /etc/nginx/conf.d/*.conf;
|
||||||
}
|
}
|
@ -5,11 +5,27 @@
|
|||||||
notify:
|
notify:
|
||||||
- Restart Nginx
|
- Restart Nginx
|
||||||
|
|
||||||
- name: Ensure Nginx is enabled and started
|
- name: Deploy Main Nginx Configuration
|
||||||
systemd:
|
template:
|
||||||
name: nginx
|
src: nginx.conf.j2
|
||||||
enabled: yes
|
dest: /etc/nginx/nginx.conf
|
||||||
state: started
|
mode: '0644'
|
||||||
|
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:
|
notify:
|
||||||
- Restart Nginx
|
- Restart Nginx
|
||||||
|
|
||||||
@ -35,22 +51,6 @@
|
|||||||
notify:
|
notify:
|
||||||
- Restart Nginx
|
- 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
|
- name: Deploy SiteA HTML
|
||||||
template:
|
template:
|
||||||
src: index.html.j2
|
src: index.html.j2
|
||||||
@ -77,10 +77,10 @@
|
|||||||
notify:
|
notify:
|
||||||
- Restart Nginx
|
- Restart Nginx
|
||||||
|
|
||||||
- name: Deploy Main Nginx Configuration
|
- name: Ensure Nginx is enabled and started
|
||||||
template:
|
systemd:
|
||||||
src: nginx.conf.j2
|
name: nginx
|
||||||
dest: /etc/nginx/nginx.conf
|
enabled: yes
|
||||||
mode: '0644'
|
state: started
|
||||||
notify:
|
notify:
|
||||||
- Restart Nginx
|
- Restart Nginx
|
@ -1,10 +1,10 @@
|
|||||||
user nginx;
|
user nginx;
|
||||||
worker_processes {{ nginx_worker_processes }};
|
worker_processes auto;
|
||||||
error_log {{ nginx_error_log }} {{ nginx_error_log_level }};
|
error_log /var/log/nginx/error.log warn;
|
||||||
pid /var/run/nginx.pid;
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections {{ nginx_worker_connections }};
|
worker_connections 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
@ -15,13 +15,13 @@ http {
|
|||||||
'$status $body_bytes_sent "$http_referer" '
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
access_log {{ nginx_access_log }} main;
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
sendfile on;
|
sendfile on;
|
||||||
tcp_nopush on;
|
tcp_nopush on;
|
||||||
tcp_nodelay on;
|
tcp_nodelay on;
|
||||||
keepalive_timeout {{ nginx_keepalive_timeout }};
|
keepalive_timeout 65;
|
||||||
types_hash_max_size {{ nginx_types_hash_max_size }};
|
types_hash_max_size 2048;
|
||||||
|
|
||||||
include /etc/nginx/conf.d/*.conf;
|
include /etc/nginx/conf.d/*.conf;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user