Initial commit

This commit is contained in:
saibotk 2020-08-10 01:37:13 +02:00
commit ac6d8172dd
No known key found for this signature in database
GPG key ID: A3299C587D5DF523
171 changed files with 8726 additions and 0 deletions

674
LICENSE Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

21
README.md Normal file
View file

@ -0,0 +1,21 @@
# Infrastructure
Ansible infrastructure playbooks/roles for the saibotk.de services.
# Setup
Install all required roles from ansible galaxy using:
```
ansible-galaxy install -f -r requirements.yml
```
Run with your local (test) inventory:
```
ansible-playbook -i test.inventory PLAYBOOK.yml
```
# License
This repository is licensed under GPL-3 and many roles are derived from the awesome [infrastructure](https://git.shivering-isles.com/shivering-isles/infrastructure) repository published by [Sheogorath](https://shivering-isles.com).
Thank you, and so i hope this can be as useful to someone else as Sheogorath's repository was to me.

11
ansible.cfg Normal file
View file

@ -0,0 +1,11 @@
[defaults]
roles_path = ~/.ansible/roles
inventory = ./inventory
retry_files_enabled = false
vault_password_file = .vault_pass
[ssh_connection]
scp_if_ssh = true
[privilege_escalation]
become_ask_pass = false

27
camo.yml Normal file
View file

@ -0,0 +1,27 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: camo
roles:
- docker
- docker-compose
- traefik
- camo
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

26
codimd.yml Normal file
View file

@ -0,0 +1,26 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: codimd
roles:
- docker
- docker-compose
- traefik
- codimd
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

25
docker-ipv6-nat.yml Normal file
View file

@ -0,0 +1,25 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: docker_ipv6_nat
roles:
- docker
- docker-compose
- docker-ipv6-nat
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

26
gitlab-runner.yml Normal file
View file

@ -0,0 +1,26 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: gitlab_runner
roles:
- docker
- docker-compose
- gitlab-runner
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

27
gitlab.yml Normal file
View file

@ -0,0 +1,27 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: gitlab
roles:
- docker
- docker-compose
- traefik
- gitlab
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

View file

@ -0,0 +1,6 @@
By default, the installer will not expand the LUKS partition to 100%, which is needed for eg. snapshots etc, and to properly use LVM.
# Steps
1. Resize LUKS partition with parted -> resizepart (number) -> 100% -> quit
2. reboot
3. pvresize /dev/mapper/luks-YOURPARTITION

View file

@ -0,0 +1,30 @@
With early networking and LUKS,
you dont want dracut overwriting your manual ifcfg config.
So follow these steps:
- Disable & mask rhel-import-state.service
- add NM_CONTROLLED=no to /etc/sysconfig/network-scripts/ifcfg-eth0
- Append %eth0 to the ipv6 gateway in the ifcfg script
Example ifcfg-eth0:
```
TYPE="Ethernet"
NM_CONTROLLED="no"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
DNS1=1.1.1.1
DNS2=9.9.9.9
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6ADDR=YOURIPADDRESS
IPV6_DEFAULTGW=fe80::1%eth0
DNS3=2606:4700:4700::1111
DNS4=2620:fe::fe
IPV6_FAILURE_FATAL="no"
NAME="eth0"
UUID="RANDOM"
DEVICE="eth0"
ONBOOT="yes"
```

27
keycloak.yml Normal file
View file

@ -0,0 +1,27 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: keycloak
roles:
- docker
- docker-compose
- traefik
- keycloak
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

22
luks-ssh.yml Normal file
View file

@ -0,0 +1,22 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: luks_ssh
roles:
- haveged
- luks_ssh

24
lvm-self-backup.yml Normal file
View file

@ -0,0 +1,24 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: lvm_self_backup
roles:
- docker
- lvm-self-backup
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

30
mailcow.yml Normal file
View file

@ -0,0 +1,30 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: mailcow
roles:
- docker
- docker-compose
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages
# Manual steps:
# Open ports / disable postfix
#
# Install crontab:
# 5 4 * * * MAILCOW_BACKUP_LOCATION=/srv/mailcow-backups /srv/mailcow-dockerized/helper-scripts/backup_and_restore.sh backup all --delete-days 8

27
mastodon.yml Normal file
View file

@ -0,0 +1,27 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: mastodon
roles:
- docker
- docker-compose
- traefik
- mastodon
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

26
minecraft-blockmap.yml Normal file
View file

@ -0,0 +1,26 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: minecraft
roles:
- docker
- docker-compose
- traefik
- minecraft-blockmap
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

26
minecraft.yml Normal file
View file

@ -0,0 +1,26 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: minecraft
roles:
- docker
- docker-compose
- minecraft
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

27
minio.yml Normal file
View file

@ -0,0 +1,27 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: minio
roles:
- docker
- docker-compose
- traefik
- minio
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

35
monitoring.yml Normal file
View file

@ -0,0 +1,35 @@
---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- hosts: monitoring
roles:
- docker
- docker-compose
- traefik
- monitoring
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages
- hosts: all
roles:
- docker
- docker-compose
- telegraf
environment:
PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages

3
requirements.yml Normal file
View file

@ -0,0 +1,3 @@
---
- src: dev-sec.ssh-hardening
version: 9.4.0

35
roles/camo/README.md Normal file
View file

@ -0,0 +1,35 @@
Camo
=========
This will setup a [go-camo](https://github.com/cactus/go-camo) content proxy server with their official docker container and traefik.
Requirements
------------
You will need to have docker, docker-compose and traefik installed or declared as dependencies with their respective roles.
**This role assumes that you have setup traefik with an endpoint called `websecure`.**
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
### Global variables, that are used:
- `proxy_network`: Defined by the local traefik installation, this is the shared proxy network used by traefik to reach the containers. (optional)
- `proxy_hiddenservice`: Defined by the local traefik installation, this is used to generate the alt-svc header for the alternative Tor domain. (optional)
Dependencies
------------
- docker
- docker-compose
- traefik
License
-------
GPL-3.0-only

View file

@ -0,0 +1,41 @@
---
# Default variables for the camo role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The install location (where the docker-compose file is stored)
camo_install_location: "/srv/camo"
# The camo version that should be used
camo_version: "2.1.4"
# The domain under which camo should be available using traefik
camo_domain: camo.example.com
# The certresolver that is used by traefik for camo's domain
camo_traefik_certresolver: "letsencrypt_http"
# The HMAC key to be used
camo_key: "{{ lookup('passwordstore', camo_domain + '/hmac-key create=true length=128') }}"
# The maximum allowed response size (in KB). (0 means unlimited)
camo_max_size: 0
# Docker image and version
camo_image: "docker.io/cactus4docker/go-camo"
camo_image_version: "v{{ camo_version }}"

17
roles/camo/meta/main.yml Normal file
View file

@ -0,0 +1,17 @@
galaxy_info:
author: saibotk
description: Installs a go-camo image proxy server.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies:
- docker
- docker-compose
- traefik

51
roles/camo/tasks/main.yml Normal file
View file

@ -0,0 +1,51 @@
---
# Tasks file for the camo role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Create install directory
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ camo_install_location }}"
become: true
tags:
- camo
- name: Deploy docker-compose.yml
template:
src: docker-compose.yml
dest: "{{ camo_install_location }}/docker-compose.yml"
mode: '0600'
owner: 'root'
group: 'root'
validate: python2 -m compose -f %s config -q
tags:
- docker
- camo
become: true
- name: Compose camo container
docker_compose:
state: present
project_src: "{{ camo_install_location }}"
pull: yes
remove_orphans: yes
tags:
- camo
become: true

View file

@ -0,0 +1,62 @@
{{ ansible_managed | comment }}
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
version: '2'
services:
camo:
image: "{{ camo_image }}:{{ camo_image_version }}"
mem_limit: 64mb
memswap_limit: 128mb
security_opt:
- no-new-privileges
environment:
- "GOCAMO_HMAC={{ camo_key }}"
labels:
- "traefik.enable=true"
- "traefik.http.routers.camo.rule=Host(`{{ camo_domain }}`) && PathPrefix(`/`)"
- "traefik.http.routers.camo.entrypoints=websecure"
- "traefik.http.routers.camo.tls=true"
- "traefik.http.routers.camo.tls.certresolver={{ camo_traefik_certresolver }}"
- "traefik.http.routers.camo.middlewares=camo,compress"
- "traefik.http.middlewares.camo.headers.sslredirect=true"
- "traefik.http.middlewares.camo.headers.stsSeconds=63072000"
- "traefik.http.middlewares.camo.headers.referrerPolicy=no-referrer"
{% if proxy_network is defined %}
- "traefik.docker.network={{ proxy_network }}"
{% endif %}
{% if proxy_hiddenservice is defined and proxy_hiddenservice.content is defined %}
- "traefik.http.middlewares.camo.headers.customresponseheaders.alt-svc=h2={{ proxy_hiddenservice['content'] | b64decode | trim }}:443; ma=2592000"
{% endif %}
command:
- "--max-size={{ camo_max_size }}"
- "--server-name='go-camo v{{ camo_version }}'"
restart: always
{% if proxy_network is defined %}
networks:
{{ proxy_network }}:
{% endif %}
{% if proxy_network is defined %}
networks:
{{ proxy_network }}:
external: true
{% endif %}

35
roles/codimd/README.md Normal file
View file

@ -0,0 +1,35 @@
CodiMD
=========
This will setup a [CodiMD](https://github.com/codimd/server) server with their official docker container and traefik.
Requirements
------------
You will need to have docker, docker-compose and traefik installed or declared as dependencies with their respective roles.
**This role assumes that you have setup traefik with an endpoint called `websecure`.**
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
### Global variables, that are used:
- `proxy_network`: Defined by the local traefik installation, this is the shared proxy network used by traefik to reach the containers. (optional)
- `proxy_hiddenservice`: Defined by the local traefik installation, this is used to generate the alt-svc header for the alternative Tor domain. (optional)
Dependencies
------------
- docker
- docker-compose
- traefik
License
-------
GPL-3.0-only

View file

@ -0,0 +1,64 @@
---
# Default variables for the codimd role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Database access variables: Please change/set the password!
codimd_database_user: codimd
codimd_database_password: codimdpass
codimd_database_name: codimd
# Adjust specific data locations, usually you would want to only adjust the "codimd_install_location" (the base path):
codimd_install_location: /srv/codimd
codimd_database_location: "{{ codimd_install_location }}/database"
codimd_uploads_location: "{{ codimd_install_location }}/uploads"
# Should a local uploads directory be created and mounted?
codimd_uploads_local: false
# Set the certresolver to your desired traefik certresolver.
# Note: This is `letsencrypt_cf` by default for backwards compatibility, you might want to use `letsencrypt_http` instead, depending on your setup
codimd_traefik_certresolver: letsencrypt_http
# The domain under which traefik should make CodiMD reachable
codimd_domain: pad.example.com
# This is where all application related environment variables are defined except the database connection.
# For all possible environment variables look here: https://github.com/codimd/server/blob/master/docs/configuration.md.
# Note: All variables below will automatically be prefixed with "CMD_", eg. "DOMAIN" will automatically become "CMD_DOMAIN".
codimd_options:
ALLOW_FREE_URL: false
DOMAIN: "{{ codimd_domain }}"
EMAIL: false
PROTOCOL_USESSL: true
URL_ADDPORT: false
USECDN: true
# The version of codimd and its postgres server
# (don't upgrade postgres without a backup etc, as it might have introduced breaking changes!)
codimd_version: 1.6.0
codimd_postgres_version: 11.8
# The image tags that should be used (templated using the versions provided above)
codimd_image_version: "{{ codimd_version }}"
codimd_postgres_image_version: "{{ codimd_postgres_version }}-alpine"
# SELinux level for codimd and the database, which are applied to their data folders and the containers.
# (By default these will be omitted and ignored)
codimd_selinux_level: "{{ omit }}"
codimd_database_selinux_level: "{{ omit }}"

View file

@ -0,0 +1,17 @@
galaxy_info:
author: saibotk
description: Deploys a codimd server.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies:
- docker
- docker-compose
- traefik

View file

@ -0,0 +1,87 @@
---
# Tasks file for the codimd role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Alexander Wellbrock
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Update default SELinux contexts
sefcontext:
target: '{{ item.location }}(/.*)?'
setype: "container_file_t"
selevel: "{{ item.selevel | default(omit) }}"
state: present
when: item.when | default(true)
with_items:
- location: "{{ codimd_database_location }}"
selevel: "{{ codimd_database_selinux_level }}"
- location: "{{ codimd_uploads_location }}"
selevel: "{{ codimd_selinux_level }}"
when: "{{ codimd_uploads_local }}"
tags:
- codimd
become: true
- name: Create install directory
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ codimd_install_location }}"
tags:
- codimd
become: true
- name: Create data directory
file:
path: "{{ item.location }}"
state: directory
setype: "container_file_t"
selevel: "{{ item.selevel | default(omit) }}"
when: item.when | default(true)
with_items:
- location: "{{ codimd_database_location }}"
selevel: "{{ codimd_database_selinux_level }}"
- location: "{{ codimd_uploads_location }}"
selevel: "{{ codimd_selinux_level }}"
when: "{{ codimd_uploads_local }}"
tags:
- codimd
become: true
- name: Deploy docker-compose.yml
template:
src: docker-compose.yml
dest: "{{ codimd_install_location }}/docker-compose.yml"
mode: '0600'
owner: 'root'
group: 'root'
validate: python2 -m compose -f %s config -q
tags:
- docker
- codimd
become: true
- name: Compose codimd
docker_compose:
state: present
project_src: "{{ codimd_install_location }}"
pull: yes
remove_orphans: yes
tags:
- codimd
become: true

View file

@ -0,0 +1,105 @@
{{ ansible_managed | comment }}
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
version: '2'
services:
database:
image: docker.io/library/postgres:{{ codimd_postgres_image_version }}
mem_limit: 256mb
memswap_limit: 512mb
read_only: true
{% if codimd_database_selinux_level != omit %}
security_opt:
- label=level:{{ codimd_database_selinux_level }}
{% endif %}
tmpfs:
- /run/postgresql:size=512K
- /tmp:size=128K
stop_grace_period: 2m
stop_signal: SIGINT
environment:
- POSTGRES_USER={{ codimd_database_user }}
- POSTGRES_PASSWORD={{ codimd_database_password }}
- POSTGRES_DB={{ codimd_database_name }}
volumes:
- {{ codimd_database_location }}:/var/lib/postgresql/data
networks:
backend:
restart: always
codimd:
image: quay.io/codimd/server:{{ codimd_image_version }}
mem_limit: 256mb
memswap_limit: 512mb
restart: always
read_only: true
{% if codimd_selinux_level != omit %}
security_opt:
- label=level:{{ codimd_selinux_level }}
{% endif %}
tmpfs:
- /tmp:size=10M
{% if not codimd_uploads_local %}
- /codimd/public/uploads:size=10M
{% endif %}
environment:
- "CMD_DB_URL=postgres://{{ codimd_database_user }}:{{ codimd_database_password }}@database:5432/{{ codimd_database_name }}"
{% for key, value in codimd_options.items() %}
- "CMD_{{ key }}={{ value }}"
{% endfor %}
labels:
- "traefik.http.routers.codimd.rule=Host(`{{ codimd_domain }}`) && PathPrefix(`/`)"
- "traefik.http.routers.codimd.entrypoints=websecure"
- "traefik.http.routers.codimd.tls=true"
- "traefik.http.routers.codimd.tls.certresolver={{ codimd_traefik_certresolver }}"
- "traefik.http.routers.codimd.middlewares=codimd,compress"
- "traefik.http.routers.codimd.service=codimd"
- "traefik.http.services.codimd.loadbalancer.server.port=3000"
- "traefik.http.middlewares.codimd.headers.sslredirect=true"
- "traefik.http.middlewares.codimd.headers.stsSeconds=63072000"
- "traefik.http.middlewares.codimd.headers.browserXssFilter=true"
- "traefik.http.middlewares.codimd.headers.contentTypeNosniff=true"
- "traefik.enable=true"
{% if proxy_network is defined %}
- "traefik.docker.network={{ proxy_network }}"
{% endif %}
{% if proxy_hiddenservice is defined and proxy_hiddenservice.content is defined %}
- "traefik.http.middlewares.codimd.headers.customresponseheaders.alt-svc=h2={{ proxy_hiddenservice['content'] | b64decode | trim }}:443; ma=2592000"
{% endif %}
{% if codimd_uploads_local %}
volumes:
- {{ codimd_uploads_location }}:/codimd/public/uploads
{% endif %}
networks:
backend:
{% if proxy_network is defined %}
{{ proxy_network }}:
{% endif %}
networks:
backend:
{% if proxy_network is defined %}
{{ proxy_network }}:
external: true
{% endif %}

View file

@ -0,0 +1,27 @@
docker-compose
=========
This will install the [docker-compose](https://docs.docker.com/compose/) python library via pip and by default choose another install location,
to prevent breaking system-wide pip packages.
Requirements
------------
You will need to have the EPEL repository enabled (eg. by installing the `epel-release` package), if you want to install `docker-compose` via yum.
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
Dependencies
------------
- epel (optional/situational)
License
-------
GPL-3.0-only

View file

@ -0,0 +1,46 @@
---
# Default variables for the docker-compose role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Control if the docker-compose package from the EPEL should be removed (default)
docker_compose_package: "docker-compose"
docker_compose_package_state: "absent"
# Should a docker-compose wrapper script be deployed?
# This will ensure, that you can still use the `docker-compose` command as usual.
docker_compose_install_wrapper: true
docker_compose_wrapper_path: /usr/local/bin/docker-compose
# Should docker-compose be installed via pip to another target?
# This is used to prevent docker-compose from corrupting other system-wide installed pip packages and thus
# the package will be installed standalone in another directory as defined below.
docker_compose_python_package_install: true
docker_compose_python_package_path: /opt/python2/ansible-dependencies
# The name of the package to install pip via yum
docker_compose_python_pip_package: "python-pip"
docker_compose_python_pip_package_state: "present"
# The name of the package to install virtualenv via yum
docker_compose_python_virtualenv_package: "python-virtualenv"
docker_compose_python_virtualenv_package_state: "present"
# The pip package name of for `docker-compose`
docker_compose_pip_package: "docker-compose"
docker_compose_pip_package_state: "present"
docker_compose_pip_package_version: "1.24.1"

View file

@ -0,0 +1,14 @@
galaxy_info:
author: saibotk
description: Installs the docker-compose pip package.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies: []

View file

@ -0,0 +1,66 @@
---
# Tasks file for the docker-compose role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Ensure package install state
package:
name: "{{ docker_compose_package }}"
state: "{{ docker_compose_package_state }}"
become: true
- name: Ensure pip & virtualenv is installed.
package:
name: "{{ item.name }}"
state: "{{ item.state }}"
become: true
loop:
- name: "{{ docker_compose_python_pip_package }}"
state: "{{ docker_compose_python_pip_package_state }}"
- name: "{{ docker_compose_python_virtualenv_package }}"
state: "{{ docker_compose_python_virtualenv_package_state }}"
when: docker_compose_python_package_install
- name: Install docker-compose python package.
pip:
name: "{{ docker_compose_pip_package }}"
state: "{{ docker_compose_pip_package_state }}"
virtualenv: "{{ docker_compose_python_package_path }}"
version: "{{ docker_compose_pip_package_version | default(omit) }}"
become: true
changed_when: false
when: docker_compose_python_package_install
- name: Deploy docker-compose wrapper
template:
src: bin/docker-compose.j2
dest: "{{ docker_compose_wrapper_path }}"
owner: root
group: root
mode: '0755'
become: true
when:
- docker_compose_install_wrapper
- name: Create symlink in /usr/bin for wrapper
file:
src: "{{ docker_compose_wrapper_path }}"
dest: "/usr/bin/docker-compose"
state: link
become: true
when:
- docker_compose_install_wrapper

View file

@ -0,0 +1,21 @@
#!/usr/bin/env sh
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -eo pipefail
exec {{ docker_compose_python_package_path }}/bin/docker-compose "$@"

View file

@ -0,0 +1,31 @@
Docker-IPv6-NAT
===============
This will install the [docker-ipv6nat](https://github.com/robbertkl/docker-ipv6nat) container to manage IPv6 with ease on a single IP.
The container will automatically create ip6table forwarding rules on demand. To use the functionality, make sure that each container, that exposes a port
also has an `ipv6_enabled: true` user-defined network attached to it, with a ULA IPv6 for the tool to forward to.
**Note: This will enable the kernel module `ipv6nat` if not enabled!**
Requirements
------------
You will need to have docker, docker-compose installed or declared as dependencies with their respective roles.
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
Dependencies
------------
- docker
- docker-compose
License
-------
GPL-3.0-only

View file

@ -0,0 +1,25 @@
---
# Default variables for the docker-ipv6-nat role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The install location (where the docker-compose.yml file will be deployed)
docker_ipv6_nat_install_location: /srv/docker-ipv6-nat
# The docker image and version/tag to use
docker_ipv6_nat_baseimage: docker.io/robbertkl/ipv6nat
docker_ipv6_nat_version: 0.4.2

View file

@ -0,0 +1,16 @@
galaxy_info:
author: saibotk
description: Deploys a robbertkl/ipv6nat container.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies:
- docker
- docker-compose

View file

@ -0,0 +1,52 @@
---
# Tasks file for the docker-ipv6-nat role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Create install directory
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ docker_ipv6_nat_install_location }}"
tags:
- docker-ipv6-nat
become: true
- name: Deploy docker-compose.yml
template:
src: docker-compose.yml
dest: "{{ docker_ipv6_nat_install_location }}/docker-compose.yml"
mode: '0600'
owner: 'root'
group: 'root'
validate: python2 -m compose -f %s config -q
tags:
- docker
- docker-ipv6-nat
become: true
- name: Compose docker-ipv6-nat
docker_compose:
state: present
project_src: "{{ docker_ipv6_nat_install_location }}"
pull: yes
remove_orphans: yes
tags:
- docker
- docker-ipv6-nat
become: true

View file

@ -0,0 +1,35 @@
{{ ansible_managed | comment }}
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
version: '2'
services:
ipv6nat:
image: {{ docker_ipv6_nat_baseimage }}:{{ docker_ipv6_nat_version }}
security_opt:
- label:disable
restart: always
network_mode: "host"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "/lib/modules:/lib/modules:ro"
cap_drop:
- ALL
cap_add:
- NET_ADMIN
- NET_RAW
- SYS_MODULE

26
roles/docker/README.md Normal file
View file

@ -0,0 +1,26 @@
Docker
=========
This will install [Docker](https://www.docker.com/) from their official repository and install the docker python library via pip.
Requirements
------------
You will need to have the EPEL repository enabled (eg. by installing the `epel-release` package).
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
Dependencies
------------
- epel
License
-------
GPL-3.0-only

View file

@ -0,0 +1,56 @@
---
# Default variables for the docker role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Edition can be one of: 'ce' (Community Edition) or 'ee' (Enterprise Edition).
docker_edition: 'ce'
# The docker package settings
docker_package: "docker-{{ docker_edition }}"
docker_package_state: present
# Docker systemd service settings.
docker_service_state: started
docker_service_enabled: true
# The repository settings
# The repository will be added as a yum repository to allow downloading/installing the package
docker_yum_repo_url: https://download.docker.com/linux/centos/docker-{{ docker_edition }}.repo
docker_yum_repo_enable_edge: '0'
docker_yum_repo_enable_test: '0'
# Where to fetch the docker repository GPG key from
docker_yum_gpg_key: https://download.docker.com/linux/centos/gpg
# Should the python package for docker be installed via pip?
docker_python_package_install: true
# Where should it be installed? (Note: This will be installed as a standalone without breaking system dependencies)
docker_python_package_path: /opt/python2/ansible-dependencies
# The name of the package to install pip via yum
docker_python_pip_package: "python-pip"
docker_python_pip_package_state: "present"
# The name of the package to install virtualenv via yum
docker_python_virtualenv_package: "python-virtualenv"
docker_python_virtualenv_package_state: "present"
# The pip package name of the docker library
docker_pip_package: "docker"
docker_pip_package_state: "present"
docker_pip_package_version: "{{ omit }}" # This will be omitted by default, so the latest version will be installed.

View file

@ -0,0 +1,25 @@
---
# Handlers file for the docker role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Restart docker
service:
name: docker
state: "restarted"
become: true

View file

@ -0,0 +1,15 @@
galaxy_info:
author: saibotk
description: Installs docker package from their official repository and installs the docker python package via pip.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies:
- epel

View file

@ -0,0 +1,72 @@
---
# Tasks file for the docker role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Add Docker GPG key.
rpm_key:
key: "{{ docker_yum_gpg_key }}"
state: present
become: true
- name: Add Docker repository.
get_url:
url: "{{ docker_yum_repo_url }}"
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
owner: root
group: root
mode: '0644'
become: true
- name: Install Docker.
package:
name: "{{ docker_package }}"
state: "{{ docker_package_state }}"
notify: Restart docker
become: true
- name: Ensure Docker is started and enabled at boot.
service:
name: docker
state: "{{ docker_service_state }}"
enabled: "{{ docker_service_enabled | bool }}"
become: true
- name: Ensure handlers are notified now to avoid firewall conflicts.
meta: flush_handlers
- name: Ensure pip & virtualenv is installed.
package:
name: "{{ item.name }}"
state: "{{ item.state }}"
become: true
loop:
- name: "{{ docker_python_pip_package }}"
state: "{{ docker_python_pip_package_state }}"
- name: "{{ docker_python_virtualenv_package }}"
state: "{{ docker_python_virtualenv_package_state }}"
when: docker_python_package_install
- name: Install docker python package.
pip:
name: "{{ docker_pip_package }}"
state: "{{ docker_pip_package_state }}"
extra_args: "--target {{ docker_python_package_path }}"
version: "{{ docker_pip_package_version }}"
become: true
changed_when: false
when: docker_python_package_install

26
roles/epel/README.md Normal file
View file

@ -0,0 +1,26 @@
EPEL
=========
Installs the `epel-release` package via yum.
Requirements
------------
None
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
Dependencies
------------
None, except for a CentOS 7 system.
License
-------
GPL-3.0-only

14
roles/epel/meta/main.yml Normal file
View file

@ -0,0 +1,14 @@
galaxy_info:
author: saibotk
description: Installs the epel-release package.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies: []

24
roles/epel/tasks/main.yml Normal file
View file

@ -0,0 +1,24 @@
---
# Tasks file for the epel role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Install EPEL repository package
yum:
name: epel-release
state: present
become: true

26
roles/fail2ban/README.md Normal file
View file

@ -0,0 +1,26 @@
fail2ban
=========
This will install and configure the `fail2ban` package via yum and by default enable the ssh jail.
Requirements
------------
You will need to have the EPEL repository enabled (eg. by installing the `epel-release` package).
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
Dependencies
------------
- epel
License
-------
GPL-3.0-only

View file

@ -0,0 +1,32 @@
---
# Default variables for the fail2ban role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The fail2ban package name & state for the installation
fail2ban_package: "fail2ban"
fail2ban_package_state: "latest"
# Configuration for jail.local (overrides packaged configuration):
# Adjust values in the [DEFAULT] block:
fail2ban_jails_default:
bantime: 3600
# Adjust / Add configs for specific jails
fail2ban_jails:
- name: sshd
enabled: true

View file

@ -0,0 +1,24 @@
---
# Handlers file for the fail2ban role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Restart fail2ban service
service:
name: "fail2ban"
state: "restarted"
become: true

View file

@ -0,0 +1,15 @@
galaxy_info:
author: saibotk
description: Installs and configures fail2ban.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies:
- epel

View file

@ -0,0 +1,40 @@
---
# Tasks file for the fail2ban role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Install fail2ban package.
package:
name: "{{ fail2ban_package }}"
state: "{{ fail2ban_package_state }}"
become: yes
- name: Deploy fail2ban jail config.
template:
src: "jail.local.j2"
dest: "/etc/fail2ban/jail.local"
owner: 'root'
group: 'root'
notify: restart fail2ban service
become: yes
- name: Ensure fail2ban service is enabled and started.
service:
name: fail2ban
state: started
enabled: yes
become: yes

View file

@ -0,0 +1,32 @@
{{ ansible_managed | comment }}
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
[DEFAULT]
{% for option, value in fail2ban_jails_default.items() %}
{{ option }} = {{ value }}
{% endfor %}
{% for jail in fail2ban_jails %}
[{{ jail.name }}]
enabled = {{ jail.enabled | default(true) | bool | lower }}
{% for option, value in jail.items() %}
{% if option not in ['name', 'enabled'] %}
{{ option }} = {{ value }}
{% endif %}
{% endfor %}
{% endfor %}

View file

@ -0,0 +1,31 @@
gitlab-runner
=========
This will setup a [gitlab-runner](https://docs.gitlab.com/runner/) instance, used to run CI jobs from a Gitlab instance.
**NOTE: Currently this will only allow to configure an Hetzner auto-scaling docker+machine runner.**
**NOTE2: This will by default deploy docker machines with the priveleged flag enabled, so only use this in a trusted environment or set max builds to 1 to prevent malicious actions affecting other builds.**
Requirements
------------
You will need to have docker and docker-compose installed or declared as dependencies with their respective roles.
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
Dependencies
------------
- docker
- docker-compose
License
-------
GPL-3.0-only

View file

@ -0,0 +1,64 @@
---
# Default variables for the gitlab-runner role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Install location settings
gitlabrunner_install_location: "/srv/gitlab-runner"
gitlabrunner_config_location: "{{ gitlabrunner_install_location }}/config"
# The runner image & tag/version to be used
gitlabrunner_image: "quay.io/shivering-isles/gitlab-hetzner-runner"
gitlabrunner_image_version: 13.2.2
# The URL of the instance that this runner should be associated with
gitlabrunner_gitlab_url: https://gitlab.example.com
# The token that you received when registering the runner (not the register token!!!)
# Register a runner first to obtain a token: https://docs.gitlab.com/runner/register/index.html#docker
gitlabrunner_gitlab_token:
# The maximum overall concurrent running jobs. This is the most upper limit of number of jobs using all defined runners, local and autoscale.
gitlabrunner_concurrent: 1
# The limit of machines created by the runner and with that also the limit of jobs that can be handled concurrently by this specific autoscale runner.
gitlabrunner_limit: 1
# The docker-machine driver that should be used (the server provider)
gitlabrunner_machine_driver: "hetzner"
# The maximum amount of builds on a machine (VM) before a new one will be used
gitlabrunner_machine_max_builds: 20
# Time (in seconds) for machine to be in Idle state before it is removed.
gitlabrunner_machine_idle_time: 1800
# Number of machines, that need to be created and are waiting in Idle state.
gitlabrunner_machine_idle_count: 0
# The Hetzner specific API token
gitlabrunner_hetzner_token:
# The image that should be used for new machines
gitlabrunner_hetzner_image: "debian-10"
# The server type (the hardware configuration) to use for a new machine
gitlabrunner_hetzner_server_type: "cx11"
# The server location to use for a new machine
gitlabrunner_hetzner_server_location: "fsn1"
# S3 Runner cache configuration to improve performance between runs (see https://docs.gitlab.com/runner/configuration/autoscale.html#distributed-runners-caching)
gitlabrunner_cache_s3:
enabled: false
server: s3.example.com
access_key: ""
secret_key: ""
bucket: "runner"

View file

@ -0,0 +1,16 @@
galaxy_info:
author: saibotk
description: Deploys a gitlab-runner using the Hetzner docker-machine plugin.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies:
- docker
- docker-compose

View file

@ -0,0 +1,76 @@
---
# Tasks file for the gitlab-runner role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Alexander Wellbrock
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Update default SELinux contexts
sefcontext:
target: '{{ item }}(/.*)?'
setype: "container_file_t"
state: present
with_items:
- "{{ gitlabrunner_config_location }}"
become: true
- name: Create install directory
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ gitlabrunner_install_location }}"
become: true
- name: Create data directory
file:
path: "{{ item }}"
state: directory
setype: "container_file_t"
with_items:
- "{{ gitlabrunner_config_location }}"
become: true
- name: Deploy docker-compose.yml
template:
src: docker-compose.yml
dest: "{{ gitlabrunner_install_location }}/docker-compose.yml"
mode: '0600'
owner: 'root'
group: 'root'
validate: python2 -m compose -f %s config -q
tags:
- docker
become: true
- name: Deploy config.toml for gitlab-runner
template:
src: config.toml
dest: "{{ gitlabrunner_config_location }}/config.toml"
mode: '0600'
owner: 'root'
group: 'root'
become: true
- name: Compose gitlab-runner
docker_compose:
state: present
project_src: "{{ gitlabrunner_config_location }}"
pull: yes
remove_orphans: yes
tags:
- gitlab-runner
become: true

View file

@ -0,0 +1,53 @@
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
concurrent = {{ gitlabrunner_concurrent }}
check_interval = 0
[[runners]]
name = "hetzner-docker-auto-scale"
limit = {{ gitlabrunner_limit }}
url = "{{ gitlabrunner_gitlab_url }}"
token = "{{ gitlabrunner_gitlab_token }}"
executor = "docker+machine"
[runners.docker]
image = "docker:stable"
privileged = true
volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"]
[runners.machine]
IdleCount = {{ gitlabrunner_machine_idle_count }}
IdleTime = {{ gitlabrunner_machine_idle_time }}
MaxBuilds = {{ gitlabrunner_machine_max_builds }}
MachineDriver = "{{ gitlabrunner_machine_driver }}"
MachineName = "machine-%s-gitlab-runner-{{ gitlabrunner_hetzner_server_type }}"
MachineOptions = [
"hetzner-api-token={{ gitlabrunner_hetzner_token}}",
"hetzner-image={{ gitlabrunner_hetzner_image }}",
"hetzner-server-type={{ gitlabrunner_hetzner_server_type }}",
"hetzner-server-location={{ gitlabrunner_hetzner_server_location }}",
]
[runners.cache]
{% if gitlabrunner_cache_s3.enabled %}
Type = "s3"
Shared = false
[runners.cache.s3]
ServerAddress = "{{ gitlabrunner_cache_s3.server }}"
AccessKey = "{{ gitlabrunner_cache_s3.access_key }}"
SecretKey = "{{ gitlabrunner_cache_s3.secret_key }}"
BucketName = "{{ gitlabrunner_cache_s3.bucket }}"
Insecure = false
{% endif %}

View file

@ -0,0 +1,27 @@
{{ ansible_managed | comment }}
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
version: '2'
services:
runner:
image: quay.io/shivering-isles/gitlab-hetzner-runner:{{ gitlabrunner_image_version }}
mem_limit: 128mb
memswap_limit: 256mb
volumes:
- "./config:/etc/gitlab-runner"
restart: always

35
roles/gitlab/README.md Normal file
View file

@ -0,0 +1,35 @@
Gitlab
=========
This will setup a Gitlab instance using their official docker container and traefik as a reverse proxy.
Requirements
------------
You will need to have docker, docker-compose and traefik installed or declared as dependencies with their respective roles.
**This role assumes that you have setup traefik with an endpoint called `websecure`.**
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
### Global variables, that are used:
- `proxy_network`: Defined by the local traefik installation, this is the shared proxy network used by traefik to reach the containers. (optional)
- `proxy_hiddenservice`: Defined by the local traefik installation, this is used to generate the alt-svc header for the alternative Tor domain. (optional)
Dependencies
------------
- docker
- docker-compose
- traefik
License
-------
GPL-3.0-only

View file

@ -0,0 +1,94 @@
---
# Default variables for the gitlab role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Install location settings
gitlab_install_location: /srv/gitlab
gitlab_data_location: "{{ gitlab_install_location }}/data"
gitlab_config_location: "{{ gitlab_install_location }}/config"
gitlab_log_location: "{{ gitlab_install_location }}/log"
# Set the certresolver to your desired traefik certresolver.
# Note: This is `letsencrypt_cf` by default for backwards compatibility, you might want to use `letsencrypt_http` instead, depending on your setup
gitlab_traefik_certresolver: letsencrypt_http
# The domain under which traefik should make gitlab (and, if enabled, the registry) reachable
gitlab_domain: gitlab.example.com
gitlab_registry_domain: registry.gitlab.example.com
# The Gitlab version, usually you don't need to adjust this for a host.
gitlab_version: 13.2.3-ce.0
# The port you want Gitlab to listen on for SSH connections
gitlab_ssh_port: 22
# Email/SMTP settings
gitlab_smtp_address: smtp.example.com
gitlab_smtp_port: 465
gitlab_smtp_user_name: 'gitlab@example.com'
gitlab_smtp_password: "{{ lookup('passwordstore', gitlab_domain + '/' + gitlab_smtp_user_name + ' create=true length=42') }}"
gitlab_smtp_tls: "{{ gitlab_snmp_tls | default('true') }}" # There was a typo in the config option name, this makes sure it's falling back properly
gitlab_email_from: "{{ gitlab_smtp_user_name }}"
gitlab_email_reply_to: "{{ gitlab_smtp_user_name }}"
# Libravatar / Gravatar URLs
gitlab_libravatar_plain: "cdn.libravatar.org"
gitlab_libravatar_ssl: "seccdn.libravatar.org"
# CSP settings
gitlab_csp:
img_src: 'https:'
#frame_src: "https://www.google.com/recaptcha/ https://www.recaptcha.net/ https://content.googleapis.com https://content-compute.googleapis.com https://content-cloudbilling.googleapis.com https://content-cloudresourcemanager.googleapis.com"
#script_src: "https://www.google.com/recaptcha/ https://www.recaptcha.net/ https://www.gstatic.com/recaptcha/ https://apis.google.com"
# SAML settings
# gitlab_saml:
# label: "SAML"
# groups_attribute: "roles"
# external_groups: "{{ gitlab_domain }}:external"
# idp_cert_fingerprint: "<to be set>"
# idp_sso_target_url: "https://sso.example.com"
# idp_slo_target_url: "https://sso.example.com"
# issuer: "{{ gitlab_domain }}"
# certificate: "<cert without '----BEGIN CERTIFICATE----' (can be omited)>"
# private_key: "<private key without '----BEGIN RSA PRIVATE KEY----' (can be omited)>"
# attribute_statements:
# first_name: "first_name"
# last_name: "last_name"
# name: "name"
# username: "username"
# email: "email"
# name_identifier_format: urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
# autologin: false
# IMAP settings (for email replies to comments etc.)
# gitlab_imap:
# username: "{{ gitlab_smtp_user_name }}"
# password: "{{ gitlab_smtp_password }}"
# server_address: imap.example.com
# email_address: 'incoming+%{key}@gitlab.example.com'
# Gitlab docker registry settings
gitlab_registry:
enabled: false
# IPv6 ULA config for the bridge network used by docker-ipv6-nat
gitlab_ipv6:
enabled: false
subnet: "fd9e:21a7:a92c:2326::/64"

View file

@ -0,0 +1,17 @@
galaxy_info:
author: saibotk
description: Installs and configures gitlab via docker.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies:
- docker
- docker-compose
- traefik

View file

@ -0,0 +1,78 @@
---
# Tasks file for the gitlab role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Update default SELinux contexts
sefcontext:
target: '{{ item }}(/.*)?'
setype: "container_file_t"
state: present
with_items:
- "{{ gitlab_data_location }}"
- "{{ gitlab_config_location }}"
- "{{ gitlab_log_location }}"
tags:
- gitlab
become: true
- name: Create install directory
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ gitlab_install_location }}"
tags:
- gitlab
become: true
- name: Create data directory
file:
path: "{{ item }}"
state: directory
setype: "container_file_t"
with_items:
- "{{ gitlab_data_location }}"
- "{{ gitlab_config_location }}"
- "{{ gitlab_log_location }}"
tags:
- gitlab
become: true
- name: Deploy docker-compose.yml
template:
src: docker-compose.yml
dest: "{{ gitlab_install_location }}/docker-compose.yml"
mode: '0600'
owner: 'root'
group: 'root'
validate: python2 -m compose -f %s config -q
tags:
- docker
- gitlab
become: true
- name: Compose GitLab
docker_compose:
state: present
project_src: "{{ gitlab_install_location }}"
pull: yes
remove_orphans: yes
tags:
- gitlab
become: true

View file

@ -0,0 +1,228 @@
{{ ansible_managed | comment }}
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
version: '2.1'
services:
web:
image: docker.io/gitlab/gitlab-ce:{{ gitlab_version }}
hostname: '{{ gitlab_domain }}'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://{{ gitlab_domain }}'
gitlab_rails['gitlab_shell_ssh_port'] = {{ gitlab_ssh_port }}
letsencrypt['enable'] = false
nginx['listen_https'] = false
nginx['listen_port'] = 80
nginx['real_ip_trusted_addresses'] = [ '172.16.0.0/12' ]
nginx['gzip_enabled'] = false
prometheus_monitoring['enable'] = false
# CSP config
gitlab_rails['content_security_policy'] = {
enabled: true,
report_only: false,
directives: {
default_src: "'self' {{ gitlab_csp.default_src | default("") }}",
script_src: "'self' {{ gitlab_csp.script_src | default("") }} 'unsafe-eval'",
frame_ancestor: "'self'",
frame_src: "'self' {{ gitlab_csp.frame_src | default("") }}",
img_src: "'self' https://{{ gitlab_libravatar_ssl }} {{ gitlab_csp.img_src | default("") }} data: blob:",
style_src: "'self' 'unsafe-inline'",
worker_src: "'self' blob:",
object_src: "'none'"
}
}
# Mail settings
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "{{ gitlab_smtp_address }}"
gitlab_rails['smtp_port'] = {{ gitlab_smtp_port }}
gitlab_rails['smtp_user_name'] = "{{ gitlab_smtp_user_name }}"
gitlab_rails['smtp_password'] = "{{ gitlab_smtp_password }}"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_domain'] = "{{ gitlab_smtp_address }}"
gitlab_rails['smtp_tls'] = {{ gitlab_smtp_tls }}
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
gitlab_rails['gitlab_email_from'] = '{{ gitlab_email_from }}'
gitlab_rails['gitlab_email_reply_to'] = '{{ gitlab_email_reply_to }}'
# Use Libravatar
gitlab_rails['gravatar_enabled'] = true
gitlab_rails['gravatar_plain_url'] = "http://{{ gitlab_libravatar_plain }}/avatar/%{hash}?s=%{size}&d=identicon"
gitlab_rails['gravatar_ssl_url'] = "https://{{ gitlab_libravatar_ssl }}/avatar/%{hash}?s=%{size}&d=identicon"
{% if gitlab_imap is defined %}
gitlab_rails['incoming_email_enabled'] = true
# The email address including the `%{key}` placeholder that will be replaced to reference the item being replied to.
# The placeholder can be omitted but if present, it must appear in the "user" part of the address (before the `@`).
#gitlab_rails['incoming_email_address'] = "incoming+%{key}@gitlab.example.com"
gitlab_rails['incoming_email_address'] = "{{ gitlab_imap.email_address }}"
# Email account username
# With third party providers, this is usually the full email address.
# With self-hosted email servers, this is usually the user part of the email address.
gitlab_rails['incoming_email_email'] = "{{ gitlab_imap.username }}"
# Email account password
gitlab_rails['incoming_email_password'] = "{{ gitlab_imap.password }}"
# IMAP server host
gitlab_rails['incoming_email_host'] = "{{ gitlab_imap.server_address }}"
# IMAP server port
gitlab_rails['incoming_email_port'] = 993
# Whether the IMAP server uses SSL
gitlab_rails['incoming_email_ssl'] = true
# Whether the IMAP server uses StartTLS
gitlab_rails['incoming_email_start_tls'] = false
# The mailbox where incoming mail will end up. Usually "inbox".
gitlab_rails['incoming_email_mailbox_name'] = "inbox"
# The IDLE command timeout.
gitlab_rails['incoming_email_idle_timeout'] = 60
{% endif %}
{% if gitlab_registry.enabled %}
# Gitlab registry
gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_host'] = "{{ gitlab_registry_domain }}"
registry_external_url "https://{{ gitlab_registry_domain }}"
registry_nginx['listen_port'] = 5050
registry_nginx['listen_https'] = false
{% endif %}
{% if gitlab_saml is defined %}
# SAML settings
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['saml']
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_auto_link_ldap_user'] = false
gitlab_rails['omniauth_auto_link_saml_user'] = false
gitlab_rails['omniauth_external_providers'] = []
gitlab_rails['omniauth_providers'] = [
{
name: 'saml',
label: '{{ gitlab_saml.label }}',
groups_attribute: '{{ gitlab_saml.groups_attribute }}',
external_groups: ['{{ gitlab_saml.external_groups }}'],
args: {
assertion_consumer_service_url: 'https://{{ gitlab_domain }}/users/auth/saml/callback',
idp_cert_fingerprint: '{{ gitlab_saml.idp_cert_fingerprint }}',
idp_sso_target_url: '{{ gitlab_saml.idp_sso_target_url }}',
idp_slo_target_url: '{{ gitlab_saml.idp_slo_target_url }}',
{% if gitlab_saml.certificate is defined and gitlab_saml.private_key is defined %}
certificate: '-----BEGIN CERTIFICATE-----
{{ gitlab_saml.certificate }}
-----END CERTIFICATE-----',
private_key: '-----BEGIN RSA PRIVATE KEY-----
{{ gitlab_saml.private_key }}
-----END RSA PRIVATE KEY-----',
security: {
authn_requests_signed: true,
want_assertions_signed: true,
embed_sign: true,
signature_method: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',
digest_method: 'http://www.w3.org/2001/04/xmlenc#sha256',
},
{% endif %}
issuer: '{{ gitlab_saml.issuer }}',
attribute_statements: {
first_name: ['{{ gitlab_saml.attribute_statements.first_name }}'],
last_name: ['{{ gitlab_saml.attribute_statements.last_name }}'],
name: ['{{ gitlab_saml.attribute_statements.name }}'],
username: ['{{ gitlab_saml.attribute_statements.username }}'],
email: ['{{ gitlab_saml.attribute_statements.email }}'] },
name_identifier_format: '{{ gitlab_saml.name_identifier_format }}',
upstream_two_factor_authn_contexts:
%w(
urn:oasis:names:tc:SAML:2.0:ac:classes:CertificateProtectedTransport
urn:oasis:names:tc:SAML:2.0:ac:classes:SecondFactorOTPSMS
urn:oasis:names:tc:SAML:2.0:ac:classes:SecondFactorIGTOKEN
)
}
}
]
{% if gitlab_saml.autologin %}
gitlab_rails['omniauth_auto_sign_in_with_provider'] = 'saml'
{% endif %}
{% endif %}
labels:
- "traefik.http.routers.gitlab.rule=Host(`{{ gitlab_domain }}`) && PathPrefix(`/`)"
- "traefik.http.routers.gitlab.entrypoints=websecure"
- "traefik.http.routers.gitlab.tls=true"
- "traefik.http.routers.gitlab.tls.certresolver={{ gitlab_traefik_certresolver }}"
- "traefik.http.routers.gitlab.middlewares=gitlab,compress"
- "traefik.http.routers.gitlab.service=gitlab"
- "traefik.http.services.gitlab.loadbalancer.server.port=80"
{% if gitlab_registry.enabled %}
- "traefik.http.routers.gitlab-registry.rule=Host(`{{ gitlab_registry_domain }}`) && PathPrefix(`/`)"
- "traefik.http.routers.gitlab-registry.entrypoints=websecure"
- "traefik.http.routers.gitlab-registry.tls=true"
- "traefik.http.routers.gitlab-registry.tls.certresolver={{ gitlab_traefik_certresolver }}"
- "traefik.http.routers.gitlab-registry.middlewares=gitlab,compress"
- "traefik.http.routers.gitlab-registry.service=gitlab-registry"
- "traefik.http.services.gitlab-registry.loadbalancer.server.port=5050"
{% endif %}
- "traefik.http.middlewares.gitlab.headers.sslredirect=true"
- "traefik.http.middlewares.gitlab.headers.stsSeconds=63072000"
- "traefik.enable=true"
{% if proxy_network is defined %}
- "traefik.docker.network={{ proxy_network }}"
{% endif %}
{% if proxy_hiddenservice is defined and proxy_hiddenservice.content is defined %}
- "traefik.http.middlewares.gitlab.headers.customresponseheaders.alt-svc=h2={{ proxy_hiddenservice['content'] | b64decode | trim }}:443; ma=2592000"
{% endif %}
volumes:
- "{{ gitlab_data_location }}:/var/opt/gitlab"
- "{{ gitlab_config_location }}:/etc/gitlab"
- "{{ gitlab_log_location }}:/var/log/gitlab"
restart: always
ports:
- "{{ gitlab_ssh_port }}:22"
{% if proxy_network is defined or gitlab_ipv6 is defined and gitlab_ipv6.enabled %}
networks:
{% if proxy_network is defined %}
{{ proxy_network }}:
{% endif %}
{% if gitlab_ipv6 is defined and gitlab_ipv6.enabled %}
gitlab-ipv6:
{% endif %}
{% endif %}
{% if proxy_network is defined or gitlab_ipv6 is defined and gitlab_ipv6.enabled %}
networks:
{% if proxy_network is defined %}
{{ proxy_network }}:
external: true
{% endif %}
{% if gitlab_ipv6 is defined and gitlab_ipv6.enabled %}
gitlab-ipv6:
driver: bridge
ipam:
driver: default
config:
- subnet: {{ gitlab_ipv6.subnet }}
enable_ipv6: true
{% endif %}
{% endif %}

24
roles/haveged/README.md Normal file
View file

@ -0,0 +1,24 @@
Haveged
=========
Installs the haveged package, which is useful to provide continous random values, preventing cases where the system does not have enought entropy and thus does not output new random values. (Usually useful for virtualized machines)
Requirements
------------
None other than a "haveged" package being available.
Role Variables
--------------
None
Dependencies
------------
None
License
-------
GPL-3.0-only

View file

@ -0,0 +1,17 @@
galaxy_info:
author: saibotk
description: This role installs the haveged package and starts the systemd service.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: Fedora
versions:
- 32
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies: []

View file

@ -0,0 +1,32 @@
---
# Task file for the haveged role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Install haveged
package:
name: haveged
state: latest
become: true
- name: Enable haveged systemd service
service:
state: started
name: haveged
enabled: yes
become: true

35
roles/keycloak/README.md Normal file
View file

@ -0,0 +1,35 @@
Keycloak
=========
This will setup a [Keycloak](https://www.keycloak.org) instance using their official docker container and traefik as a reverse proxy.
Requirements
------------
You will need to have docker, docker-compose and traefik installed or declared as dependencies with their respective roles.
**This role assumes that you have setup traefik with an endpoint called `websecure`.**
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
### Global variables, that are used:
- `proxy_network`: Defined by the local traefik installation, this is the shared proxy network used by traefik to reach the containers. (optional)
- `proxy_hiddenservice`: Defined by the local traefik installation, this is used to generate the alt-svc header for the alternative Tor domain. (optional)
Dependencies
------------
- docker
- docker-compose
- traefik
License
-------
GPL-3.0-only

View file

@ -0,0 +1,56 @@
---
# Default variables for the keycloak role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Alexander Wellbrock
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Install locations
keycloak_install_location: /srv/keycloak
keycloak_database_location: "{{ keycloak_install_location }}/database"
# The keycloak image to use
keycloak_baseimage: docker.io/jboss/keycloak
# The keycloak & postgres version
# !!! Don't just update the postgres version, instead backup first and check if you need to migrate !!!
keycloak_version: 11.0.0
keycloak_postgres_version: 11.8
# The image tags
keycloak_image_version: "{{ keycloak_version }}"
keycloak_postgres_image_version: "{{ keycloak_postgres_version }}-alpine"
# The log level settings for keycloak
keycloak_log_level: "ERROR"
keycloak_root_log_level: "ERROR"
# The certresolver traefik should use for this domain
keycloak_traefik_certresolver: letsencrypt_http
# The domain which traefik will serve keycloak under
keycloak_domain: keycloak.example.com
# The database credentials.
keycloak_database_user: "keycloak"
keycloak_database_password: "{{ lookup('passwordstore', keycloak_domain + '/database' + ' create=true') }}"
# The default welcome theme keycloak will use
keycloak_theme_welcome: "keycloak"
# The SELinux level that should be used for the postgres data folder/container
keycloak_postgres_selinux_level: "{{ omit }}"

View file

@ -0,0 +1,17 @@
galaxy_info:
author: saibotk
description: Installs Keycloak via the official container and traefik.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies:
- docker
- docker-compose
- traefik

View file

@ -0,0 +1,75 @@
---
# Tasks file for the keycloak role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Alexander Wellbrock
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Update default SELinux contexts
sefcontext:
target: '{{ item }}(/.*)?'
setype: "container_file_t"
selevel: "{{ keycloak_postgres_selinux_level }}"
state: present
with_items:
- "{{ keycloak_database_location }}"
become: true
- name: Create install directory
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ keycloak_install_location }}"
tags:
- keycloak
become: true
- name: Create data directory
file:
path: "{{ item }}"
state: directory
setype: "container_file_t"
selevel: "{{ keycloak_postgres_selinux_level }}"
with_items:
- "{{ keycloak_database_location }}"
tags:
- keycloak
become: true
- name: Deploy docker-compose.yml
template:
src: docker-compose.yml
dest: "{{ keycloak_install_location }}/docker-compose.yml"
mode: '0600'
owner: 'root'
group: 'root'
validate: python2 -m compose -f %s config -q
tags:
- docker
- keycloak
become: true
- name: Compose keycloak
docker_compose:
state: present
project_src: "{{ keycloak_install_location }}"
pull: yes
remove_orphans: yes
tags:
- keycloak
become: true

View file

@ -0,0 +1,92 @@
{{ ansible_managed | comment }}
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
version: '2'
services:
keycloak:
image: {{ keycloak_baseimage }}:{{ keycloak_image_version }}
mem_limit: 1gb
memswap_limit: 1280mb
security_opt:
- no-new-privileges
labels:
- "traefik.http.routers.keycloak.rule=Host(`{{ keycloak_domain }}`) && PathPrefix(`/`)"
- "traefik.http.routers.keycloak.entrypoints=websecure"
- "traefik.http.routers.keycloak.tls=true"
- "traefik.http.routers.keycloak.tls.certresolver={{ keycloak_traefik_certresolver }}"
- "traefik.http.routers.keycloak.middlewares=keycloak,compress"
- "traefik.http.middlewares.keycloak.headers.sslredirect=true"
- "traefik.http.middlewares.keycloak.headers.stsSeconds=63072000"
- "traefik.enable=true"
{% if proxy_network is defined %}
- "traefik.docker.network={{ proxy_network }}"
{% endif %}
environment:
- "PROXY_ADDRESS_FORWARDING=true"
- "KEYCLOAK_HOSTNAME={{ keycloak_domain }}"
- "KEYCLOAK_LOGLEVEL={{ keycloak_log_level }}"
- "ROOT_LOGLEVEL={{ keycloak_root_log_level }}"
{% if keycloak_theme_welcome is defined %}
- "KEYCLOAK_WELCOME_THEME={{ keycloak_theme_welcome }}"
{% endif %}
- "DB_VENDOR=postgres"
- "DB_ADDR=database"
- "DB_USER={{ keycloak_database_user }}"
- "DB_PASSWORD={{ keycloak_database_password }}"
networks:
backend:
{% if proxy_network is defined %}
{{ proxy_network }}:
{% endif %}
command: ["-b", "0.0.0.0", "-Dkeycloak.profile.feature.scripts=enabled", "-Dkeycloak.profile.feature.upload_scripts=enabled"]
restart: always
database:
image: docker.io/library/postgres:{{ keycloak_postgres_image_version }}
mem_limit: 256mb
memswap_limit: 512mb
read_only: true
{% if keycloak_postgres_selinux_level != omit %}
security_opt:
- label=level:{{ keycloak_postgres_selinux_level }}
{% endif %}
tmpfs:
- /run/postgresql:size=512K
- /tmp:size=128K
stop_grace_period: 2m
stop_signal: SIGINT
environment:
- POSTGRES_USER={{ keycloak_database_user }}
- POSTGRES_PASSWORD={{ keycloak_database_password }}
volumes:
- ./database:/var/lib/postgresql/data
networks:
backend:
restart: always
networks:
backend:
internal: true
{% if proxy_network is defined %}
{{ proxy_network }}:
external: true
{% endif %}

30
roles/luks_ssh/README.md Normal file
View file

@ -0,0 +1,30 @@
luks_ssh
=========
This installs the [sshd dracut module](https://github.com/gsauthof/dracut-sshd), which will include sshd in the initramfs and make SSH available on boot. This allows for a remote passphrase input via SSH to unlock the LUKS encrypted root partition.
Files based on commit: https://github.com/gsauthof/dracut-sshd/commit/a28f695d82b2bf6237823db1f1638c4c98b82dee
**Note: This roughly reflects the changes as of the commit above, but is adjusted to explicitly import network-systemd, if needed (not used with default CentOS 7 instance), and to use a dedicated `authorized_keys` file, deployed to the module directory instead of the root users keys.**
Requirements
------------
A prepared CentOS 7 instance with ifcfg based network config / already configured network settings and a `NM_CONTROLLED=no` config for the interface, if needed, to prevent the network manager from importing the state (the network config) that was used in the initrd.
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
Dependencies
------------
None
License
-------
GPL-3.0-only

View file

@ -0,0 +1,36 @@
---
# Default variables for the luks_ssh role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The install location for the dracut module
dracut_ssh_dir: /usr/lib/dracut/modules.d/46sshd/
# The authorized keys
# fields:
# - owner - The owner of the key file
# comment - A comment for the authorized_keys file about the key
# ssh_key - A path to the ssh public key file that should be added
dracut_authorized_keys: []
# Disables the import state service
# Note: This is used to prevent issues with the import of the state that was used in the initrd, which is usually just IPv4 in DHCP mode.
luks_ssh_disable_state_import: true
# The SSH port that should be used
luks_ssh_port: 22

View file

@ -0,0 +1,98 @@
#!/bin/bash
# 2018, Georg Sauthoff <mail@gms.tf>
# SPDX-License-Identifier: GPL-3.0-or-later
# called by dracut
check() {
require_binaries sshd || return 1
# 0 enables by default, 255 only on request
return 0
}
# called by dracut
depends() {
# If systemd-networkd runs on the system, use it.
if systemctl -q is-active systemd-networkd; then
echo systemd-networkd
fi
}
# called by dracut
install() {
local key_prefix key_type ssh_host_key authorized_keys
key_prefix=
if [ "$(find /etc/ssh -maxdepth 1 -name 'dracut_ssh_host_*_key')" ]; then
key_prefix=dracut_
fi
local found_host_key=no
for key_type in dsa ecdsa ed25519 rsa; do
ssh_host_key=/etc/ssh/"$key_prefix"ssh_host_"$key_type"_key
if [ -f "$ssh_host_key" ]; then
inst_simple "$ssh_host_key".pub /etc/ssh/ssh_host_"$key_type"_key.pub
/usr/bin/install -m 600 "$ssh_host_key" \
"$initdir/etc/ssh/ssh_host_${key_type}_key"
found_host_key=yes
fi
done
if [ "$found_host_key" = no ]; then
dfatal "Didn't find any SSH host key!"
return 1
fi
authorized_keys="${moddir}/authorized_keys"
#if [ -e /root/.ssh/dracut_authorized_keys ]; then
# authorized_keys=/root/.ssh/dracut_authorized_keys
#else
# authorized_keys=/root/.ssh/authorized_keys
#fi
if [ ! -r "$authorized_keys" ]; then
dfatal "No authorized_keys for root user found!"
return 1
fi
mkdir -p -m 0700 "$initdir/root"
mkdir -p -m 0700 "$initdir/root/.ssh"
/usr/bin/install -m 600 "$authorized_keys" \
"$initdir/root/.ssh/authorized_keys"
inst_binary /usr/sbin/sshd
inst_multiple -o /etc/sysconfig/sshd /etc/sysconfig/ssh \
/etc/sysconfig/dracut-sshd
# First entry for Fedora 28, second for Fedora 27
inst_multiple -o /etc/crypto-policies/back-ends/opensshserver.config \
/etc/crypto-policies/back-ends/openssh-server.config
inst_simple "${moddir}/sshd.service" "$systemdsystemunitdir/sshd.service"
inst_simple "${moddir}/sshd_config" /etc/ssh/sshd_config
grep '^sshd:' /etc/passwd >> "$initdir/etc/passwd"
grep '^sshd:' /etc/group >> "$initdir/etc/group"
# Create privilege seperation directory
# /var/empty/sshd -> Fedora, CentOS, RHEL
# /var/emtpy -> Arch, OpenSSH upstream
# /var/lib/empty -> Suse
# /run/sshd -> Debian
# /var/chroot/ssh -> Void Linux
local d
for d in /var/empty/sshd /var/empty /var/lib/empty /run/sshd /var/chroot/ssh ; do
if [ -d "$d" ]; then
mkdir -p -m 0755 "$initdir$d"
break
fi
done
systemctl -q --root "$initdir" enable sshd
# Add command to unlock luks volumes to bash history for easier use
echo systemd-tty-ask-password-agent >> "$initdir/root/.bash_history"
chmod 600 "$initdir/root/.bash_history"
# sshd requires /var/log/lastlog for tracking login information
mkdir -p -m 0755 "$initdir/var/log"
touch "$initdir/var/log/lastlog"
return 0
}

View file

@ -0,0 +1,32 @@
[Unit]
Description=OpenSSH server daemon
Documentation=man:sshd(8) man:sshd_config(5)
DefaultDependencies=no
Before=cryptsetup.target
[Service]
# With `Type=notify` the sshd service is started in a reliable
# and robust way but it requires an sshd with systemd support.
# Fedora/RHEL/CentOS/Debian/Ubuntu provide such an sshd.
#
# On distributions such as Gentoo, sshd doesn't come with
# systemd support, thus, one has to set `Type=simple` there.
Type=notify
EnvironmentFile=-/etc/crypto-policies/back-ends/opensshserver.config
EnvironmentFile=-/etc/crypto-policies/back-ends/openssh-server.config
EnvironmentFile=-/etc/sysconfig/sshd
EnvironmentFile=-/etc/sysconfig/ssh
EnvironmentFile=-/etc/sysconfig/dracut-sshd
# Start command requires the `-e` option if and only if `Type=simple`
# is configured, see above.
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS $OPTIONS $CRYPTO_POLICY
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=sysinit.target

View file

@ -0,0 +1,33 @@
---
# Handlers file for the luks_ssh role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Alexander Wellbrock
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Regenerate grub config BIOS
command: grub2-mkconfig -o /etc/grub2.cfg
listen: Regenerate grub config
become: true
- name: Regenerate grub config EFI
command: grub2-mkconfig -o /etc/grub2-efi.cfg
listen: Regenerate grub config
become: true
- name: Regenerate dracut
command: dracut -f
become: true

View file

@ -0,0 +1,14 @@
galaxy_info:
author: saibotk
description: Installs openssh to initramfs with dracut, to unlock LUKS encrypted root partition on boot.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies: []

View file

@ -0,0 +1,114 @@
---
# Tasks file for the luks_ssh role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Create dracut extension
file:
path: "{{ dracut_ssh_dir }}"
state: directory
become: true
- name: Add SSH keys for grub2
authorized_key:
user: "root"
state: present
key: "{{ lookup('file', item.ssh_key) }}"
comment: "{{ item.owner }} - {{ item.comment }} | Managed by Ansible"
path: "{{ dracut_ssh_dir }}/authorized_keys"
with_items:
- "{{ dracut_authorized_keys }}"
become: true
notify: Regenerate dracut
- name: Copy module setup file
copy:
src: "module-setup.sh"
dest: "{{ dracut_ssh_dir }}/module-setup.sh"
mode: '0755'
become: true
notify: Regenerate dracut
- name: Copy module files
copy:
src: "{{ item }}"
dest: "{{ dracut_ssh_dir }}/{{ item }}"
become: true
with_items:
- "sshd.service"
notify: Regenerate dracut
- name: Copy templated module files
template:
src: "{{ item }}"
dest: "{{ dracut_ssh_dir }}/{{ item }}"
become: true
with_items:
- "sshd_config"
notify: Regenerate dracut
- name: Install dracut network
package:
name: dracut-network
state: present
become: true
notify: Regenerate dracut
- name: Check if line is present
shell: cat /etc/default/grub | grep GRUB_CMDLINE_LINUX_DEFAULT
changed_when: false
ignore_errors: true
register: luks_ssh_grub_default
- name: Ensure that GRUB_CMDLINE_LINUX_DEFAULT is present
lineinfile:
path: /etc/default/grub
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT'
line: 'GRUB_CMDLINE_LINUX_DEFAULT=""'
become: true
notify: Regenerate grub config
when: luks_ssh_grub_default.rc != 0
# This method will only add the parameter if it was not already added
# NOTICE: If the parameter was manually added, it will not be altered!
- name: Enable early networking kernel parameter (rd.neednet=1)
replace:
path: /etc/default/grub
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT=\"((?:(?!rd\.neednet=).)*?)"$'
replace: 'GRUB_CMDLINE_LINUX_DEFAULT="\1 rd.neednet=1"'
become: true
notify: Regenerate grub config
# This method will only add the parameter if it was not already added
# NOTICE: If the parameter was manually added, it will not be altered!
- name: Enable early networking kernel parameter (ip=dhcp)
replace:
path: /etc/default/grub
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT=\"((?:(?!ip=).)*?)"$'
replace: 'GRUB_CMDLINE_LINUX_DEFAULT="\1 ip=dhcp"'
become: true
notify: Regenerate grub config
- name: Disable rhel-import-state service, so that it doesn not overwrite ifcfg scripts.
systemd:
name: "rhel-import-state"
enabled: no
masked: yes
become: true
when:
- luks_ssh_disable_state_import

View file

@ -0,0 +1,12 @@
SyslogFacility AUTHPRIV
PermitRootLogin prohibit-password
AuthorizedKeysFile .ssh/authorized_keys
AuthenticationMethods publickey
UsePAM no
X11Forwarding no
ForceCommand systemd-tty-ask-password-agent
Port {{ luks_ssh_port }}
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE

View file

@ -0,0 +1,26 @@
lvm-self-backup
=========
This will deploy a `backup-lvm` and `backup-lvm-ls` script to backup configured LVM volumes encrypted with GPG using duplicity and list the remote content for verification. A systemd timer is also deployed to schedule automatic backups daily at 4 AM.
Requirements
------------
You will need to have docker installed or declared as a dependency with the respective role.
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
Dependencies
------------
- docker
License
-------
GPL-3.0-only

View file

@ -0,0 +1,47 @@
---
# Default variables for the lvm-self-backup role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The LVM volumes to backup
# Available fields:
# vg_name - The volume group that the volume resides in
# lv_name - The logical volume name that should be backed up
# fstype - Optional. Set to "xfs" to mount the snapshots with the `nouuid` flag when the XFS filesystem is used.
#
backup_vols: []
# The backup target (see duplicity for valid inputs)
backup_target: ""
# The duplicity image & version
backup_duplicity_image: "quay.io/sheogorath/duplicity"
backup_duplicity_version: "0.8.14"
backup_duplicity_image_version: "{{ backup_duplicity_version }}"
# The GPG options to be used when backing up
# Generate a GPG key as the root user before using this role and enter the details here!
backup_gpg:
id: ""
passphrase: "PASSWORD"
sign_key: "{{ backup_gpg.id }}"
encryption_keys:
- "{{ backup_gpg.id }}"
# Should the systemd timer be enabled to automatically backup every day?
backup_timer_enabled: true
backup_timer_state: 'started'

View file

@ -0,0 +1,15 @@
galaxy_info:
author: saibotk
description: Deploys a self backup solution using lvm and duplicity.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies:
- docker

View file

@ -0,0 +1,61 @@
---
# Tasks file for the lvm-self-backup role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Create backup mount directories
file:
path: "/backup_snapshots/{{ item.vg_name }}-{{ item.lv_name }}"
state: directory
recurse: true
with_items:
- "{{ backup_vols }}"
become: true
- name: Install backup scripts.
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: '1700'
owner: root
group: root
with_items:
- src: "backup-lvm.sh"
dest: "/usr/local/bin/backup-lvm"
- src: "backup-lvm-ls.sh"
dest: "/usr/local/bin/backup-lvm-ls"
become: true
- name: Install backup service & timer.
template:
src: "{{ item }}"
dest: /etc/systemd/system/
mode: '0755'
owner: root
group: root
with_items:
- "backup-lvm.service"
- "backup-lvm.timer"
become: true
- name: Start & enable backup service timer.
systemd:
daemon_reload: yes
name: backup-lvm.timer
enabled: '{{ backup_timer_enabled | bool }}'
state: '{{ backup_timer_state }}'
become: true

View file

@ -0,0 +1,37 @@
#!/bin/sh
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
echo "Listing backed up data:"
docker run --name="duplicity-backup-lvm" \
--security-opt "label=disable" \
--security-opt "no-new-privileges" \
--cap-drop=ALL \
--cap-add=DAC_OVERRIDE \
--rm \
-v "$HOME/.cache/duplicity/:/archive" \
-v "/root/.gnupg/:/root/.gnupg/" \
-v "/backup_snapshots/:/backup/:ro" \
-e "PASSPHRASE={{ backup_gpg.passphrase }}" \
--hostname {{ ansible_fqdn }} \
{{ backup_duplicity_image }}:{{ backup_duplicity_image_version }} \
list-current-files \
--sign-key "{{ backup_gpg.sign_key | default(backup_gpg.id) }}" \
{% for encryption_key in backup_gpg.encryption_keys | default([backup_gpg.id]) %}
--encrypt-key "{{ encryption_key }}" \
{% endfor %}
"{{ backup_target }}"

View file

@ -0,0 +1,6 @@
[Unit]
Description=Start lvm backup using duplicity.
[Service]
Type=oneshot
ExecStart=/usr/local/bin/backup-lvm

View file

@ -0,0 +1,62 @@
#!/bin/sh
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
echo "LVM backup started:"
echo "Creating snapshots:"
{% for item in backup_vols %}
lvcreate -L 1G -n {{ item.lv_name }}_snap -s {{ item.vg_name }}/{{ item.lv_name }}
{% endfor %}
echo "Mount snapshots:"
{% for item in backup_vols %}
mount -o ro,nosuid,noexec{% if item.fstype is defined and item.fstype == "xfs" %},nouuid{% endif %} -t {{ item.fstype | default("ext4") }} /dev/{{ item.vg_name }}/{{ item.lv_name }}_snap /backup_snapshots/{{ item.vg_name }}-{{ item.lv_name }}
{% endfor %}
echo "Backup data:"
docker run --name="duplicity-backup-lvm" \
--security-opt "label=disable" \
--security-opt "no-new-privileges" \
--cap-drop=ALL \
--cap-add=DAC_OVERRIDE \
--rm \
-v "$HOME/.cache/duplicity/:/archive" \
-v "/root/.gnupg/:/root/.gnupg/" \
-v "/backup_snapshots/:/backup/:ro" \
-e "PASSPHRASE={{ backup_gpg.passphrase }}" \
--hostname {{ ansible_fqdn }} \
{{ backup_duplicity_image }}:{{ backup_duplicity_image_version }} \
--full-if-older-than 1M \
--sign-key "{{ backup_gpg.sign_key | default(backup_gpg.id) }}" \
{% for encryption_key in backup_gpg.encryption_keys | default([backup_gpg.id]) %}
--encrypt-key "{{ encryption_key }}" \
{% endfor %}
/backup/ \
"{{ backup_target }}"
echo "Unmount snapshots:"
{% for item in backup_vols %}
umount /dev/{{ item.vg_name }}/{{ item.lv_name }}_snap
{% endfor %}
echo "Remove snapshots:"
{% for item in backup_vols %}
lvremove -f {{ item.vg_name }}/{{ item.lv_name }}_snap
{% endfor %}
echo "Backed up LVM volumes successfully"

View file

@ -0,0 +1,8 @@
[Unit]
Description=Schedule regular lvm backups.
[Timer]
OnCalendar=*-*-* 4:00:00
[Install]
WantedBy=multi-user.target

37
roles/mastodon/README.md Normal file
View file

@ -0,0 +1,37 @@
Mastodon
=========
This will setup a Mastodon instance using their official docker container and traefik as a reverse proxy.
**Note: This role will also care about migrations etc, when upgrading to a new version!**
Requirements
------------
You will need to have docker, docker-compose and traefik installed or declared as dependencies with their respective roles.
**This role assumes that you have setup traefik with an endpoint called `websecure`.**
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
### Global variables, that are used:
- `proxy_network`: Defined by the local traefik installation, this is the shared proxy network used by traefik to reach the containers. (optional)
- `proxy_hiddenservice`: Defined by the local traefik installation, this is used to generate the alt-svc header for the alternative Tor domain. (optional)
Dependencies
------------
- docker
- docker-compose
- traefik
License
-------
GPL-3.0-only

View file

@ -0,0 +1,60 @@
---
# Default variables for the mastodon role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The install location
mastodon_install_location: /srv/mastodon
# The container data volume mount locations
mastodon_database_location: "{{ mastodon_install_location }}/postgres"
mastodon_public_location: "{{ mastodon_install_location }}/public"
mastodon_redis_location: "{{ mastodon_install_location }}/redis"
mastodon_elastic_location: "{{ mastodon_install_location }}/elasticsearch"
mastodon_nginx_location: "{{ mastodon_install_location }}/nginx"
# The certresolver that is used by traefik for this domain
mastodon_traefik_certresolver: letsencrypt_http
# The domain that traefik will server mastodon under
mastodon_domain: mastodon.example.com
# The mastodon configuration (see mastodon documentation for a reference / the `templates/.env.production` file)
mastodon_config:
local_domain: "{{ mastodon_domain }}"
secret_key_base: undef
otp_secret: undef
vapid_private_key: undef
vapid_public_key: undef
smtp_server: localhost
smtp_login: undef
smtp_password: undef
smtp_from_address: mastodon@example.com
enable_elasticsearch: false
# Container versions
mastodon_version: 3.2.0
mastodon_database_version: 9.6
mastodon_redis_version: 5.0
mastodon_elasticsearch_version: 6.8.6
# Container tag definitions
mastodon_image_version: "v{{ mastodon_version }}"
mastodon_database_image_version: "{{ mastodon_database_version }}-alpine"
mastodon_redis_image_version: "{{ mastodon_redis_version }}-alpine"
mastodon_elasticsearch_image_version: "{{ mastodon_elasticsearch_version }}"

View file

@ -0,0 +1,17 @@
galaxy_info:
author: saibotk
description: Deploys a mastodon server via docker using traefik.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies:
- docker
- docker-compose
- traefik

View file

@ -0,0 +1,163 @@
---
# Tasks file for the mastodon role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Alexander Wellbrock
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Update default SELinux contexts
sefcontext:
target: '{{ item }}(/.*)?'
setype: "container_file_t"
state: present
with_items:
- "{{ mastodon_database_location }}"
- "{{ mastodon_public_location }}"
- "{{ mastodon_redis_location }}"
- "{{ mastodon_elastic_location }}"
- "{{ mastodon_nginx_location }}"
become: true
- name: Create install directory
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ mastodon_install_location }}"
become: true
- name: Create data directories
file:
path: "{{ item }}"
state: directory
setype: "container_file_t"
with_items:
- "{{ mastodon_database_location }}"
- "{{ mastodon_public_location }}"
- "{{ mastodon_redis_location }}"
- "{{ mastodon_elastic_location }}"
- "{{ mastodon_nginx_location }}"
become: true
- name: Create public data directory
file:
path: "{{ mastodon_public_location }}/system"
owner: "991"
group: "991"
state: directory
setype: "container_file_t"
become: true
- name: Deploy nginx proxy config file
template:
src: "default.conf"
dest: "{{ mastodon_nginx_location }}/default.conf"
mode: '0600'
owner: 'root'
group: 'root'
become: true
- name: Check if migration is needed
command: "grep -q 'tootsuite/mastodon:{{ mastodon_image_version }}' '{{ mastodon_install_location }}/docker-compose.yml'"
register: mastodon_version_fact
ignore_errors: yes
changed_when: mastodon_version_fact.rc > 0
failed_when: false
become: true
- name: Pull an mastodon image
docker_image:
name: "docker.io/tootsuite/mastodon:{{ mastodon_image_version }}"
source: pull
become: true
tags:
- docker
- mastodon
when:
- mastodon_version_fact is changed
- name: Stop mastodon for upgrade
docker_compose:
state: present
project_src: "{{ mastodon_install_location }}"
stopped: yes
tags:
- docker
- mastodon
become: true
when:
- mastodon_version_fact is changed
- name: Deploy config
template:
src: ".env.production"
dest: "{{ mastodon_install_location }}/.env.production"
mode: '0600'
owner: 'root'
group: 'root'
tags:
- mastodon
become: true
- name: Deploy docker-compose.yml
template:
src: "docker-compose.yml"
dest: "{{ mastodon_install_location }}/docker-compose.yml"
mode: '0600'
owner: 'root'
group: 'root'
validate: python2 -m compose -f %s config -q
tags:
- mastodon
become: true
- name: Migrate database
command: docker-compose run --rm web rails db:migrate
args:
chdir: "{{ mastodon_install_location }}"
when:
- mastodon_version_fact is changed
tags:
- docker
- mastodon
become: true
environment:
PYTHONPATH:
- name: Clear cache
command: docker-compose run --rm web bin/tootctl cache clear
args:
chdir: "{{ mastodon_install_location }}"
when:
- mastodon_version_fact is changed
tags:
- docker
- mastodon
become: true
environment:
PYTHONPATH:
- name: Compose mastodon
docker_compose:
state: present
project_src: "{{ mastodon_install_location }}"
pull: yes
remove_orphans: yes
tags:
- docker
- mastodon
become: true

View file

@ -0,0 +1,260 @@
{{ ansible_managed | comment }}
# Service dependencies
# You may set REDIS_URL instead for more advanced options
# You may also set REDIS_NAMESPACE to share Redis between multiple Mastodon servers
REDIS_HOST=redis
REDIS_PORT=6379
# You may set DATABASE_URL instead for more advanced options
DB_HOST=db
DB_USER=postgres
DB_NAME=postgres
DB_PASS=
DB_PORT=5432
{% if mastodon_config.enable_elasticsearch is defined %}
# Optional ElasticSearch configuration
# You may also set ES_PREFIX to share the same cluster between multiple Mastodon servers (falls back to REDIS_NAMESPACE if not set)
ES_ENABLED={{ mastodon_config.enable_elasticsearch }}
ES_HOST=es
ES_PORT=9200
{% endif %}
# Federation
# Note: Changing LOCAL_DOMAIN at a later time will cause unwanted side effects, including breaking all existing federation.
# LOCAL_DOMAIN should *NOT* contain the protocol part of the domain e.g https://example.com.
LOCAL_DOMAIN={{ mastodon_config.local_domain }}
# Changing LOCAL_HTTPS in production is no longer supported. (Mastodon will always serve https:// links)
{% if mastodon_config.web_domain is defined %}
# Use this only if you need to run mastodon on a different domain than the one used for federation.
# You can read more about this option on https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Serving_a_different_domain.md
# DO *NOT* USE THIS UNLESS YOU KNOW *EXACTLY* WHAT YOU ARE DOING.
WEB_DOMAIN={{ mastodon_config.web_domain }}
{% endif %}
# Use this if you want to have several aliases handler@example1.com
# handler@example2.com etc. for the same user. LOCAL_DOMAIN should not
# be added. Comma separated values
# ALTERNATE_DOMAINS=example1.com,example2.com
# Application secrets
# Generate each with the `RAILS_ENV=production bundle exec rake secret` task (`docker-compose run --rm web rake secret` if you use docker compose)
SECRET_KEY_BASE={{ mastodon_config.secret_key_base }}
OTP_SECRET={{ mastodon_config.otp_secret }}
# VAPID keys (used for push notifications
# You can generate the keys using the following command (first is the private key, second is the public one)
# You should only generate this once per instance. If you later decide to change it, all push subscription will
# be invalidated, requiring the users to access the website again to resubscribe.
#
# Generate with `RAILS_ENV=production bundle exec rake mastodon:webpush:generate_vapid_key` task (`docker-compose run --rm web rake mastodon:webpush:generate_vapid_key` if you use docker compose)
#
# For more information visit https://rossta.net/blog/using-the-web-push-api-with-vapid.html
VAPID_PRIVATE_KEY={{ mastodon_config.vapid_private_key }}
VAPID_PUBLIC_KEY={{ mastodon_config.vapid_public_key }}
# Registrations
{% if mastodon_config.single_user_mode is defined %}
# Single user mode will disable registrations and redirect frontpage to the first profile
SINGLE_USER_MODE={{ mastodon_config.single_user_mode }}
{% endif %}
# Prevent registrations with following e-mail domains
# EMAIL_DOMAIN_BLACKLIST=example1.com|example2.de|etc
# Only allow registrations with the following e-mail domains
# EMAIL_DOMAIN_WHITELIST=example1.com|example2.de|etc
# Optionally change default language
# DEFAULT_LOCALE=de
# E-mail configuration
# Note: Mailgun and SparkPost (https://sparkpo.st/smtp) each have good free tiers
# If you want to use an SMTP server without authentication (e.g local Postfix relay)
# then set SMTP_AUTH_METHOD and SMTP_OPENSSL_VERIFY_MODE to 'none' and
# *comment* SMTP_LOGIN and SMTP_PASSWORD (leaving them blank is not enough).
SMTP_SERVER={{ mastodon_config.smtp_server }}
SMTP_PORT={{ mastodon_config.smtp_port | default(587) }}
SMTP_LOGIN={{ mastodon_config.smtp_login }}
SMTP_PASSWORD={{ mastodon_config.smtp_password }}
SMTP_FROM_ADDRESS={{ mastodon_config.smtp_from_address }}
#SMTP_REPLY_TO=
#SMTP_DOMAIN= # defaults to LOCAL_DOMAIN
#SMTP_DELIVERY_METHOD=smtp # delivery method can also be sendmail
#SMTP_AUTH_METHOD=plain
#SMTP_CA_FILE=/etc/ssl/certs/ca-certificates.crt
#SMTP_OPENSSL_VERIFY_MODE=peer
#SMTP_ENABLE_STARTTLS_AUTO=true
#SMTP_TLS=true
# Optional user upload path and URL (images, avatars). Default is :rails_root/public/system. If you set this variable, you are responsible for making your HTTP server (eg. nginx) serve these files.
# PAPERCLIP_ROOT_PATH=/var/lib/mastodon/public-system
# PAPERCLIP_ROOT_URL=/system
# Optional asset host for multi-server setups
# The asset host must allow cross origin request from WEB_DOMAIN or LOCAL_DOMAIN
# if WEB_DOMAIN is not set. For example, the server may have the
# following header field:
# Access-Control-Allow-Origin: https://example.com/
# CDN_HOST=https://assets.example.com
# S3 (optional)
# The attachment host must allow cross origin request from WEB_DOMAIN or
# LOCAL_DOMAIN if WEB_DOMAIN is not set. For example, the server may have the
# following header field:
# Access-Control-Allow-Origin: https://192.168.1.123:9000/
# S3_ENABLED=true
# S3_BUCKET=
# AWS_ACCESS_KEY_ID=
# AWS_SECRET_ACCESS_KEY=
# S3_REGION=
# S3_PROTOCOL=http
# S3_HOSTNAME=192.168.1.123:9000
# S3 (Minio Config (optional) Please check Minio instance for details)
# The attachment host must allow cross origin request - see the description
# above.
# S3_ENABLED=true
# S3_BUCKET=
# AWS_ACCESS_KEY_ID=
# AWS_SECRET_ACCESS_KEY=
# S3_REGION=
# S3_PROTOCOL=https
# S3_HOSTNAME=
# S3_ENDPOINT=
# S3_SIGNATURE_VERSION=
# Google Cloud Storage (optional)
# Use S3 compatible API. Since GCS does not support Multipart Upload,
# increase the value of S3_MULTIPART_THRESHOLD to disable Multipart Upload.
# The attachment host must allow cross origin request - see the description
# above.
# S3_ENABLED=true
# AWS_ACCESS_KEY_ID=
# AWS_SECRET_ACCESS_KEY=
# S3_REGION=
# S3_PROTOCOL=https
# S3_HOSTNAME=storage.googleapis.com
# S3_ENDPOINT=https://storage.googleapis.com
# S3_MULTIPART_THRESHOLD=52428801 # 50.megabytes
# Swift (optional)
# The attachment host must allow cross origin request - see the description
# above.
# SWIFT_ENABLED=true
# SWIFT_USERNAME=
# For Keystone V3, the value for SWIFT_TENANT should be the project name
# SWIFT_TENANT=
# SWIFT_PASSWORD=
# Some OpenStack V3 providers require PROJECT_ID (optional)
# SWIFT_PROJECT_ID=
# Keystone V2 and V3 URLs are supported. Use a V3 URL if possible to avoid
# issues with token rate-limiting during high load.
# SWIFT_AUTH_URL=
# SWIFT_CONTAINER=
# SWIFT_OBJECT_URL=
# SWIFT_REGION=
# Defaults to 'default'
# SWIFT_DOMAIN_NAME=
# Defaults to 60 seconds. Set to 0 to disable
# SWIFT_CACHE_TTL=
# Optional alias for S3 (e.g. to serve files on a custom domain, possibly using Cloudfront or Cloudflare)
# S3_ALIAS_HOST=
# Streaming API integration
# STREAMING_API_BASE_URL=
# Advanced settings
# If you need to use pgBouncer, you need to disable prepared statements:
# PREPARED_STATEMENTS=false
# Cluster number setting for streaming API server.
# If you comment out following line, cluster number will be `numOfCpuCores - 1`.
STREAMING_CLUSTER_NUM=1
# Docker mastodon user
# If you use Docker, you may want to assign UID/GID manually.
{% if mastodon_config.docker_uid is defined %}
UID={{ mastodon_config.docker_uid }}
{% endif %}
{% if mastodon_config.docker_gid is defined %}
GID={{ mastodon_config.docker_gid }}
{% endif %}
# LDAP authentication (optional)
# LDAP_ENABLED=true
# LDAP_HOST=localhost
# LDAP_PORT=389
# LDAP_METHOD=simple_tls
# LDAP_BASE=
# LDAP_BIND_DN=
# LDAP_PASSWORD=
# LDAP_UID=cn
# LDAP_SEARCH_FILTER=%{uid}=%{email}
# PAM authentication (optional)
# PAM authentication uses for the email generation the "email" pam variable
# and optional as fallback PAM_DEFAULT_SUFFIX
# The pam environment variable "email" is provided by:
# https://github.com/devkral/pam_email_extractor
# PAM_ENABLED=true
# Fallback email domain for email address generation (LOCAL_DOMAIN by default)
# PAM_EMAIL_DOMAIN=example.com
# Name of the pam service (pam "auth" section is evaluated)
# PAM_DEFAULT_SERVICE=rpam
# Name of the pam service used for checking if an user can register (pam "account" section is evaluated) (nil (disabled) by default)
# PAM_CONTROLLED_SERVICE=rpam
# Global OAuth settings (optional) :
# If you have only one strategy, you may want to enable this
# OAUTH_REDIRECT_AT_SIGN_IN=true
# Optional CAS authentication (cf. omniauth-cas) :
# CAS_ENABLED=true
# CAS_URL=https://sso.myserver.com/
# CAS_HOST=sso.myserver.com/
# CAS_PORT=443
# CAS_SSL=true
# CAS_VALIDATE_URL=
# CAS_CALLBACK_URL=
# CAS_LOGOUT_URL=
# CAS_LOGIN_URL=
# CAS_UID_FIELD='user'
# CAS_CA_PATH=
# CAS_DISABLE_SSL_VERIFICATION=false
# CAS_UID_KEY='user'
# CAS_NAME_KEY='name'
# CAS_EMAIL_KEY='email'
# CAS_NICKNAME_KEY='nickname'
# CAS_FIRST_NAME_KEY='firstname'
# CAS_LAST_NAME_KEY='lastname'
# CAS_LOCATION_KEY='location'
# CAS_IMAGE_KEY='image'
# CAS_PHONE_KEY='phone'
# Optional SAML authentication (cf. omniauth-saml)
#SAML_ENABLED=true
#SAML_ACS_URL=https://flausch.social/auth/auth/saml/callback
#SAML_ISSUER=mastodon
#SAML_IDP_SSO_TARGET_URL=https://auth.the-rainbow-unicorns.de/auth/realms/unicorns/protocol/saml/clients/mastodon
#SAML_IDP_CERT=
#SAML_IDP_CERT_FINGERPRINT=
#SAML_NAME_IDENTIFIER_FORMAT=urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
#SAML_CERT=
#SAML_PRIVATE_KEY=
#SAML_SECURITY_WANT_ASSERTION_SIGNED=true
#SAML_SECURITY_WANT_ASSERTION_ENCRYPTED=true
#SAML_SECURITY_ASSUME_EMAIL_IS_VERIFIED=true
#SAML_ATTRIBUTES_STATEMENTS_UID=name
#SAML_ATTRIBUTES_STATEMENTS_EMAIL=email
#SAML_ATTRIBUTES_STATEMENTS_FULL_NAME="urn:oid:2.16.840.1.113730.3.1.241"
#SAML_ATTRIBUTES_STATEMENTS_FIRST_NAME="urn:oid:2.5.4.42"
#SAML_ATTRIBUTES_STATEMENTS_LAST_NAME="urn:oid:2.5.4.4"
#SAML_UID_ATTRIBUTE=name
#SAML_ATTRIBUTES_STATEMENTS_VERIFIED=
#SAML_ATTRIBUTES_STATEMENTS_VERIFIED_EMAIL=
# Use HTTP proxy for outgoing request (optional)
# http_proxy=http://gateway.local:8118
# Access control for hidden service.
# ALLOW_ACCESS_TO_HIDDEN_SERVICE=true

View file

@ -0,0 +1,91 @@
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=CACHE:10m inactive=7d max_size=1g;
server {
listen 80;
listen [::]:80;
server_name {{ mastodon_domain }};
set_real_ip_from 10.0.0.0/8;
set_real_ip_from 172.16.0.0/12;
keepalive_timeout 70;
sendfile on;
client_max_body_size 80m;
root /usr/share/nginx/html/;
access_log off;
#error_log off;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
add_header Strict-Transport-Security "max-age=31536000";
location / {
try_files $uri @proxy;
}
location ~ ^/(emoji|packs|system/accounts/avatars|system/media_attachments/files) {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri @proxy;
}
location /sw.js {
add_header Cache-Control "public, max-age=0";
try_files $uri @proxy;
}
location @proxy {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Proxy "";
proxy_pass_header Server;
proxy_pass http://web:3000;
proxy_buffering on;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_cache CACHE;
proxy_cache_valid 200 7d;
proxy_cache_valid 410 24h;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
add_header X-Cached $upstream_cache_status;
tcp_nodelay on;
}
location /api/v1/streaming {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Proxy "";
proxy_pass http://streaming:4000;
proxy_buffering off;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
tcp_nodelay on;
}
error_page 500 501 502 503 504 /500.html;
}

View file

@ -0,0 +1,147 @@
{{ ansible_managed | comment }}
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
version: '2'
services:
nginx:
image: docker.io/library/nginx:alpine
mem_limit: 32mb
memswap_limit: 64mb
labels:
- "traefik.http.routers.mastodon.rule=Host(`{{ mastodon_domain }}`) && PathPrefix(`/`)"
- "traefik.http.routers.mastodon.entrypoints=websecure"
- "traefik.http.routers.mastodon.tls.certresolver={{ mastodon_traefik_certresolver }}"
- "traefik.http.routers.mastodon.middlewares=mastodon,compress"
- "traefik.http.middlewares.mastodon.headers.sslredirect=true"
- "traefik.http.middlewares.mastodon.headers.stsSeconds=63072000"
- "traefik.http.middlewares.mastodon.headers.referrerPolicy=same-origin"
- "traefik.enable=true"
{% if proxy_network is defined %}
- "traefik.docker.network={{ proxy_network }}"
{% endif %}
networks:
frontend:
{% if proxy_network is defined %}
{{ proxy_network }}:
{% endif %}
volumes:
- "{{ mastodon_nginx_location }}/default.conf:/etc/nginx/conf.d/default.conf:ro"
- "{{ mastodon_public_location }}:/usr/share/nginx/html:ro"
depends_on:
- web
- streaming
restart: always
db:
image: docker.io/library/postgres:{{ mastodon_database_image_version }}
mem_limit: 512mb
memswap_limit: 768mb
read_only: true
tmpfs:
- /run/postgresql:size=512K
- /tmp:size=128K
stop_grace_period: 2m
stop_signal: SIGINT
networks:
backend:
volumes:
- {{ mastodon_database_location }}:/var/lib/postgresql/data
restart: always
redis:
image: docker.io/library/redis:{{ mastodon_redis_image_version }}
mem_limit: 512mb
memswap_limit: 768mb
networks:
backend:
volumes:
- {{ mastodon_redis_location }}:/data
restart: always
{% if mastodon_config.enable_elasticsearch is defined and mastodon_config.enable_elasticsearch %}
es:
restart: always
image: docker.elastic.co/elasticsearch/elasticsearch-oss:{{ mastodon_elasticsearch_image_version }}
mem_limit: 724mb
memswap_limit: 780mb
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
networks:
backend:
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
volumes:
- {{ mastodon_elastic_location }}:/usr/share/elasticsearch/data
{% endif %}
web:
image: docker.io/tootsuite/mastodon:{{ mastodon_image_version }}
mem_limit: 1024mb
memswap_limit: 1280mb
env_file: {{ mastodon_install_location }}/.env.production
depends_on:
- db
- redis
volumes:
- {{ mastodon_public_location }}/system:/mastodon/public/system
networks:
frontend:
backend:
restart: always
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000 -b '0.0.0.0'"
streaming:
image: docker.io/tootsuite/mastodon:{{ mastodon_image_version }}
mem_limit: 1024mb
memswap_limit: 1280mb
env_file: {{ mastodon_install_location }}/.env.production
networks:
frontend:
backend:
depends_on:
- db
- redis
restart: always
command: yarn start
sidekiq:
image: docker.io/tootsuite/mastodon:{{ mastodon_image_version }}
mem_limit: 1024mb
memswap_limit: 1280mb
env_file: {{ mastodon_install_location }}/.env.production
depends_on:
- db
- redis
volumes:
- {{ mastodon_public_location }}/system:/mastodon/public/system
networks:
frontend:
backend:
restart: always
command: bundle exec sidekiq
networks:
frontend:
backend:
internal: true
{% if proxy_network is defined %}
{{ proxy_network }}:
external: true
{% endif %}

View file

@ -0,0 +1,37 @@
Minecraft-Blockmap
=========
This will setup a Blockmap render job using the Blockmap container and automatically render the provided Minecraft world. The render result then is made available with an nginx container and traefik.
Requirements
------------
You will need to have docker, docker-compose and traefik installed or declared as dependencies with their respective roles.
Also currently the container expects you to use LVM with enough space for a snapshot.
**This role assumes that you have setup traefik with an endpoint called `websecure`.**
Role Variables
--------------
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
### Global variables, that are used:
- `proxy_network`: Defined by the local traefik installation, this is the shared proxy network used by traefik to reach the containers. (optional)
- `proxy_hiddenservice`: Defined by the local traefik installation, this is used to generate the alt-svc header for the alternative Tor domain. (optional)
Dependencies
------------
- docker
- docker-compose
- traefik
License
-------
GPL-3.0-only

View file

@ -0,0 +1,57 @@
---
# Default variables for the minecraft-blockmap role
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The install locations
minecraft_blockmap_install_location: "/srv/minecraft-blockmap"
minecraft_blockmap_config_location: "{{ minecraft_blockmap_install_location }}/config"
minecraft_blockmap_output_location: "{{ minecraft_blockmap_install_location }}/output"
minecraft_blockmap_archive_location: "{{ minecraft_blockmap_install_location }}/archive"
# The certresolver for traefik to use on this domain
minecraft_blockmap_certresolver: letsencrypt_http
# The domain under which the render result is made available using nginx and traefik
minecraft_blockmap_domain: minecraft.example.com
# The blockmap container image and version to use
minecraft_blockmap_image: registry.git.saibotk.de/saibotk/blockmap-docker
minecraft_blockmap_image_version: "latest"
# The LVM information, which volume needs to be snapshotted, to render the world.
# This is the volume in which the minecraft server/world folder is in.
minecraft_blockmap_vg_name:
minecraft_blockmap_lv_name:
# Enable the systemd timer? This will enable automatic rendering every 20 minutes
minecraft_blockmap_timer_enabled: true
minecraft_blockmap_timer_state: 'started'
# The input location, where the world resides in, that should be rendered.
# ! NOTE: This is relative to the lvm volume root (eg. a volume covering `/srv` will result in an input path `/minecraft/data/WORLDNAME` if a minecraft server is installed under /srv/minecraft)
# minecraft_blockmap_input_location: "/YOUR/PATH/TO/MC_WORLD"
# Additional parameters, that should be passed to the blockmap-cli
minecraft_blockmap_parameters: ""
# The blockmap render config
blockmap_config_server:
name: "Minecraft"
description: "Flauschparadies"
address: "localhost"
max_players: 5

View file

@ -0,0 +1,17 @@
galaxy_info:
author: saibotk
description: Deploys a minecraft-blockmap renderer and makes the result available using nginx and traefik.
license: GPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: CentOS
versions:
- 7
galaxy_tags: []
dependencies:
- docker
- docker-compose
- traefik

View file

@ -0,0 +1,142 @@
---
# Tasks file for the minecraft-blockmap roles
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2020 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- name: Update default SELinux contexts
sefcontext:
target: '{{ item }}(/.*)?'
setype: "container_file_t"
state: present
with_items:
- "{{ minecraft_blockmap_output_location }}"
- "{{ minecraft_blockmap_config_location }}"
become: true
- name: Create install directory
file:
path: "{{ item }}"
state: directory
mode: '0600'
with_items:
- "{{ minecraft_blockmap_install_location }}"
become: true
tags:
- blockmap
- name: Create data directories
file:
path: "{{ item }}"
state: directory
setype: "container_file_t"
with_items:
- "{{ minecraft_blockmap_output_location }}"
- "{{ minecraft_blockmap_config_location }}"
become: true
tags:
- blockmap
- name: Create archive directory
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ minecraft_blockmap_archive_location }}"
become: true
tags:
- blockmap
- name: Deploy nginx config file
template:
src: "default.conf"
dest: "{{ minecraft_blockmap_install_location }}/default.conf"
mode: '0600'
owner: 'root'
group: 'root'
become: true
- name: Deploy blockmap config
template:
src: "blockmap.json"
dest: "{{ minecraft_blockmap_config_location }}/blockmap.json"
mode: '0600'
owner: 'root'
group: 'root'
setype: "container_file_t"
become: true
- name: Deploy docker-compose.yml
template:
src: docker-compose.yml
dest: "{{ minecraft_blockmap_install_location }}/docker-compose.yml"
mode: '0600'
owner: 'root'
group: 'root'
validate: python2 -m compose -f %s config -q
tags:
- docker
- blockmap
become: true
- name: Create lvm mount directories
file:
path: "/blockmap_snapshot"
state: directory
recurse: true
become: true
- name: Install render script
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: '1700'
owner: root
group: root
with_items:
- src: "render.sh"
dest: "{{ minecraft_blockmap_install_location }}/render.sh"
become: true
- name: Install render service & timer
template:
src: "{{ item }}"
dest: /etc/systemd/system/
mode: '0755'
owner: root
group: root
with_items:
- "blockmap-render.service"
- "blockmap-render.timer"
become: true
- name: Start & enable render service timer
systemd:
daemon_reload: yes
name: blockmap-render.timer
enabled: '{{ minecraft_blockmap_timer_enabled | bool }}'
state: '{{ minecraft_blockmap_timer_state }}'
become: true
- name: Compose minecraft-blockmap
docker_compose:
state: present
project_src: "{{ minecraft_blockmap_install_location }}"
pull: yes
remove_orphans: yes
tags:
- blockmap
become: true

Some files were not shown because too many files have changed in this diff Show more