Рефакторинг: вынес запуск ролей в отдельный файл deploy.yml
- Создан файл roles/deploy.yml с блоком запуска роли nginx - Обновлен molecule/default/site.yml для импорта deploy.yml - Улучшена модульность структуры проекта - Автор: Сергей Антропов
This commit is contained in:
		
							
								
								
									
										58
									
								
								roles/nginx/templates/nginx.conf.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								roles/nginx/templates/nginx.conf.j2
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| # Основная конфигурация nginx | ||||
| # Автор: Сергей Антропов | ||||
| # Сайт: https://devops.org.ru | ||||
| # Сгенерировано: {{ ansible_date_time.iso8601 }} | ||||
|  | ||||
| user {{ nginx_user }}; | ||||
| worker_processes {{ nginx_worker_processes }}; | ||||
|  | ||||
| error_log {{ nginx_error_log }}; | ||||
| pid /run/nginx.pid; | ||||
|  | ||||
| events { | ||||
|     worker_connections {{ nginx_worker_connections }}; | ||||
| } | ||||
|  | ||||
| http { | ||||
|     # Основные настройки | ||||
|     sendfile {{ nginx_sendfile }}; | ||||
|     tcp_nopush {{ nginx_tcp_nopush }}; | ||||
|     tcp_nodelay {{ nginx_tcp_nodelay }}; | ||||
|     keepalive_timeout {{ nginx_keepalive_timeout }}; | ||||
|     types_hash_max_size 2048; | ||||
|     server_tokens {{ nginx_server_tokens }}; | ||||
|  | ||||
|     # Настройки MIME типов | ||||
|     include /etc/nginx/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; | ||||
|  | ||||
|     # Настройки gzip | ||||
|     {% if nginx_gzip %} | ||||
|     gzip {{ nginx_gzip_vary }}; | ||||
|     gzip_min_length {{ nginx_gzip_min_length }}; | ||||
|     gzip_types | ||||
|         {% for gzip_type in nginx_gzip_types %} | ||||
|         {{ gzip_type }}{% if not loop.last %} {% endif %} | ||||
|         {% endfor %}; | ||||
|     {% endif %} | ||||
|  | ||||
|     # Настройки безопасности | ||||
|     {% if nginx_hide_version %} | ||||
|     server_tokens off; | ||||
|     {% endif %} | ||||
|  | ||||
|     # Включение конфигураций виртуальных хостов | ||||
|     {% if ansible_os_family == "Debian" %} | ||||
|     include /etc/nginx/conf.d/*.conf; | ||||
|     include /etc/nginx/sites-enabled/*; | ||||
|     {% elif ansible_os_family == "RedHat" %} | ||||
|     include /etc/nginx/conf.d/*.conf; | ||||
|     {% endif %} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user