Add nginx role and playbook for App1 deployment
- Complete nginx role with official repository setup - Configuration placed in conf.d/ for proper inclusion - Working stub_status endpoints (/status, /nginx_status) - Custom HTML template with monitoring information - Cleanup of default Nginx configurations - Ready for deployment on App1 (192.168.0.110)
This commit is contained in:
28
roles/nginx/templates/app1.conf.j2
Normal file
28
roles/nginx/templates/app1.conf.j2
Normal file
@ -0,0 +1,28 @@
|
||||
# App1 Nginx configuration
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /var/www/app1;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location /status {
|
||||
stub_status on;
|
||||
access_log off;
|
||||
allow 127.0.0.1;
|
||||
allow 192.168.0.0/24;
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /nginx_status {
|
||||
stub_status on;
|
||||
access_log off;
|
||||
allow 127.0.0.1;
|
||||
allow 192.168.0.0/24;
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
64
roles/nginx/templates/index.html.j2
Normal file
64
roles/nginx/templates/index.html.j2
Normal file
@ -0,0 +1,64 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test App1 - Nginx</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 40px;
|
||||
background-color: #f4f4f9;
|
||||
color: #333;
|
||||
}
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
h1 {
|
||||
color: #2c3e50;
|
||||
}
|
||||
.info {
|
||||
background-color: #e8f4fc;
|
||||
padding: 15px;
|
||||
border-left: 4px solid #3498db;
|
||||
margin: 20px 0;
|
||||
}
|
||||
.metrics {
|
||||
background-color: #e8f8ef;
|
||||
padding: 15px;
|
||||
border-left: 4px solid #2ecc71;
|
||||
margin: 20px 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>🚀 Test Application 1 - Nginx Server</h1>
|
||||
|
||||
<div class="info">
|
||||
<h3>📊 Server Information:</h3>
|
||||
<p><strong>Hostname:</strong> {{ ansible_hostname }}</p>
|
||||
<p><strong>IP Address:</strong> {{ ansible_default_ipv4.address }}</p>
|
||||
<p><strong>Role:</strong> Web Server (Nginx)</p>
|
||||
<p><strong>Deployed via:</strong> Ansible</p>
|
||||
</div>
|
||||
|
||||
<div class="metrics">
|
||||
<h3>📈 Monitoring:</h3>
|
||||
<p>Node Exporter metrics available at: <code>http://{{ ansible_default_ipv4.address }}:9100/metrics</code></p>
|
||||
<p>Nginx stub_status at: <code>http://{{ ansible_default_ipv4.address }}/status</code></p>
|
||||
<p>Collected by Prometheus: <code>192.168.0.105:9090</code></p>
|
||||
</div>
|
||||
|
||||
<h3>🔗 Infrastructure Links:</h3>
|
||||
<ul>
|
||||
<li><a href="http://192.168.0.106:3000">Grafana Dashboard</a></li>
|
||||
<li><a href="http://192.168.0.105:9090">Prometheus UI</a></li>
|
||||
<li><a href="http://192.168.0.100:3000">Git/Forgejo</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user