add web server support to mirror role
83
roles/mirror/base/files/mirror.xslt
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:str="http://exslt.org/strings">
|
||||
|
||||
<xsl:strip-space elements="*" />
|
||||
|
||||
<xsl:template name="size">
|
||||
<!-- transform a size in bytes into a human readable representation -->
|
||||
<xsl:param name="bytes"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$bytes < 1000"><xsl:value-of select="$bytes" />B</xsl:when>
|
||||
<xsl:when test="$bytes < 1048576"><xsl:value-of select="format-number($bytes div 1024, '0.0')" />K</xsl:when>
|
||||
<xsl:when test="$bytes < 1073741824"><xsl:value-of select="format-number($bytes div 1048576, '0.0')" />M</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="format-number(($bytes div 1073741824), '0.00')" />G</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="timestamp">
|
||||
<!-- transform an ISO 8601 timestamp into a human readable representation -->
|
||||
<xsl:param name="iso-timestamp" />
|
||||
<xsl:value-of select="concat(substring($iso-timestamp, 0, 11), ' ', substring($iso-timestamp, 12, 5))" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="directory">
|
||||
<tr>
|
||||
<td><a href="{str:encode-uri(current(),true())}/"><xsl:value-of select="."/></a>/</td>
|
||||
<td><xsl:call-template name="timestamp"><xsl:with-param name="iso-timestamp" select="@mtime" /></xsl:call-template></td>
|
||||
<td>-</td>
|
||||
<td>Directory</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="file">
|
||||
<tr>
|
||||
<td><a href="{str:encode-uri(current(),true())}"><xsl:value-of select="." /></a></td>
|
||||
<td><xsl:call-template name="timestamp"><xsl:with-param name="iso-timestamp" select="@mtime" /></xsl:call-template></td>
|
||||
<td><xsl:call-template name="size"><xsl:with-param name="bytes" select="@size" /></xsl:call-template></td>
|
||||
<td>File</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<head>
|
||||
<title>mirrors.foo.sh - <xsl:value-of select="$path" /></title>
|
||||
<link rel="stylesheet" type="text/css" href="/static/mirror.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/static/icons.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="navbar">
|
||||
<div id="logo">
|
||||
<a href="https://www.foo.sh/"><img src="/static/logo.png" alt="foo.sh" /></a>
|
||||
</div>
|
||||
<div class="mirrorlist">
|
||||
<button class="mirrorlist-button">Select mirror</button>
|
||||
<div class="mirrorlist-content">
|
||||
<a href="/fedora/">Fedora</a><span class="hide"> - </span>
|
||||
<a href="/fedora-epel/">Fedora EPEL</a><span class="hide"> - </span>
|
||||
<a href="/openbsd/">OpenBSD</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<h1>Index of <xsl:value-of select="$path" /></h1>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Last Modified</th>
|
||||
<th>Size</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4"><a href="../">Parent Directory</a></td>
|
||||
</tr>
|
||||
<xsl:apply-templates />
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
307
roles/mirror/base/files/static/icons.css
Normal file
|
@ -0,0 +1,307 @@
|
|||
|
||||
#content a[href]:before {
|
||||
content: url(icons/none.png);
|
||||
}
|
||||
#content a[href$="/"]:before {
|
||||
content: url(icons/folder.png);
|
||||
}
|
||||
|
||||
|
||||
/** Checksums **/
|
||||
|
||||
#content a[href~="MD5"]:before,
|
||||
#content a[href~="SHA1"]:before,
|
||||
#content a[href~="SHA256"]:before {
|
||||
content: url(icons/lock.png);
|
||||
}
|
||||
|
||||
#content a[href$=".md5"]:before,
|
||||
#content a[href$=".sha1"]:before,
|
||||
#content a[href$=".sha256"]:before {
|
||||
content: url(icons/lock2.png);
|
||||
}
|
||||
|
||||
#content a[href$=".pgp"]:before,
|
||||
#content a[href$=".asc"]:before,
|
||||
#content a[href$=".sig"]:before {
|
||||
content: url(icons/lock3.png);
|
||||
}
|
||||
|
||||
|
||||
/** Compressed **/
|
||||
|
||||
#content a[href$=".7z"]:before {
|
||||
content: url(icons/7z.png);
|
||||
}
|
||||
|
||||
#content a[href$=".bin"]:before,
|
||||
#content a[href$=".cue"]:before {
|
||||
content: url(icons/bin.png);
|
||||
}
|
||||
|
||||
#content a[href$=".deb"]:before {
|
||||
content: url(icons/deb.png);
|
||||
}
|
||||
|
||||
#content a[href$=".iso"]:before {
|
||||
content: url(icons/iso.png);
|
||||
}
|
||||
|
||||
#content a[href$=".rar"]:before {
|
||||
content: url(icons/rar.png);
|
||||
}
|
||||
|
||||
#content a[href$=".rpm"]:before {
|
||||
content: url(icons/rpm.png);
|
||||
}
|
||||
|
||||
#content a[href$=".tar"]:before,
|
||||
#content a[href$=".tar.gz"]:before {
|
||||
content: url(icons/tar.png);
|
||||
}
|
||||
|
||||
#content a[href$=".tgz"]:before {
|
||||
content: url(icons/tgz.png);
|
||||
}
|
||||
|
||||
#content a[href$=".zip"]:before {
|
||||
content: url(icons/zip.png);
|
||||
}
|
||||
|
||||
#content a[href$=".bz2"]:before {
|
||||
content: url(icons/bz2.png);
|
||||
}
|
||||
|
||||
|
||||
/** Data Storage **/
|
||||
|
||||
#content a[href$=".csv"]:before {
|
||||
content: url(icons/csv.png);
|
||||
}
|
||||
|
||||
#content a[href$=".ini"]:before {
|
||||
content: url(icons/ini.png);
|
||||
}
|
||||
|
||||
#content a[href$=".json"]:before {
|
||||
content: url(icons/json.png);
|
||||
}
|
||||
|
||||
#content a[href$=".sql"]:before {
|
||||
content: url(icons/sql.png);
|
||||
}
|
||||
|
||||
#content a[href$=".sqlite"]:before {
|
||||
content: url(icons/sqlite.png);
|
||||
}
|
||||
|
||||
#content a[href$=".reg"]:before {
|
||||
content: url(icons/reg.png);
|
||||
}
|
||||
|
||||
#content a[href$=".xml"]:before {
|
||||
content: url(icons/xml.png);
|
||||
}
|
||||
|
||||
#content a[href$=".yaml"]:before,
|
||||
#content a[href$=".yml"]:before {
|
||||
content: url(icons/yaml.png);
|
||||
}
|
||||
|
||||
|
||||
/** Documents **/
|
||||
|
||||
#content a[href$=".chm"]:before {
|
||||
content: url(icons/chm.png);
|
||||
}
|
||||
|
||||
#content a[href$=".djvu"]:before {
|
||||
content: url(icons/djvu.png);
|
||||
}
|
||||
|
||||
#content a[href$=".mobi"]:before {
|
||||
content: url(icons/mobi.png);
|
||||
}
|
||||
|
||||
#content a[href$=".pdf"]:before {
|
||||
content: url(icons/pdf.png);
|
||||
}
|
||||
|
||||
#content a[href$=".txt"]:before {
|
||||
content: url(icons/text.png);
|
||||
}
|
||||
|
||||
#content a[href$=".rtf"]:before {
|
||||
content: url(icons/rtf.png);
|
||||
}
|
||||
|
||||
#content a[href$=".doc"]:before {
|
||||
content: url(icons/doc.png);
|
||||
}
|
||||
|
||||
#content a[href$=".epub"]:before {
|
||||
content: url(icons/epub.png);
|
||||
}
|
||||
|
||||
|
||||
/** Information **/
|
||||
|
||||
#content a[href~="README"]:before {
|
||||
content: url(icons/readme.png);
|
||||
}
|
||||
|
||||
#content a[href~="CHANGELOG"]:before {
|
||||
content: url(icons/changelog.png);
|
||||
}
|
||||
|
||||
#content a[href~="INSTALL"]:before {
|
||||
content: url(icons/install.png);
|
||||
}
|
||||
|
||||
#content a[href~="LICENSE"]:before {
|
||||
content: url(icons/license.png);
|
||||
}
|
||||
|
||||
#content a[href~="COPYING"]:before {
|
||||
content: url(icons/copying.png);
|
||||
}
|
||||
|
||||
#content a[href$=".nfo"]:before,
|
||||
#content a[href$=".diz"]:before {
|
||||
content: url(icons/nfo.png);
|
||||
}
|
||||
|
||||
|
||||
/** Media Files **/
|
||||
|
||||
#content a[href$=".flac"]:before {
|
||||
content: url(icons/flac.png);
|
||||
}
|
||||
|
||||
#content a[href$=".mp3"]:before {
|
||||
content: url(icons/mp3.png);
|
||||
}
|
||||
|
||||
#content a[href$=".wav"]:before {
|
||||
content: url(icons/wav.png);
|
||||
}
|
||||
|
||||
#content a[href$=".bmp"]:before {
|
||||
content: url(icons/bmp.png);
|
||||
}
|
||||
|
||||
#content a[href$=".gif"]:before {
|
||||
content: url(icons/gif.png);
|
||||
}
|
||||
|
||||
#content a[href$=".jpg"]:before,
|
||||
#content a[href$=".jpeg"]:before {
|
||||
content: url(icons/jpg.png);
|
||||
}
|
||||
|
||||
#content a[href$=".png"]:before {
|
||||
content: url(icons/png.png);
|
||||
}
|
||||
|
||||
#content a[href$=".psd"]:before {
|
||||
content: url(icons/psd.png);
|
||||
}
|
||||
|
||||
#content a[href$=".ra"]:before,
|
||||
#content a[href$=".rv"]:before {
|
||||
content: url(icons/rp.png);
|
||||
}
|
||||
|
||||
#content a[href$=".avi"]:before {
|
||||
content: url(icons/avi.png);
|
||||
}
|
||||
|
||||
#content a[href$=".flv"]:before {
|
||||
content: url(icons/flv.png);
|
||||
}
|
||||
|
||||
#content a[href$=".mkv"]:before {
|
||||
content: url(icons/mkv.png);
|
||||
}
|
||||
|
||||
#content a[href$=".mov"]:before {
|
||||
content: url(icons/mov.png);
|
||||
}
|
||||
|
||||
#content a[href$=".mp4"]:before {
|
||||
content: url(icons/mp4.png);
|
||||
}
|
||||
|
||||
|
||||
/** Source Code **/
|
||||
|
||||
#content a[href$=".sh"]:before {
|
||||
content: url(icons/bash.png);
|
||||
}
|
||||
|
||||
#content a[href$=".cpp"]:before {
|
||||
content: url(icons/cpp.png);
|
||||
}
|
||||
|
||||
#content a[href$=".h"]:before {
|
||||
content: url(icons/header.png);
|
||||
}
|
||||
|
||||
#content a[href$=".c"]:before {
|
||||
content: url(icons/c-lang.png);
|
||||
}
|
||||
|
||||
#content a[href$=".go"]:before {
|
||||
content: url(icons/go-lang.png);
|
||||
}
|
||||
|
||||
#content a[href$=".html"]:before,
|
||||
#content a[href$=".htm"]:before {
|
||||
content: url(icons/html.png);
|
||||
}
|
||||
|
||||
#content a[href$=".java"]:before,
|
||||
#content a[href$=".class"]:before {
|
||||
content: url(icons/java.png);
|
||||
}
|
||||
|
||||
#content a[href$=".lua"]:before {
|
||||
content: url(icons/lua.png);
|
||||
}
|
||||
|
||||
#content a[href$=".nim"]:before {
|
||||
content: url(icons/nim.png);
|
||||
}
|
||||
|
||||
#content a[href$=".js"]:before {
|
||||
content: url(icons/javascript.png);
|
||||
}
|
||||
|
||||
#content a[href$=".php"]:before {
|
||||
content: url(icons/php.png);
|
||||
}
|
||||
|
||||
#content a[href$=".pl"]:before {
|
||||
content: url(icons/perl.png);
|
||||
}
|
||||
|
||||
#content a[href$=".py"]:before {
|
||||
content: url(icons/python.png);
|
||||
}
|
||||
|
||||
#content a[href$=".rb"]:before {
|
||||
content: url(icons/ruby.png);
|
||||
}
|
||||
|
||||
#content a[href$=".rs"]:before,
|
||||
#content a[href$=".rlib"]:before {
|
||||
content: url(icons/rust.png);
|
||||
}
|
||||
|
||||
#content a[href$=".css"]:before {
|
||||
content: url(icons/css.png);
|
||||
}
|
||||
|
||||
#content a[href$=".less"]:before {
|
||||
content: url(icons/less.png);
|
||||
}
|
BIN
roles/mirror/base/files/static/icons/7z.png
Normal file
After Width: | Height: | Size: 185 B |
BIN
roles/mirror/base/files/static/icons/avi.png
Normal file
After Width: | Height: | Size: 606 B |
BIN
roles/mirror/base/files/static/icons/bash.png
Normal file
After Width: | Height: | Size: 520 B |
BIN
roles/mirror/base/files/static/icons/bin.png
Normal file
After Width: | Height: | Size: 891 B |
BIN
roles/mirror/base/files/static/icons/bmp.png
Normal file
After Width: | Height: | Size: 206 B |
BIN
roles/mirror/base/files/static/icons/bz2.png
Normal file
After Width: | Height: | Size: 807 B |
BIN
roles/mirror/base/files/static/icons/c-lang.png
Normal file
After Width: | Height: | Size: 551 B |
BIN
roles/mirror/base/files/static/icons/changelog.png
Normal file
After Width: | Height: | Size: 748 B |
BIN
roles/mirror/base/files/static/icons/chm.png
Normal file
After Width: | Height: | Size: 662 B |
BIN
roles/mirror/base/files/static/icons/copying.png
Normal file
After Width: | Height: | Size: 593 B |
BIN
roles/mirror/base/files/static/icons/cpp.png
Normal file
After Width: | Height: | Size: 930 B |
BIN
roles/mirror/base/files/static/icons/css.png
Normal file
After Width: | Height: | Size: 731 B |
BIN
roles/mirror/base/files/static/icons/csv.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
roles/mirror/base/files/static/icons/deb.png
Normal file
After Width: | Height: | Size: 653 B |
BIN
roles/mirror/base/files/static/icons/djvu.png
Normal file
After Width: | Height: | Size: 212 B |
BIN
roles/mirror/base/files/static/icons/doc.png
Normal file
After Width: | Height: | Size: 777 B |
BIN
roles/mirror/base/files/static/icons/empty.png
Normal file
After Width: | Height: | Size: 688 B |
BIN
roles/mirror/base/files/static/icons/epub.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
roles/mirror/base/files/static/icons/flac.png
Normal file
After Width: | Height: | Size: 910 B |
BIN
roles/mirror/base/files/static/icons/flv.png
Normal file
After Width: | Height: | Size: 474 B |
BIN
roles/mirror/base/files/static/icons/folder.png
Normal file
After Width: | Height: | Size: 537 B |
BIN
roles/mirror/base/files/static/icons/gif.png
Normal file
After Width: | Height: | Size: 262 B |
BIN
roles/mirror/base/files/static/icons/go-lang.png
Normal file
After Width: | Height: | Size: 543 B |
BIN
roles/mirror/base/files/static/icons/header.png
Normal file
After Width: | Height: | Size: 528 B |
BIN
roles/mirror/base/files/static/icons/html.png
Normal file
After Width: | Height: | Size: 883 B |
BIN
roles/mirror/base/files/static/icons/ico.png
Normal file
After Width: | Height: | Size: 487 B |
BIN
roles/mirror/base/files/static/icons/ini.png
Normal file
After Width: | Height: | Size: 878 B |
BIN
roles/mirror/base/files/static/icons/install.png
Normal file
After Width: | Height: | Size: 646 B |
BIN
roles/mirror/base/files/static/icons/iso.png
Normal file
After Width: | Height: | Size: 673 B |
BIN
roles/mirror/base/files/static/icons/java.png
Normal file
After Width: | Height: | Size: 756 B |
BIN
roles/mirror/base/files/static/icons/javascript.png
Normal file
After Width: | Height: | Size: 606 B |
BIN
roles/mirror/base/files/static/icons/jpg.png
Normal file
After Width: | Height: | Size: 282 B |
BIN
roles/mirror/base/files/static/icons/json.png
Normal file
After Width: | Height: | Size: 435 B |
BIN
roles/mirror/base/files/static/icons/less.png
Normal file
After Width: | Height: | Size: 593 B |
BIN
roles/mirror/base/files/static/icons/license.png
Normal file
After Width: | Height: | Size: 764 B |
BIN
roles/mirror/base/files/static/icons/lock.png
Normal file
After Width: | Height: | Size: 749 B |
BIN
roles/mirror/base/files/static/icons/lock2.png
Normal file
After Width: | Height: | Size: 756 B |
BIN
roles/mirror/base/files/static/icons/lock3.png
Normal file
After Width: | Height: | Size: 496 B |
BIN
roles/mirror/base/files/static/icons/lua.png
Normal file
After Width: | Height: | Size: 923 B |
BIN
roles/mirror/base/files/static/icons/mkv.png
Normal file
After Width: | Height: | Size: 739 B |
BIN
roles/mirror/base/files/static/icons/mobi.png
Normal file
After Width: | Height: | Size: 784 B |
BIN
roles/mirror/base/files/static/icons/mov.png
Normal file
After Width: | Height: | Size: 690 B |
BIN
roles/mirror/base/files/static/icons/mp3.png
Normal file
After Width: | Height: | Size: 991 B |
BIN
roles/mirror/base/files/static/icons/mp4.png
Normal file
After Width: | Height: | Size: 285 B |
BIN
roles/mirror/base/files/static/icons/nfo.png
Normal file
After Width: | Height: | Size: 355 B |
BIN
roles/mirror/base/files/static/icons/nim.png
Normal file
After Width: | Height: | Size: 420 B |
BIN
roles/mirror/base/files/static/icons/none.png
Normal file
After Width: | Height: | Size: 342 B |
BIN
roles/mirror/base/files/static/icons/pdf.png
Normal file
After Width: | Height: | Size: 470 B |
BIN
roles/mirror/base/files/static/icons/perl.png
Normal file
After Width: | Height: | Size: 932 B |
BIN
roles/mirror/base/files/static/icons/php.png
Normal file
After Width: | Height: | Size: 249 B |
BIN
roles/mirror/base/files/static/icons/png.png
Normal file
After Width: | Height: | Size: 210 B |
BIN
roles/mirror/base/files/static/icons/psd.png
Normal file
After Width: | Height: | Size: 735 B |
BIN
roles/mirror/base/files/static/icons/python.png
Normal file
After Width: | Height: | Size: 695 B |
BIN
roles/mirror/base/files/static/icons/rar.png
Normal file
After Width: | Height: | Size: 497 B |
BIN
roles/mirror/base/files/static/icons/readme.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
roles/mirror/base/files/static/icons/reg.png
Normal file
After Width: | Height: | Size: 233 B |
BIN
roles/mirror/base/files/static/icons/rp.png
Normal file
After Width: | Height: | Size: 840 B |
BIN
roles/mirror/base/files/static/icons/rpm.png
Normal file
After Width: | Height: | Size: 660 B |
BIN
roles/mirror/base/files/static/icons/rtf.png
Normal file
After Width: | Height: | Size: 211 B |
BIN
roles/mirror/base/files/static/icons/ruby.png
Normal file
After Width: | Height: | Size: 925 B |
BIN
roles/mirror/base/files/static/icons/rust.png
Normal file
After Width: | Height: | Size: 474 B |
BIN
roles/mirror/base/files/static/icons/sql.png
Normal file
After Width: | Height: | Size: 492 B |
BIN
roles/mirror/base/files/static/icons/sqlite.png
Normal file
After Width: | Height: | Size: 883 B |
BIN
roles/mirror/base/files/static/icons/tar.png
Normal file
After Width: | Height: | Size: 288 B |
BIN
roles/mirror/base/files/static/icons/text.png
Normal file
After Width: | Height: | Size: 246 B |
BIN
roles/mirror/base/files/static/icons/tgz.png
Normal file
After Width: | Height: | Size: 853 B |
BIN
roles/mirror/base/files/static/icons/txt.png
Normal file
After Width: | Height: | Size: 246 B |
BIN
roles/mirror/base/files/static/icons/wav.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
roles/mirror/base/files/static/icons/xml.png
Normal file
After Width: | Height: | Size: 400 B |
BIN
roles/mirror/base/files/static/icons/yaml.png
Normal file
After Width: | Height: | Size: 461 B |
BIN
roles/mirror/base/files/static/icons/zip.png
Normal file
After Width: | Height: | Size: 375 B |
0
roles/mirror/base/files/static/index.html
Normal file
BIN
roles/mirror/base/files/static/logo.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
84
roles/mirror/base/files/static/mirror.css
Normal file
|
@ -0,0 +1,84 @@
|
|||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Arial,sans-serif;
|
||||
color: #172B4D;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
#navbar {
|
||||
padding-top: 15px;
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
.mirrorlist-button {
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
padding: 16px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.mirrorlist {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 100px;
|
||||
display: inline-block;
|
||||
float: right;
|
||||
}
|
||||
.mirrorlist-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #f9f9f9;
|
||||
min-width: 160px;
|
||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||||
padding: 12px 16px;
|
||||
z-index: 1;
|
||||
}
|
||||
.mirrorlist-content a {
|
||||
display: block;
|
||||
padding: 10px 10px;
|
||||
}
|
||||
.mirrorlist:hover .mirrorlist-content {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
// directory listings
|
||||
#content {
|
||||
margin: 50px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 20px;
|
||||
padding: 0px 50px;
|
||||
}
|
||||
|
||||
table {
|
||||
padding: 0px 50px;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #172b4d;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
td, th {
|
||||
padding: 5px 60px;
|
||||
padding-left: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 1px solid #172b4d;
|
||||
}
|
4
roles/mirror/base/meta/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
|
||||
dependencies:
|
||||
- {role: nginx/server}
|
|
@ -85,3 +85,28 @@
|
|||
minute: 10
|
||||
job: "find /var/log/sync-mirrors/ -xdev -type f -mtime +30 -name '*.log' -execdir rm {} \\+"
|
||||
user: mirror
|
||||
|
||||
- name: copy static web content
|
||||
synchronize:
|
||||
dest: "/srv/web/{{ inventory_hostname }}/"
|
||||
delete: yes
|
||||
recursive: yes
|
||||
src: static
|
||||
|
||||
- name: install nginx xslt config
|
||||
copy:
|
||||
dest: /etc/nginx/mirror.xslt
|
||||
src: mirror.xslt
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
notify: restart nginx
|
||||
|
||||
- name: create nginx mirror config
|
||||
template:
|
||||
dest: "/etc/nginx/conf.d/{{ inventory_hostname }}/mirror.conf"
|
||||
src: mirror.conf.j2
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
notify: restart nginx
|
||||
|
|
6
roles/mirror/base/templates/mirror.conf.j2
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
location / {
|
||||
autoindex on;
|
||||
autoindex_format xml;
|
||||
xslt_stylesheet /etc/nginx/mirror.xslt path="$uri";
|
||||
}
|
|
@ -15,3 +15,11 @@
|
|||
mode: 0755
|
||||
owner: mirror
|
||||
group: mirror
|
||||
|
||||
- name: link target directory to web
|
||||
file:
|
||||
path: "/srv/web/{{ inventory_hostname }}/{{ label }}"
|
||||
src: "/srv/mirrors/{{ label }}"
|
||||
state: link
|
||||
owner: mirror
|
||||
group: mirror
|
||||
|
|