Add maintenance snippet
This commit is contained in:
parent
d464f7100c
commit
24fb092cc1
7 changed files with 89 additions and 1 deletions
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
files/maintenance.jpg filter=lfs diff=lfs merge=lfs -text
|
37
files/maintenance.html
Normal file
37
files/maintenance.html
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||||
|
<meta name="viewport" content="width=device-width,
|
||||||
|
initial-scale=1,
|
||||||
|
maximum-scale=1,
|
||||||
|
shrink-to-fit=no,
|
||||||
|
user-scalable=no"/>
|
||||||
|
|
||||||
|
<title>Server maintenance</title>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.center-text { text-align: center; }
|
||||||
|
.center {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 class="center-text">
|
||||||
|
<s>Serval</s> Server maintenance
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p class="center-text">
|
||||||
|
The server is probably under maintenance by the serval cat.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<img
|
||||||
|
src="maintenance.jpg"
|
||||||
|
class="center"
|
||||||
|
alt="The serval cat is sitting on the keyboard"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
3
files/maintenance.jpg
Normal file
3
files/maintenance.jpg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:06daab60034dffbd539bdf87c88bb21a8a00b8da86e6d39541b4f93623e6ba4e
|
||||||
|
size 37295
|
|
@ -18,6 +18,18 @@
|
||||||
- '{{ nginx__enabled_dir }}'
|
- '{{ nginx__enabled_dir }}'
|
||||||
- '{{ nginx__snippets_dir }}'
|
- '{{ nginx__snippets_dir }}'
|
||||||
|
|
||||||
|
- name: Create directories for Nginx HTML files
|
||||||
|
notify: nginx | Restart Nginx
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: '{{ item }}'
|
||||||
|
mode: 'u=rwx,go=rx'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
with_items:
|
||||||
|
- '{{ nginx__dir_www }}'
|
||||||
|
- '{{ nginx__dir_www_html }}'
|
||||||
|
|
||||||
- name: Install Nginx config
|
- name: Install Nginx config
|
||||||
notify: nginx | Restart Nginx
|
notify: nginx | Restart Nginx
|
||||||
copy:
|
copy:
|
||||||
|
@ -72,3 +84,24 @@
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
with_items: '{{ nginx__sites }}'
|
with_items: '{{ nginx__sites }}'
|
||||||
|
|
||||||
|
- name: Install maintenance files
|
||||||
|
notify: nginx | Restart Nginx
|
||||||
|
copy:
|
||||||
|
src: 'files/{{ item }}'
|
||||||
|
dest: '{{ nginx__dir_www_html }}/{{ item }}'
|
||||||
|
mode: 'u=rw,go=r'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
with_items:
|
||||||
|
- 'maintenance.html'
|
||||||
|
- 'maintenance.jpg'
|
||||||
|
|
||||||
|
- name: Install maintenance snippet
|
||||||
|
notify: nginx | Restart Nginx
|
||||||
|
template:
|
||||||
|
src: 'templates/maintenance.conf'
|
||||||
|
dest: '{{ nginx__snippets_dir }}/maintenance.conf'
|
||||||
|
mode: 'u=rw,go=r'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
|
|
@ -12,3 +12,11 @@
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: '{{ nginx__dir_etc }}'
|
path: '{{ nginx__dir_etc }}'
|
||||||
|
|
||||||
|
- name: Delete maintenance files
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: '{{ nginx__dir_www_html }}/{{ item }}'
|
||||||
|
with_items:
|
||||||
|
- 'maintenance.html'
|
||||||
|
- 'maintenance.jpg'
|
||||||
|
|
4
templates/maintenance.conf
Normal file
4
templates/maintenance.conf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
error_page 502 = /maintenance.html;
|
||||||
|
|
||||||
|
location = /maintenance.html { root {{ nginx__dir_www_html }}; }
|
||||||
|
location = /maintenance.jpg { root {{ nginx__dir_www_html }}; }
|
|
@ -1,7 +1,9 @@
|
||||||
---
|
---
|
||||||
nginx__dir_etc: '/etc/nginx'
|
nginx__dir_etc: '/etc/nginx'
|
||||||
|
|
||||||
nginx__confd_dir: '{{ nginx__dir_etc }}/conf.d'
|
nginx__confd_dir: '{{ nginx__dir_etc }}/conf.d'
|
||||||
nginx__available_dir: '{{ nginx__dir_etc }}/sites-available'
|
nginx__available_dir: '{{ nginx__dir_etc }}/sites-available'
|
||||||
nginx__enabled_dir: '{{ nginx__dir_etc }}/sites-enabled'
|
nginx__enabled_dir: '{{ nginx__dir_etc }}/sites-enabled'
|
||||||
nginx__snippets_dir: '{{ nginx__dir_etc }}/snippets'
|
nginx__snippets_dir: '{{ nginx__dir_etc }}/snippets'
|
||||||
|
|
||||||
|
nginx__dir_www: '/var/www'
|
||||||
|
nginx__dir_www_html: '{{ nginx__dir_www }}/html'
|
||||||
|
|
Loading…
Reference in a new issue