opendev: Remove content and leave an URL to the GitHub repository
Change-Id: Ib029323d2c040faec555202ad3e243a8408c360a
This commit is contained in:
parent
fcf1e06e26
commit
bd1f382f26
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
# ansible-galaxy collection build generates .tar.gz files
|
||||
*.tar.gz
|
674
LICENSE
674
LICENSE
@ -1,674 +0,0 @@
|
||||
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:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
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>.
|
68
README.md
68
README.md
@ -1,68 +0,0 @@
|
||||
# ara-collection
|
||||
|
||||
Opinionated collection of Ansible roles available on [Ansible Galaxy](https://galaxy.ansible.com/recordsansible/ara)
|
||||
for deploying and configuring [ARA Records Ansible](https://github.com/ansible-community/ara).
|
||||
|
||||
ARA Records Ansible and makes it easier to understand and troubleshoot.
|
||||
|
||||
![ara](https://raw.githubusercontent.com/ansible-community/ara-collection/master/doc/source/_static/ara-with-icon.png)
|
||||
|
||||
## ara_api
|
||||
|
||||
![ara_api](https://raw.githubusercontent.com/ansible-community/ara-collection/master/doc/source/_static/ansible-role-ara-api.png)
|
||||
|
||||
A role to install and run the ARA API server and built-in reporting interface
|
||||
in various supported configurations.
|
||||
|
||||
Documentation: [roles/ara_api/README.md](https://github.com/ansible-community/ara-collection/blob/master/roles/ara_api/README.md)
|
||||
|
||||
## ara_web
|
||||
|
||||
![ara_web](doc/source/_static/ansible-role-ara-web.png)
|
||||
|
||||
Documentation: [roles/ara_web/README.md](https://github.com/ansible-community/ara-collection/blob/master/roles/ara_web/README.md)
|
||||
|
||||
## ara_frontend_nginx
|
||||
|
||||
A role that sets up a basic nginx reverse proxy for serving the API server as
|
||||
well as ara-web.
|
||||
|
||||
Documentation: [roles/ara_frontend_nginx/README.md](https://github.com/ansible-community/ara-collection/blob/master/roles/ara_frontend_nginx/README.md)
|
||||
|
||||
# Community and getting help
|
||||
|
||||
- Bugs, issues and enhancements: https://github.com/ansible-community/ara-collection/issues
|
||||
- IRC: #ara on [Freenode](https://webchat.freenode.net/?channels=#ara)
|
||||
- Slack: https://arecordsansible.slack.com ([invitation link](https://join.slack.com/t/arecordsansible/shared_invite/enQtMjMxNzI4ODAxMDQxLTU2NTU3YjMwYzRlYmRkZTVjZTFiOWIxNjE5NGRhMDQ3ZTgzZmQyZTY2NzY5YmZmNDA5ZWY4YTY1Y2Y1ODBmNzc))
|
||||
|
||||
- Website and blog: https://ara.recordsansible.org
|
||||
- Twitter: https://twitter.com/recordsansible
|
||||
|
||||
# Contributing
|
||||
|
||||
Contributions to the project are welcome and appreciated !
|
||||
|
||||
Get started with the [contributor's documentation](https://ara.readthedocs.io/en/latest/contributing.html).
|
||||
|
||||
# Authors
|
||||
|
||||
Contributors to the project can be viewed on [GitHub](https://github.com/ansible-community/ara-collection/graphs/contributors).
|
||||
|
||||
# Copyright
|
||||
|
||||
```
|
||||
Copyright (c) 2020 The ARA Records Ansible authors
|
||||
|
||||
ARA Records Ansible 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.
|
||||
|
||||
ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
```
|
5
README.rst
Normal file
5
README.rst
Normal file
@ -0,0 +1,5 @@
|
||||
This project has been moved
|
||||
---------------------------
|
||||
|
||||
This project's code and code review is now on GitHub: https://github.com/ansible-community/ara-collection
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB |
Binary file not shown.
Before Width: | Height: | Size: 34 KiB |
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
13
galaxy.yml
13
galaxy.yml
@ -1,13 +0,0 @@
|
||||
namespace: recordsansible
|
||||
name: ara
|
||||
version: 0.0.4
|
||||
readme: README.md
|
||||
authors:
|
||||
- ARA Records Ansible (https://github.com/ansible-community/ara)
|
||||
description: null
|
||||
license_file: LICENSE
|
||||
tags: null
|
||||
repository: https://github.com/ansible-community/ara-collection
|
||||
documentation: https://github.com/ansible-community/ara-collection
|
||||
homepage: https://ara.recordsansible.org
|
||||
issues: https://github.com/ansible-community/ara-collection/issues
|
@ -1,90 +0,0 @@
|
||||
# Ansible role: ara_api
|
||||
|
||||
![ara_api](https://raw.githubusercontent.com/ansible-community/ara-collection/master/doc/source/_static/ansible-role-ara-api.png)
|
||||
|
||||
This Ansible role provides a framework for installing one or many instances of the
|
||||
[ARA](https://github.com/ansible-community/ara) API Server in a variety of
|
||||
opinionated deployment topologies.
|
||||
|
||||
It is currently tested and supported against Ubuntu 18.04, Fedora 30 and CentOS 8.
|
||||
|
||||
## Role Variables
|
||||
|
||||
See [defaults/main.yaml](https://github.com/ansible-community/ara-collection/blob/master/roles/ara_api/defaults/main.yaml).
|
||||
|
||||
## TL;DR
|
||||
|
||||
Playbook that runs the role with defaults:
|
||||
|
||||
```yaml
|
||||
- name: Install ARA with default settings and no persistent API server
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
roles:
|
||||
- ara_api
|
||||
```
|
||||
|
||||
What the role ends up doing by default:
|
||||
|
||||
- Installs required packages (``git``, ``virtualenv``, etc.) if superuser privileges are available
|
||||
- Stores everything in the home directory of the user in ``~/.ara``
|
||||
- Retrieves ARA from source
|
||||
- Installs ARA in a virtualenv
|
||||
- Generates a random secret key if none are already configured or provided
|
||||
- Sets up API configuration in ``~/.ara/server/settings.yaml``
|
||||
- Runs the API SQL migrations (``ara-manage migrate``)
|
||||
|
||||
## About deployment topologies
|
||||
|
||||
This Ansible role is designed to support different opinionated topologies that
|
||||
can be selected with role variables.
|
||||
|
||||
For example, the following role variables are used to provide the topology from
|
||||
the ``TL;DR`` above:
|
||||
|
||||
- ``ara_api_install_method: source``
|
||||
- ``ara_api_wsgi_server: null``
|
||||
- ``ara_api_database_engine: django.db.backends.sqlite3``
|
||||
- ``ara_api_web_server: null``
|
||||
|
||||
The intent is that as the role gains support for other install methods,
|
||||
wsgi servers, database engines or web servers, it will be possible to
|
||||
mix and match according to preference or requirements.
|
||||
|
||||
Perhaps ARA could be installed from pypi and run with gunicorn, nginx and mysql.
|
||||
Or maybe it could be installed from distribution packages and set up to run
|
||||
with apache, mod_wsgi and postgresql.
|
||||
Or any combination of any of those.
|
||||
|
||||
## Example playbooks
|
||||
|
||||
Install ARA and set up the API to be served by a persistent gunicorn service:
|
||||
|
||||
```yaml
|
||||
- name: Install ARA and set up the API to be served by gunicorn
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
vars:
|
||||
ara_api_wsgi_server: gunicorn
|
||||
roles:
|
||||
- ara_api
|
||||
```
|
||||
|
||||
Install ARA and set up the API to be served by nginx in front of gunicorn:
|
||||
|
||||
```yaml
|
||||
# Requires superuser privileges to set up nginx and the ara-api service
|
||||
# The API will be reachable at http://api.ara.example.org
|
||||
- name: Install ARA and set up the API to be served by nginx in front of gunicorn
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
vars:
|
||||
ara_api_frontend_server: nginx
|
||||
ara_api_wsgi_server: gunicorn
|
||||
ara_api_fqdn: api.ara.example.org
|
||||
ara_api_allowed_hosts:
|
||||
- api.ara.example.org
|
||||
ara_api_frontend_vhost: custom_vhost.conf.j2
|
||||
roles:
|
||||
- ara_api
|
||||
```
|
@ -1,219 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# By default, tasks in this role that could result in configuration or
|
||||
# credentials being printed by Ansible are set up to hide the output to prevent
|
||||
# sensitive information from being exposed.
|
||||
# Setting ara_api_secure_logging to false will make Ansible print the raw,
|
||||
# unfiltered result of these tasks.
|
||||
# Note that it does not have any impact on tasks that are recorded by ARA.
|
||||
# It is only for the output when running this specific role.
|
||||
ara_api_secure_logging: true
|
||||
|
||||
# Root directory where every file for the ARA installation are located
|
||||
ara_api_root_dir: "{{ ansible_user_dir }}/.ara"
|
||||
|
||||
# Directory where logs are written to
|
||||
ara_api_log_dir: "{{ ara_api_root_dir }}/logs"
|
||||
|
||||
# Whether or not ara should be installed in a virtual environment.
|
||||
# This defaults to true to prevent conflicting with system or distribution
|
||||
# python packages.
|
||||
ara_api_venv: true
|
||||
|
||||
# When using a virtualenv, path to where it will be installed
|
||||
ara_api_venv_path: "{{ ara_api_root_dir }}/virtualenv"
|
||||
|
||||
# How ARA will be installed
|
||||
# - source [default]: installs from a local or remote git repository
|
||||
# - distribution: installs from distribution packages, if available
|
||||
# - pypi [planned]: installs from pypi
|
||||
ara_api_install_method: source
|
||||
|
||||
# When installing from source, the URL or filesystem path where the git source
|
||||
# repository can be cloned from.
|
||||
ara_api_source: "https://opendev.org/recordsansible/ara"
|
||||
|
||||
# When installing from source, location where the source repository will be checked out to.
|
||||
ara_api_source_checkout: "{{ ara_api_root_dir }}/git/ara"
|
||||
|
||||
# Version of ARA to install
|
||||
# When installing from source, this can be a git ref (tag, branch, commit, etc)
|
||||
# When installing from PyPi, it would be a version number that has been released.
|
||||
# When using "latest" as the source version, HEAD will be used
|
||||
# When using "latest" as the pypi version, the latest release will be used
|
||||
ara_api_version: master
|
||||
|
||||
# The frontend/web server for serving the ARA API
|
||||
# It is recommended to specify a web server when deploying a production environment.
|
||||
# - null [default]: No frontend server will be set up.
|
||||
# - nginx: Nginx will be configured in front of the WSGI application server.
|
||||
# - apache [planned]
|
||||
ara_api_frontend_server: null
|
||||
|
||||
# Path to a custom vhost configuration jinja template
|
||||
# The vhost configuration templates provided by the role are simple by design
|
||||
# and are not sufficient to cover every use cases.
|
||||
# Use this variable if you need to have your own custom nginx or apache configuration.
|
||||
ara_api_frontend_vhost: null
|
||||
|
||||
# The WSGI server for running ARA's API server
|
||||
# - null [default]: No persistent WSGI application server will be set up. Only the offline API client will work.
|
||||
# - gunicorn: gunicorn will be installed and set up to run the API as a systemd service.
|
||||
# - mod_wsgi [planned]
|
||||
ara_api_wsgi_server: null
|
||||
|
||||
# Address and port on which the wsgi server will bind
|
||||
# Changing this value means you might need to adjust "ara_api_allowed_hosts" and
|
||||
# "ara_api_cors_origin_whitelist".
|
||||
ara_api_wsgi_bind: "127.0.0.1:8000"
|
||||
|
||||
# Amount of worker processes for the wsgi server
|
||||
# Recommended default formula by gunicorn: https://docs.gunicorn.org/en/stable/design.html#how-many-workers
|
||||
ara_api_wsgi_workers: "{{ ansible_processor_count * ansible_processor_cores * ansible_processor_threads_per_core * 2 + 1 }}"
|
||||
|
||||
# When using a frontend server, the domain or address it will be listening on
|
||||
ara_api_fqdn: "{{ ansible_default_ipv4['address'] | default(ansible_default_ipv6['address']) }}"
|
||||
|
||||
####################################
|
||||
# ara API configuration settings
|
||||
# For more information, see documentation: https://ara.readthedocs.io
|
||||
####################################
|
||||
|
||||
# ARA_BASE_DIR - Default directory for storing data and configuration
|
||||
ara_api_base_dir: "{{ ara_api_root_dir }}/server"
|
||||
|
||||
# ARA_SETTINGS - Path to an ARA API configuration file
|
||||
ara_api_settings: "{{ ara_api_base_dir }}/settings.yaml"
|
||||
|
||||
# ARA_ENV - Environment to load configuration for
|
||||
ara_api_env: default
|
||||
|
||||
# ARA_READ_LOGIN_REQUIRED - Whether authentication is required for reading data
|
||||
ara_api_read_login_required: false
|
||||
|
||||
# ARA_WRITE_LOGIN_REQUIRED - Whether authentication is required for writing data
|
||||
ara_api_write_login_required: false
|
||||
|
||||
# ARA_PAGE_SIZE - Amount of results returned per page by the API
|
||||
ara_api_page_size: 100
|
||||
|
||||
# ARA_LOG_LEVEL - Log level of the different components
|
||||
ara_api_log_level: INFO
|
||||
|
||||
# ARA_LOGGING - Python logging configuration
|
||||
ara_api_logging:
|
||||
disable_existing_loggers: false
|
||||
formatters:
|
||||
normal:
|
||||
format: '%(asctime)s %(levelname)s %(name)s: %(message)s'
|
||||
handlers:
|
||||
console:
|
||||
class: logging.handlers.TimedRotatingFileHandler
|
||||
formatter: normal
|
||||
level: "{{ ara_api_log_level }}"
|
||||
filename: "{{ ara_api_log_dir }}/server.log"
|
||||
when: 'midnight'
|
||||
interval: 1
|
||||
backupCount: 30
|
||||
loggers:
|
||||
ara:
|
||||
handlers:
|
||||
- console
|
||||
level: "{{ ara_api_log_level }}"
|
||||
propagate: 0
|
||||
root:
|
||||
handlers:
|
||||
- console
|
||||
level: "{{ ara_api_log_level }}"
|
||||
version: 1
|
||||
|
||||
# ARA_CORS_ORIGIN_ALLOW_ALL - django-cors-headers’s CORS_ORIGIN_WHITELIST_ALLOW_ALL setting
|
||||
ara_api_cors_origin_allow_all: false
|
||||
|
||||
# ARA_CORS_ORIGIN_WHITELIST - django-cors-headers’s CORS_ORIGIN_WHITELIST setting
|
||||
ara_api_cors_origin_whitelist:
|
||||
- "http://127.0.0.1:8000"
|
||||
- "http://localhost:3000"
|
||||
|
||||
# ARA_CORS_ORIGIN_REGEX_WHITELIST - django-cors-headers’s CORS_ORIGIN_REGEX_WHITELIST setting
|
||||
ara_api_cors_origin_regex_whitelist: []
|
||||
|
||||
# ARA_SERVER_ALLOWED_HOSTS - Django’s ALLOWED_HOSTS setting
|
||||
ara_api_allowed_hosts:
|
||||
- "127.0.0.1"
|
||||
- "localhost"
|
||||
- "::1"
|
||||
- "{{ ara_api_fqdn }}"
|
||||
|
||||
# ARA_DEBUG - Django's DEBUG setting
|
||||
# It is not recommended to run with debug enabled in production.
|
||||
ara_api_debug: false
|
||||
|
||||
# ARA_SECRET_KEY - Django's SECRET_KEY setting
|
||||
# Note: If no key is provided, a random one will be generated once and persisted
|
||||
ara_api_secret_key: null
|
||||
|
||||
# ARA_DISTRIBUTED_SQLITE - Whether to enable distributed sqlite backend
|
||||
ara_api_distributed_sqlite: false
|
||||
|
||||
# ARA_DISTRIBUTED_SQLITE_PREFIX - Prefix to delegate to the distributed sqlite backend
|
||||
ara_api_distributed_sqlite_prefix: ara-report
|
||||
|
||||
# ARA_DISTRIBUTED_SQLITE_ROOT - Root under which sqlite databases are expected
|
||||
ara_api_distributed_sqlite_root: /var/www/logs
|
||||
|
||||
# ARA_DATABASE_ENGINE - Django’s ENGINE database setting
|
||||
ara_api_database_engine: "{{ ara_api_distributed_sqlite | ternary('ara.server.db.backends.distributed_sqlite', 'django.db.backends.sqlite3') }}"
|
||||
|
||||
# ARA_DATABASE_NAME - Django’s NAME database setting
|
||||
ara_api_database_name: "{{ ara_api_base_dir }}/ansible.sqlite"
|
||||
|
||||
# ARA_DATABASE_USER - Django’s USER database setting
|
||||
ara_api_database_user: null
|
||||
|
||||
# ARA_DATABASE_PASSWORD - Django’s PASSWORD database setting
|
||||
ara_api_database_password: null
|
||||
|
||||
# ARA_DATABASE_HOST - Django’s HOST database setting
|
||||
ara_api_database_host: null
|
||||
|
||||
# ARA_DATABASE_PORT - Django’s PORT database setting
|
||||
ara_api_database_port: null
|
||||
|
||||
# ARA_DATABASE_CONN_MAX_AGE - Django's CONN_MAX_AGE database setting
|
||||
ara_api_database_conn_max_age: 0
|
||||
|
||||
# ARA_TIME_ZONE - Time zone used when storing and returning results
|
||||
# Note: the default provided by ARA is dynamic and is set to the local system
|
||||
# timezone but Ansible doesn't provide, for example, an ansible_timezone fact
|
||||
# that we could use here. With that in mind, UTC is the best default for now.
|
||||
ara_api_time_zone: UTC
|
||||
|
||||
# ARA cleanup settings
|
||||
# The following settings configure daily maintenance cronjobs
|
||||
ara_api_configure_cron: false
|
||||
|
||||
# When configuring cronjobs, only provide the arguments for the ara CLI utility
|
||||
ara_api_cleanup_crons:
|
||||
- name: ara_api expire running playbooks
|
||||
arguments: 'expire --server http://localhost:8000 --client http --confirm --hours 24'
|
||||
special_time: 'daily' # you can also use other time arguments from the cron module
|
||||
- name: ara_api prune old reports
|
||||
arguments: 'playbook prune --server http://localhost:8000 --client http --confirm --days 30'
|
||||
special_time: 'daily'
|
@ -1,15 +0,0 @@
|
||||
module ara-gunicorn 1.0;
|
||||
|
||||
require {
|
||||
type init_t;
|
||||
type user_home_t;
|
||||
class file { create execute execute_no_trans ioctl lock map open read write };
|
||||
class lnk_file { getattr read };
|
||||
}
|
||||
|
||||
#============= init_t ==============
|
||||
|
||||
#!!!! This avc can be allowed using the boolean 'domain_can_mmap_files'
|
||||
allow init_t user_home_t:file map;
|
||||
allow init_t user_home_t:file { create execute execute_no_trans ioctl lock open read write };
|
||||
allow init_t user_home_t:lnk_file { getattr read };
|
@ -1,26 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: restart ara-api
|
||||
become: yes
|
||||
service:
|
||||
name: ara-api
|
||||
state: restarted
|
||||
when:
|
||||
- ara_api_wsgi_server is not none
|
||||
- ara_api_service_enabled is not changed
|
@ -1,26 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
galaxy_info:
|
||||
author: The ARA Records Ansible authors
|
||||
description: Installs an ARA API server and the built-in reporting interface
|
||||
license: GPLv3
|
||||
min_ansible_version: 2.7
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 8
|
||||
- name: Fedora
|
||||
versions:
|
||||
- 31
|
||||
- 32
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- bionic
|
||||
- focal
|
||||
galaxy_tags:
|
||||
- ansible
|
||||
- ara
|
||||
|
||||
dependencies: []
|
@ -1,127 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Verify if a configuration file exists
|
||||
stat:
|
||||
path: "{{ ara_api_settings }}"
|
||||
register: settings_stat
|
||||
|
||||
# If no secret key has been provided and this isn't the first time we are
|
||||
# running, recover the secret key from the existing configuration file.
|
||||
- when:
|
||||
- ara_api_secret_key is none
|
||||
- settings_stat.stat.exists
|
||||
block:
|
||||
- name: Read the existing configuration file
|
||||
command: cat "{{ ara_api_settings }}"
|
||||
changed_when: false
|
||||
no_log: "{{ ara_api_secure_logging }}"
|
||||
register: settings_contents
|
||||
|
||||
- name: Recover existing secret key
|
||||
vars:
|
||||
config: "{{ settings_contents.stdout | from_yaml }}"
|
||||
set_fact:
|
||||
ara_api_secret_key: "{{ config[ara_api_env]['SECRET_KEY'] }}"
|
||||
no_log: "{{ ara_api_secure_logging }}"
|
||||
|
||||
# If no secret key has been provided and this is the first time we are
|
||||
# running, generate a new random secret key that will be persisted in the
|
||||
# configuration file.
|
||||
- when:
|
||||
- ara_api_secret_key is none
|
||||
- not settings_stat.stat.exists
|
||||
block:
|
||||
- name: Generate a random secret key
|
||||
environment:
|
||||
PATH: "{{ path_with_virtualenv }}"
|
||||
command: python3 -c "from django.utils.crypto import get_random_string; print(get_random_string(length=50))"
|
||||
no_log: "{{ ara_api_secure_logging }}"
|
||||
register: generated_key
|
||||
|
||||
- name: Set ara_api_secret_key
|
||||
set_fact:
|
||||
ara_api_secret_key: "{{ generated_key.stdout }}"
|
||||
no_log: "{{ ara_api_secure_logging }}"
|
||||
|
||||
- name: Validate distributed sqlite configuration
|
||||
assert:
|
||||
that:
|
||||
- "ara_api_database_engine == 'ara.server.db.backends.distributed_sqlite'"
|
||||
msg: |
|
||||
The database engine should be 'ara.server.db.backends.distributed_sqlite'
|
||||
when 'ara_api_distributed_sqlite' is true.
|
||||
when: ara_api_distributed_sqlite
|
||||
|
||||
# Put configuration in a format we can write to a file
|
||||
- name: Reconcile configuration
|
||||
vars:
|
||||
reconciled_configuration:
|
||||
ALLOWED_HOSTS: "{{ ara_api_allowed_hosts }}"
|
||||
BASE_DIR: "{{ ara_api_base_dir }}"
|
||||
CORS_ORIGIN_ALLOW_ALL: "{{ ara_api_cors_origin_allow_all }}"
|
||||
CORS_ORIGIN_WHITELIST: "{{ ara_api_cors_origin_whitelist }}"
|
||||
CORS_ORIGIN_REGEX_WHITELIST: "{{ ara_api_cors_origin_regex_whitelist }}"
|
||||
DATABASE_ENGINE: "{{ ara_api_database_engine }}"
|
||||
DATABASE_NAME: "{{ ara_api_database_name }}"
|
||||
DATABASE_USER: "{{ ara_api_database_user }}"
|
||||
DATABASE_PASSWORD: "{{ ara_api_database_password }}"
|
||||
DATABASE_HOST: "{{ ara_api_database_host }}"
|
||||
DATABASE_PORT: "{{ ara_api_database_port }}"
|
||||
DATABASE_CONN_MAX_AGE: "{{ ara_api_database_conn_max_age }}"
|
||||
DEBUG: "{{ ara_api_debug }}"
|
||||
DISTRIBUTED_SQLITE: "{{ ara_api_distributed_sqlite }}"
|
||||
DISTRIBUTED_SQLITE_PREFIX: "{{ ara_api_distributed_sqlite_prefix }}"
|
||||
DISTRIBUTED_SQLITE_ROOT: "{{ ara_api_distributed_sqlite_root }}"
|
||||
LOGGING: "{{ ara_api_logging }}"
|
||||
LOG_LEVEL: "{{ ara_api_log_level }}"
|
||||
SECRET_KEY: "{{ ara_api_secret_key }}"
|
||||
READ_LOGIN_REQUIRED: "{{ ara_api_read_login_required }}"
|
||||
WRITE_LOGIN_REQUIRED: "{{ ara_api_write_login_required }}"
|
||||
PAGE_SIZE: "{{ ara_api_page_size }}"
|
||||
TIME_ZONE: "{{ ara_api_time_zone }}"
|
||||
set_fact:
|
||||
ara_api_configuration: "{'{{ ara_api_env }}': {{ reconciled_configuration }} }"
|
||||
no_log: "{{ ara_api_secure_logging }}"
|
||||
|
||||
- name: Set up the ARA API configuration file
|
||||
copy:
|
||||
content: |
|
||||
---
|
||||
# Managed by the ara Ansible role
|
||||
{{ ara_api_configuration | to_nice_yaml(indent=2) }}
|
||||
dest: "{{ ara_api_settings }}"
|
||||
mode: 0640
|
||||
notify:
|
||||
- restart ara-api
|
||||
no_log: "{{ ara_api_secure_logging }}"
|
||||
|
||||
- name: Set up ARA API cronjobs
|
||||
cron:
|
||||
name: "{{ job['name'] }}"
|
||||
special_time: "{{ job['special_time'] | default(omit) }}"
|
||||
minute: "{{ job['minute'] | default(omit) }}"
|
||||
hour: "{{ job['hour'] | default(omit) }}"
|
||||
day: "{{ job['day'] | default(omit) }}"
|
||||
weekday: "{{ job['weekday'] | default(omit) }}"
|
||||
month: "{{ job['month'] | default(omit) }}"
|
||||
job: "{{ ara_api_venv_path }}/bin/ara {{ job['arguments'] }} >/dev/null 2>&1"
|
||||
loop: "{{ ara_api_cleanup_crons }}"
|
||||
loop_control:
|
||||
loop_var: 'job'
|
||||
when: ara_api_configure_cron
|
@ -1,22 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This ensures the WSGI application servers are set up to use the right endpoint
|
||||
- name: Set WSGI application to distributed_sqlite
|
||||
set_fact:
|
||||
_ara_api_wsgi_application: "ara.server.wsgi:distributed_sqlite"
|
@ -1,55 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Retrieve list of missing required packages for mysql
|
||||
set_fact:
|
||||
_mysql_missing_packages: "{{ ara_api_mysql_packages | difference(ansible_facts.packages.keys()) }}"
|
||||
|
||||
# Only attempt to elevate privileges if there are any missing packages
|
||||
- when: _mysql_missing_packages | length > 0
|
||||
block:
|
||||
- name: Install required packages
|
||||
become: yes
|
||||
package:
|
||||
name: "{{ ara_api_mysql_packages }}"
|
||||
state: present
|
||||
rescue:
|
||||
- name: Fail due to missing packages
|
||||
fail:
|
||||
msg: "Failed to elevate privileges and install missing required packages. Install the following packages before running this role again: {{ _mysql_missing_packages | join(' ') }}"
|
||||
|
||||
# Django requires mysqclient when using mysql
|
||||
# https://docs.djangoproject.com/en/2.2/ref/databases/#mysql-db-api-drivers
|
||||
- name: Ensure mysqlclient is installed
|
||||
pip:
|
||||
name: mysqlclient
|
||||
state: present
|
||||
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
|
||||
- name: Run SQL migrations
|
||||
environment:
|
||||
ARA_SETTINGS: "{{ ara_api_settings }}"
|
||||
PATH: "{{ path_with_virtualenv }}"
|
||||
command: ara-manage migrate
|
||||
run_once: true
|
||||
register: _ara_sql_migrations
|
||||
retries: 3
|
||||
delay: 5
|
||||
until: _ara_sql_migrations is succeeded
|
||||
changed_when: "'No migrations to apply' not in _ara_sql_migrations.stdout"
|
@ -1,56 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Retrieve list of missing required packages for postgresql
|
||||
set_fact:
|
||||
_postgresql_missing_packages: "{{ ara_api_postgresql_packages | difference(ansible_facts.packages.keys()) }}"
|
||||
|
||||
# Only attempt to elevate privileges if there are any missing packages
|
||||
- when: _postgresql_missing_packages | length > 0
|
||||
block:
|
||||
- name: Install required packages
|
||||
become: yes
|
||||
package:
|
||||
name: "{{ ara_api_postgresql_packages }}"
|
||||
state: present
|
||||
rescue:
|
||||
- name: Fail due to missing packages
|
||||
fail:
|
||||
msg: "Failed to elevate privileges and install missing required packages. Install the following packages before running this role again: {{ _postgresql_missing_packages | join(' ') }}"
|
||||
|
||||
# Django requires psycopg2 when using postgresql
|
||||
# https://docs.djangoproject.com/en/2.2/ref/databases/#postgresql-notes
|
||||
- name: Ensure psycopg2 is installed
|
||||
pip:
|
||||
name: psycopg2
|
||||
state: present
|
||||
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
|
||||
- name: Run SQL migrations
|
||||
environment:
|
||||
ARA_SETTINGS: "{{ ara_api_settings }}"
|
||||
PATH: "{{ path_with_virtualenv }}"
|
||||
command: ara-manage migrate
|
||||
run_once: true
|
||||
register: _ara_sql_migrations
|
||||
retries: 3
|
||||
delay: 5
|
||||
until: _ara_sql_migrations is succeeded
|
||||
register: _ara_sql_migrations
|
||||
changed_when: "'No migrations to apply' not in _ara_sql_migrations.stdout"
|
@ -1,32 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Ensure the database directory exists
|
||||
become: "{{ (ansible_user_dir in ara_api_database_name) | ternary(false, true) }}"
|
||||
file:
|
||||
path: "{{ ara_api_database_name | dirname }}"
|
||||
state: directory
|
||||
|
||||
- name: Run SQL migrations
|
||||
become: "{{ (ansible_user_dir in ara_api_database_name) | ternary(false, true) }}"
|
||||
environment:
|
||||
ARA_SETTINGS: "{{ ara_api_settings }}"
|
||||
PATH: "{{ path_with_virtualenv }}"
|
||||
command: ara-manage migrate
|
||||
register: _ara_sql_migrations
|
||||
changed_when: "'No migrations to apply' not in _ara_sql_migrations.stdout"
|
@ -1,34 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Validate if the distribution is supported
|
||||
fail:
|
||||
msg: |
|
||||
{{ ansible_distribution }} does not support installation from distribution packages yet.
|
||||
when: ara_distribution_packages | length == 0
|
||||
|
||||
- name: Install ara from distribution packages
|
||||
become: yes
|
||||
package:
|
||||
name: "{{ ara_distribution_packages }}"
|
||||
state: present
|
||||
|
||||
# This lets us use "path_with_virtualenv" without conditions everywhere
|
||||
- name: Don't prefix the virtualenv bin directory to PATH
|
||||
set_fact:
|
||||
path_with_virtualenv: "{{ ansible_env.PATH }}"
|
@ -1,12 +0,0 @@
|
||||
---
|
||||
- name: Install required packages from Pypi
|
||||
pip:
|
||||
name: ara[server]
|
||||
state: present
|
||||
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
|
||||
- name: Prefix the virtualenv bin directory to PATH
|
||||
set_fact:
|
||||
path_with_virtualenv: "{{ ara_api_venv_path }}/bin:{{ ansible_env.PATH }}"
|
||||
when: ara_api_venv | bool
|
@ -1,41 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Prepare git repository for ara
|
||||
git:
|
||||
repo: "{{ ara_api_source }}"
|
||||
dest: "{{ ara_api_source_checkout }}"
|
||||
version: "{{ (ara_api_version == 'latest') | ternary('HEAD', ara_api_version) }}"
|
||||
|
||||
- name: Install ara
|
||||
pip:
|
||||
name: "{{ ara_api_source_checkout }}[server]"
|
||||
state: present
|
||||
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
|
||||
- name: Prefix the virtualenv bin directory to PATH
|
||||
set_fact:
|
||||
path_with_virtualenv: "{{ ara_api_venv_path }}/bin:{{ ansible_env.PATH }}"
|
||||
when: ara_api_venv | bool
|
||||
|
||||
# This lets us use "path_with_virtualenv" without conditions everywhere
|
||||
- name: Otherwise don't prefix the virtualenv bin directory to PATH
|
||||
set_fact:
|
||||
path_with_virtualenv: "{{ ansible_env.PATH }}"
|
||||
when: not ara_api_venv | bool
|
@ -1,44 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Include OS family/distribution specific variables
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
|
||||
- name: Ensure pre-requirements for running are met
|
||||
include_tasks: pre-requirements.yaml
|
||||
|
||||
- name: Include installation of ARA
|
||||
include_tasks: "install/{{ ara_api_install_method }}.yaml"
|
||||
|
||||
- name: Include configuration of the ARA API
|
||||
include_tasks: config.yaml
|
||||
|
||||
- name: Include configuration of the database engine
|
||||
include_tasks: "database_engine/{{ ara_api_database_engine }}.yaml"
|
||||
|
||||
- name: Include installation of the WSGI backend server
|
||||
include_tasks: "wsgi_server/{{ ara_api_wsgi_server }}.yaml"
|
||||
when: ara_api_wsgi_server is not none
|
||||
|
||||
- name: Include installation of the frontend server
|
||||
include_role:
|
||||
name: "ara_frontend_{{ ara_api_frontend_server }}"
|
||||
when: ara_api_frontend_server is not none
|
@ -1,84 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# EL8 doesn't install a python3 interpreter by default.
|
||||
# System packages rely on /usr/libexec/platform-python and Ansible will use it
|
||||
# but we want to use the non-system one. Install it if it's missing.
|
||||
- name: Ensure python3 is installed for EL8
|
||||
package:
|
||||
name: python3
|
||||
state: present
|
||||
become: yes
|
||||
when:
|
||||
- ansible_distribution | lower in ["redhat", "centos"]
|
||||
- ansible_distribution_major_version == "8"
|
||||
|
||||
# The ansible_python_version fact might end up retrieving the version of
|
||||
# python2 so we need to explicitely get the version of python 3 available.
|
||||
- name: Validate availability of Python 3.5
|
||||
command: /usr/bin/python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))'
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: python_version
|
||||
|
||||
- name: Fail pre-emptively if running Python <3.5
|
||||
fail:
|
||||
msg: "Python >=3.5 is required to run ARA"
|
||||
when: python_version.stdout is version('3.5', '<') or python_version.rc != 0
|
||||
|
||||
- name: Get list of installed packages
|
||||
package_facts:
|
||||
manager: "auto"
|
||||
no_log: "{{ ara_api_secure_logging }}"
|
||||
|
||||
- name: Retrieve list of missing required packages
|
||||
set_fact:
|
||||
ara_api_missing_packages: "{{ ara_api_required_packages | difference(ansible_facts.packages.keys()) }}"
|
||||
|
||||
# Only attempt to elevate privileges if there are any missing packages
|
||||
- when: ara_api_missing_packages | length > 0
|
||||
block:
|
||||
- name: Install required packages
|
||||
become: yes
|
||||
package:
|
||||
name: "{{ ara_api_required_packages }}"
|
||||
state: present
|
||||
rescue:
|
||||
- name: Fail due to missing packages
|
||||
fail:
|
||||
msg: "Failed to elevate privileges and install missing required packages. Install the following packages before running this role again: {{ ara_missing_packages | join(' ') }}"
|
||||
|
||||
# The following tasks dynamically enable escalated privileges only when the
|
||||
# directory to create is not located in the user's home directory.
|
||||
- name: Ensure ara_api_root_dir exists
|
||||
file:
|
||||
path: "{{ ara_api_root_dir }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: Ensure ara_api_base_dir exists
|
||||
file:
|
||||
path: "{{ ara_api_base_dir }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
|
||||
- name: Ensure ara_api_log_dir exists
|
||||
file:
|
||||
path: "{{ ara_api_log_dir }}"
|
||||
state: directory
|
||||
mode: 0750
|
@ -1,74 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Install gunicorn
|
||||
pip:
|
||||
name: gunicorn
|
||||
state: present
|
||||
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
|
||||
- name: Get path to gunicorn
|
||||
command: which gunicorn
|
||||
changed_when: false
|
||||
register: _gunicorn_cmd
|
||||
environment:
|
||||
PATH: "{{ path_with_virtualenv }}"
|
||||
|
||||
- name: Set path to gunicorn
|
||||
set_fact:
|
||||
_gunicorn_path: "{{ _gunicorn_cmd.stdout }}"
|
||||
|
||||
- when: ansible_os_family == "RedHat"
|
||||
block:
|
||||
- name: Transfer gunicorn selinux type enforcement file
|
||||
copy:
|
||||
src: ara-gunicorn.te
|
||||
dest: "{{ ara_api_root_dir }}/ara-gunicorn.te"
|
||||
|
||||
# TODO: Only compile a new module and policy package when necessary
|
||||
- name: Compile ara-gunicorn selinux module
|
||||
command: "checkmodule -M -m -o {{ ara_api_root_dir }}/ara-gunicorn.mod {{ ara_api_root_dir }}/ara-gunicorn.te"
|
||||
|
||||
- name: Compile ara-gunicorn selinux policy package
|
||||
command: "semodule_package -o {{ ara_api_root_dir }}/ara-gunicorn.pp -m {{ ara_api_root_dir }}/ara-gunicorn.mod"
|
||||
|
||||
- become: yes
|
||||
block:
|
||||
# TODO: Only install the selinux module if it has changed
|
||||
- name: Install selinux policy package
|
||||
command: "semodule -i {{ ara_api_root_dir }}/ara-gunicorn.pp"
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
- name: Set up systemd unit file for gunicorn to run the ARA API
|
||||
template:
|
||||
src: ara-api.service.j2
|
||||
dest: /etc/systemd/system/ara-api.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify:
|
||||
- restart ara-api
|
||||
|
||||
- name: Enable and start ara-api with gunicorn
|
||||
service:
|
||||
name: ara-api
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
register: ara_api_service_enabled
|
@ -1,16 +0,0 @@
|
||||
[Unit]
|
||||
Description=ARA Records Ansible API with gunicorn
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User={{ ansible_user_id }}
|
||||
RuntimeDirectory=ara-api
|
||||
WorkingDirectory={{ ara_api_root_dir }}
|
||||
Environment=ARA_SETTINGS={{ ara_api_settings }}
|
||||
ExecStart={{ _gunicorn_path }} --workers={{ ara_api_wsgi_workers }} --bind {{ ara_api_wsgi_bind }} {{ _ara_api_wsgi_application | default('ara.server.wsgi') }}
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
ExecStop=/bin/kill -s TERM $MAINPID
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,38 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# ARA has not been packaged for CentOS or RHEL yet
|
||||
ara_distribution_packages: []
|
||||
|
||||
ara_api_required_packages:
|
||||
- git
|
||||
- python3
|
||||
- policycoreutils-python-utils
|
||||
|
||||
ara_api_postgresql_packages:
|
||||
- postgresql
|
||||
- postgresql-devel
|
||||
- python3-devel
|
||||
- gcc
|
||||
|
||||
ara_api_mysql_packages:
|
||||
- mariadb
|
||||
- mariadb-connector-c-devel
|
||||
- redhat-rpm-config
|
||||
- python3-devel
|
||||
- gcc
|
@ -1 +0,0 @@
|
||||
Ubuntu.yaml
|
@ -1,39 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
ara_distribution_packages:
|
||||
- ara
|
||||
- ara-server
|
||||
|
||||
ara_api_required_packages:
|
||||
- git
|
||||
- python3-virtualenv
|
||||
- python3-libselinux
|
||||
- policycoreutils-python-utils
|
||||
|
||||
ara_api_postgresql_packages:
|
||||
- postgresql
|
||||
- postgresql-devel
|
||||
- gcc
|
||||
|
||||
ara_api_mysql_packages:
|
||||
- mariadb
|
||||
- mariadb-connector-c-devel
|
||||
- redhat-rpm-config
|
||||
- python3-devel
|
||||
- gcc
|
@ -1 +0,0 @@
|
||||
CentOS.yaml
|
@ -1,38 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# ARA has not been packaged for Ubuntu yet
|
||||
ara_distribution_packages: []
|
||||
|
||||
ara_api_required_packages:
|
||||
- git
|
||||
- python3-venv
|
||||
- python3-setuptools
|
||||
- python-pkg-resources
|
||||
- python3-pkg-resources
|
||||
|
||||
ara_api_postgresql_packages:
|
||||
- postgresql
|
||||
- postgresql-server-dev-10
|
||||
- gcc
|
||||
|
||||
ara_api_mysql_packages:
|
||||
- mariadb-client
|
||||
- libmariadbclient-dev
|
||||
- python3-dev
|
||||
- gcc
|
@ -1,44 +0,0 @@
|
||||
# Ansible role: ara_frontend_nginx
|
||||
|
||||
A role for deploying a minimal installation of nginx for ara-api and ara-web.
|
||||
|
||||
This role is not meant to be used on it's own, it should be included by the
|
||||
``ara_api`` and ``ara_web`` roles in order to have the necessary variables
|
||||
available.
|
||||
|
||||
It is currently tested and supported against Ubuntu 18.04 and Fedora 29.
|
||||
|
||||
## Role Variables
|
||||
|
||||
- ``ara_api_frontend_vhost``: Path to a custom nginx vhost configuration file for ara-api.
|
||||
- ``ara_web_frontend_vhost``: Path to a custom nginx vhost configuration file for ara-web.
|
||||
|
||||
## Example playbooks
|
||||
|
||||
Install ARA and set up the API to be served by nginx with a custom vhost configuration
|
||||
in front of gunicorn:
|
||||
|
||||
```yaml
|
||||
# The API will be reachable at http://api.ara.example.org
|
||||
# The web interface will be reachable at http://web.ara.example.org
|
||||
# The web interface will be set up to query api.ara.example.org.
|
||||
- name: Deploy ARA API server and web interface
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
vars:
|
||||
# ara_api
|
||||
ara_api_frontend_server: nginx
|
||||
ara_api_wsgi_server: gunicorn
|
||||
ara_api_fqdn: api.ara.example.org
|
||||
ara_api_allowed_hosts:
|
||||
- api.ara.example.org
|
||||
ara_api_frontend_vhost: custom_api_vhost.conf.j2
|
||||
# ara_web
|
||||
ara_web_fqdn: web.ara.example.org
|
||||
ara_web_api_endpoint: "http://api.ara.example.org"
|
||||
ara_web_frontend_server: nginx
|
||||
ara_web_frontend_vhost: custom_web_vhost.conf.j2
|
||||
roles:
|
||||
- ara_api
|
||||
- ara_web
|
||||
```
|
@ -1,24 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: restart nginx
|
||||
become: yes
|
||||
service:
|
||||
name: nginx
|
||||
state: restarted
|
||||
when: ara_nginx_enabled is not changed
|
@ -1,26 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
galaxy_info:
|
||||
author: The ARA Records Ansible authors
|
||||
description: Installs an nginx reverse proxy in front of ara-web or an ARA API server
|
||||
license: GPLv3
|
||||
min_ansible_version: 2.7
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 8
|
||||
- name: Fedora
|
||||
versions:
|
||||
- 31
|
||||
- 32
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- bionic
|
||||
- focal
|
||||
galaxy_tags:
|
||||
- ansible
|
||||
- ara
|
||||
|
||||
dependencies: []
|
@ -1,80 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Include OS family/distribution specific variables
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
|
||||
- become: yes
|
||||
block:
|
||||
- name: Install nginx
|
||||
package:
|
||||
name: nginx
|
||||
state: present
|
||||
|
||||
- name: Set selinux boolean to allow nginx to reverse proxy
|
||||
seboolean:
|
||||
name: httpd_can_network_connect
|
||||
state: yes
|
||||
persistent: yes
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
- when: ara_api_fqdn is defined
|
||||
block:
|
||||
- name: Set up the ARA API nginx vhost
|
||||
template:
|
||||
src: "{{ ara_api_frontend_vhost | default('ara-api.conf.j2', True) }}"
|
||||
dest: "{{ ara_nginx_config_path }}/ara-api.conf"
|
||||
notify:
|
||||
- restart nginx
|
||||
|
||||
- name: Enable the API nginx configuration on Debian-like systems
|
||||
file:
|
||||
src: "{{ ara_nginx_config_path }}/ara-api.conf"
|
||||
dest: /etc/nginx/sites-enabled/ara-api.conf
|
||||
state: link
|
||||
when: ansible_os_family == 'Debian'
|
||||
notify:
|
||||
- restart nginx
|
||||
|
||||
- when: ara_web_fqdn is defined
|
||||
block:
|
||||
- name: Set up the ARA API nginx vhost
|
||||
template:
|
||||
src: "{{ ara_web_frontend_vhost | default('ara-web.conf.j2', True) }}"
|
||||
dest: "{{ ara_nginx_config_path }}/ara-web.conf"
|
||||
notify:
|
||||
- restart nginx
|
||||
|
||||
- name: Enable the web nginx configuration on Debian-like systems
|
||||
file:
|
||||
src: "{{ ara_nginx_config_path }}/ara-web.conf"
|
||||
dest: /etc/nginx/sites-enabled/ara-web.conf
|
||||
state: link
|
||||
when: ansible_os_family == 'Debian'
|
||||
notify:
|
||||
- restart nginx
|
||||
|
||||
- name: Enable and start nginx
|
||||
service:
|
||||
name: nginx
|
||||
state: started
|
||||
enabled: yes
|
||||
register: ara_nginx_enabled
|
@ -1,39 +0,0 @@
|
||||
upstream ara_api {
|
||||
# fail_timeout=0 means we always retry an upstream even if it failed
|
||||
# to return a good HTTP response
|
||||
server {{ ara_api_wsgi_bind }} fail_timeout=0;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
keepalive_timeout 5;
|
||||
server_name {{ ara_api_fqdn }};
|
||||
|
||||
access_log /var/log/nginx/{{ ara_api_fqdn }}_access.log;
|
||||
error_log /var/log/nginx/{{ ara_api_fqdn }}_error.log;
|
||||
|
||||
# There's nothing at /, redirect it to the actual API for convenience
|
||||
location / {
|
||||
return 301 http://{{ ara_api_fqdn }}/api/v1/;
|
||||
}
|
||||
|
||||
location /static {
|
||||
expires 7d;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
|
||||
# Everything, including static files, is served by the backend
|
||||
location ~ {
|
||||
# checks if the file exists, if not found proxy to app
|
||||
try_files $uri @proxy_to_app;
|
||||
}
|
||||
|
||||
location @proxy_to_app {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
proxy_redirect off;
|
||||
proxy_pass http://ara_api;
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
{% if ara_web_dev_server %}
|
||||
upstream ara_web {
|
||||
# fail_timeout=0 means we always retry an upstream even if it failed
|
||||
# to return a good HTTP response
|
||||
server {{ ara_web_dev_server_bind_address }}:{{ ara_web_dev_server_bind_port }} fail_timeout=0;
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
keepalive_timeout 5;
|
||||
server_name {{ ara_web_fqdn }};
|
||||
root {{ ara_web_static_dir }};
|
||||
|
||||
access_log /var/log/nginx/{{ ara_web_fqdn }}_access.log;
|
||||
error_log /var/log/nginx/{{ ara_web_fqdn }}_error.log;
|
||||
|
||||
{% if ara_web_dev_server %}
|
||||
location / {
|
||||
# checks if the file exists, if not found proxy to app
|
||||
try_files $uri @proxy_to_app;
|
||||
}
|
||||
|
||||
location @proxy_to_app {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
proxy_redirect off;
|
||||
proxy_pass http://ara_web;
|
||||
}
|
||||
{% endif %}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
ara_nginx_user: nginx
|
||||
ara_nginx_group: nginx
|
||||
ara_nginx_config_path: /etc/nginx/conf.d
|
@ -1 +0,0 @@
|
||||
Ubuntu.yaml
|
@ -1,21 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
ara_nginx_user: nginx
|
||||
ara_nginx_group: nginx
|
||||
ara_nginx_config_path: /etc/nginx/conf.d
|
@ -1 +0,0 @@
|
||||
CentOS.yaml
|
@ -1,21 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
ara_nginx_user: www-data
|
||||
ara_nginx_group: www-data
|
||||
ara_nginx_config_path: /etc/nginx/sites-available
|
@ -1,80 +0,0 @@
|
||||
# Ansible role: ara_web
|
||||
|
||||
![ara_web](https://raw.githubusercontent.com/ansible-community/ara-collection/master/doc/source/_static/ansible-role-ara-web.png)
|
||||
|
||||
This Ansible role provides a framework for installing one or many instances of
|
||||
[ara-web](https://github.com/ansible-community/ara-web) in a variety of
|
||||
opinionated deployment topologies.
|
||||
|
||||
It is currently tested and supported against Ubuntu 18.04 and Fedora 29.
|
||||
|
||||
## Role Variables
|
||||
|
||||
See [defaults/main.yaml](https://github.com/ansible-community/ara-collection/blob/master/roles/ara_web/defaults/main.yaml).
|
||||
|
||||
## TL;DR
|
||||
|
||||
This is what the role does by default out of the box:
|
||||
|
||||
- Retrieves ara-web from source
|
||||
- Installs nodejs LTS (v10)
|
||||
- Installs ara-web dependencies with npm
|
||||
- Configures an ara-server API endpoint in ara-web's ``public/config.json`` file
|
||||
- Sets up a systemd unit file for running ara-web with the embedded development server
|
||||
|
||||
## About deployment topologies
|
||||
|
||||
This Ansible role is designed to support different opinionated topologies that
|
||||
can be selected with role variables.
|
||||
|
||||
For example, the following role variables are defaults used to provide the
|
||||
topology from the ``TL;DR`` above:
|
||||
|
||||
- ``ara_web_install_method: source``
|
||||
- ``ara_web_dev_server: true``
|
||||
- ``ara_web_frontend_server: null``
|
||||
|
||||
The intent is that as the role gains support for other install methods or
|
||||
frontend servers, it will be possible to mix and match according to preference
|
||||
or requirements.
|
||||
|
||||
## Example playbooks
|
||||
|
||||
Deploy the ARA API and web client on the same machine with defaults:
|
||||
|
||||
```yaml
|
||||
- name: Deploy ARA API and web client
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
vars:
|
||||
# ara_api
|
||||
ara_api_fqdn: api.ara.example.org
|
||||
ara_api_wsgi_server: gunicorn
|
||||
ara_api_allowed_hosts:
|
||||
- api.ara.example.org
|
||||
ara_api_cors_origin_whitelist:
|
||||
- "http://web.ara.example.org"
|
||||
# ara_web
|
||||
ara_web_fqdn: web.ara.example.org
|
||||
ara_web_frontend_server: nginx
|
||||
ara_web_api_endpoint: "http://api.ara.example.org"
|
||||
roles:
|
||||
- ara_api
|
||||
- ara_web
|
||||
```
|
||||
|
||||
Deploy only ara-web behind nginx and point it to a remote API endpoint:
|
||||
|
||||
```yaml
|
||||
# Note: Don't forget to add the web fqdn in the remote cors_origin_whitelist.
|
||||
# Otherwise, the web client might not be authorized to query the API.
|
||||
- name: Deploy ara-web for remote API endpoint
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
vars:
|
||||
ara_web_fqdn: web.ara.example.org
|
||||
ara_web_api_endpoint: "http://api.remoteara.example.org"
|
||||
ara_web_frontend_server: nginx
|
||||
ara_web_frontend_vhost: custom-web-vhost.conf.j2
|
||||
roles:
|
||||
- ara_web
|
@ -1,71 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Root of where files will be stored for ara-web
|
||||
ara_web_root_dir: "{{ ansible_user_dir }}/.ara"
|
||||
|
||||
# When using static builds without the dev server, path to ara-web static assets
|
||||
ara_web_static_dir: "{{ ara_web_root_dir }}/www/ara-web"
|
||||
|
||||
# How ara-web will be installed
|
||||
# - source (default): installs from a local or remote git repository specified by ara_web_source
|
||||
# - npm (planned): installs from npm
|
||||
ara_web_install_method: source
|
||||
|
||||
# When installing from source, the location of the remote or local git repository
|
||||
ara_web_source: "https://opendev.org/recordsansible/ara-web"
|
||||
|
||||
# Location where ara-web will be checked out
|
||||
ara_web_source_checkout: "{{ ara_web_root_dir }}/git/ara-web"
|
||||
|
||||
# Location where node_modules will be installed
|
||||
ara_web_node_modules_dir: "{{ ara_web_source_checkout }}"
|
||||
|
||||
# Version of ara-web to install
|
||||
# This can be a git ref (tag, branch, commit) when installed from source
|
||||
# When using "latest" as the source version, HEAD will be used
|
||||
ara_web_version: latest
|
||||
|
||||
# Whether to use the embedded react web server or not
|
||||
# Setting this to false means ara-web will be statically built instead
|
||||
ara_web_dev_server: true
|
||||
|
||||
# When the development server is enabled, the address it will be listening on
|
||||
ara_web_dev_server_bind_address: 127.0.0.1
|
||||
|
||||
# When the development server is enabled, the port it will be listening on
|
||||
ara_web_dev_server_bind_port: 3000
|
||||
|
||||
# Version of nodesource nodejs repositories to install
|
||||
ara_web_nodejs_version: 10
|
||||
|
||||
# ara-server API endpoint to use
|
||||
ara_web_api_endpoint: "http://127.0.0.1:8000"
|
||||
|
||||
# The frontend server for serving ara-web
|
||||
# - null (default): none, users are expected to use the development server directly or deploy their own web server
|
||||
# - nginx: when performance of the development server is an issue
|
||||
# - apache (planned)
|
||||
ara_web_frontend_server: null
|
||||
|
||||
# When using a frontend server, you can override the default vhost configuration
|
||||
# template by specifying the path to your own template file.
|
||||
ara_web_frontend_vhost: null
|
||||
|
||||
# When using a frontend server, the hostname to listen on
|
||||
ara_web_fqdn: "{{ ansible_default_ipv4['address'] }}"
|
@ -1,31 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Is there a better way ? Static files are not created with the httpd context
|
||||
- name: restore selinux context for static files
|
||||
become: "{{ (ansible_user_dir in ara_web_static_dir) | ternary(false, true) }}"
|
||||
command: "restorecon -Rv {{ ara_web_static_dir }}"
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
- name: restart ara-web
|
||||
become: true
|
||||
service:
|
||||
name: ara-web
|
||||
state: restarted
|
||||
when:
|
||||
- ara_web_service_enabled is not changed
|
@ -1,27 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
galaxy_info:
|
||||
author: The ARA Records Ansible authors
|
||||
description: Installs an ara-web javascript interface
|
||||
license: GPLv3
|
||||
min_ansible_version: 2.7
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 8
|
||||
- name: Fedora
|
||||
versions:
|
||||
- 31
|
||||
- 32
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- bionic
|
||||
- focal
|
||||
galaxy_tags:
|
||||
- ansible
|
||||
- ara
|
||||
- ara-web
|
||||
|
||||
dependencies: []
|
@ -1,107 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Ensure libselinux-python is installed for Red Hat derivatives
|
||||
become: yes
|
||||
package:
|
||||
name: libselinux-python
|
||||
state: present
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
- name: Ensure git is installed
|
||||
become: yes
|
||||
package:
|
||||
name: git
|
||||
state: present
|
||||
|
||||
# TODO: node_modules and public/config.json are local to the git repository so this is not idempotent
|
||||
- name: Prepare git repository for ara-web
|
||||
git:
|
||||
repo: "{{ ara_web_source }}"
|
||||
dest: "{{ ara_web_source_checkout }}"
|
||||
version: "{{ (ara_web_version == 'latest') | ternary('HEAD', ara_web_version) }}"
|
||||
force: yes
|
||||
|
||||
- name: Install ara-web npm dependencies
|
||||
npm:
|
||||
path: "{{ ara_web_source_checkout }}"
|
||||
global: no
|
||||
production: yes
|
||||
state: present
|
||||
notify:
|
||||
- restart ara-web
|
||||
|
||||
- name: Configure ara-server API endpoint for ara-web
|
||||
vars:
|
||||
web_config:
|
||||
apiURL: "{{ ara_web_api_endpoint }}"
|
||||
copy:
|
||||
content: "{{ web_config | to_nice_json(indent=2) }}"
|
||||
dest: "{{ ara_web_source_checkout }}/public/config.json"
|
||||
mode: 0644
|
||||
notify:
|
||||
- restart ara-web
|
||||
|
||||
- when: ara_web_dev_server | bool
|
||||
become: yes
|
||||
block:
|
||||
- name: Set up systemd unit file for ara-web
|
||||
template:
|
||||
src: ara-web.service.j2
|
||||
dest: /etc/systemd/system/ara-web.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify:
|
||||
- restart ara-web
|
||||
|
||||
- name: Enable and start ara-web
|
||||
service:
|
||||
name: ara-web
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
register: ara_web_service_enabled
|
||||
|
||||
- when: not ara_web_dev_server | bool
|
||||
block:
|
||||
- name: Stop and disable ara-web
|
||||
become: yes
|
||||
service:
|
||||
name: ara-web
|
||||
state: stopped
|
||||
enabled: no
|
||||
|
||||
- name: Ensure systemd unit file is not configured
|
||||
become: yes
|
||||
file:
|
||||
path: /etc/systemd/system/ara-web.service
|
||||
state: absent
|
||||
|
||||
- name: Run a production build of ara-web
|
||||
command: npm run build
|
||||
args:
|
||||
chdir: "{{ ara_web_source_checkout }}"
|
||||
creates: "{{ ara_web_source_checkout }}/build"
|
||||
|
||||
- name: Synchronize build to web directory
|
||||
become: "{{ (ansible_user_dir in ara_web_static_dir) | ternary(false, true) }}"
|
||||
command: |
|
||||
rsync -rlog --delete-delay {{ ara_web_source_checkout }}/build/ {{ ara_web_static_dir }}
|
||||
notify:
|
||||
- restore selinux context for static files
|
@ -1,28 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Install nodejs
|
||||
include_tasks: nodejs.yaml
|
||||
|
||||
- name: Include ara-web installation
|
||||
include_tasks: install/{{ ara_web_install_method }}.yaml
|
||||
|
||||
- name: Include frontend server installation
|
||||
include_role:
|
||||
name: "ara_frontend_{{ ara_web_frontend_server }}"
|
||||
when: ara_web_frontend_server is not none
|
@ -1,53 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA Records Ansible 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.
|
||||
#
|
||||
# ARA Records Ansible 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 ARA Records Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- when: ansible_os_family == "Debian"
|
||||
become: yes
|
||||
block:
|
||||
- name: Install apt-transport-https
|
||||
package:
|
||||
name: apt-transport-https
|
||||
state: present
|
||||
|
||||
- name: Install nodesource repository key
|
||||
apt_key:
|
||||
url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
|
||||
|
||||
- name: Install nodesource apt source repository
|
||||
apt_repository:
|
||||
repo: "deb-src https://deb.nodesource.com/node_{{ ara_web_nodejs_version }}.x {{ ansible_distribution_release }} main"
|
||||
state: present
|
||||
|
||||
- name: Install nodesource apt repository
|
||||
apt_repository:
|
||||
repo: "deb https://deb.nodesource.com/node_{{ ara_web_nodejs_version }}.x {{ ansible_distribution_release }} main"
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Install Nodesource yum repository
|
||||
become: yes
|
||||
package:
|
||||
name: "https://rpm.nodesource.com/pub_{{ ara_web_nodejs_version }}.x/fc/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/nodesource-release-fc{{ ansible_distribution_major_version }}-1.noarch.rpm"
|
||||
state: present
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
- name: Install nodejs
|
||||
become: yes
|
||||
package:
|
||||
name: nodejs
|
||||
state: present
|
@ -1,16 +0,0 @@
|
||||
[Unit]
|
||||
Description=ARA Records Ansible web client
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
PIDFile=/run/ara-web/pid
|
||||
User={{ ansible_user_id }}
|
||||
RuntimeDirectory=ara-web
|
||||
WorkingDirectory={{ ara_web_source_checkout }}
|
||||
ExecStart=/usr/bin/npm start --host {{ ara_web_dev_server_bind_address }} --port {{ ara_web_dev_server_bind_port }}
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
ExecStop=/bin/kill -s TERM $MAINPID
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,125 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# This is a list of tasks instead of a playbook. They are meant to be included
|
||||
# as post_tasks inside the same play context as our roles so they have access
|
||||
# to the play and role variables.
|
||||
|
||||
- when: ara_api_install_method == "source"
|
||||
block:
|
||||
- name: Set defaults for Ansible package name and version
|
||||
set_fact:
|
||||
ara_tests_ansible_name: "{{ ara_tests_ansible_name | default('ansible') }}"
|
||||
ara_tests_ansible_version: "{{ ara_tests_ansible_version | default('latest') }}"
|
||||
|
||||
# If a version is not explicitly set we want to make sure to
|
||||
# completely omit the version argument to pip, as it will be coming
|
||||
# from the long-form integration_ansible_name variable. Additionally, if
|
||||
# the version is the special value "latest", then we also want to omit
|
||||
# any version number, but also set the package state to "latest".
|
||||
- name: Set Ansible version for installation
|
||||
set_fact:
|
||||
_install_ansible_version: "{{ ara_tests_ansible_version }}"
|
||||
when: ara_tests_ansible_version not in ("", "latest")
|
||||
|
||||
- name: Set Ansible package state for installation
|
||||
set_fact:
|
||||
_install_ansible_state: latest
|
||||
when: ara_tests_ansible_version == "latest"
|
||||
|
||||
- name: Install Ansible alongside ARA
|
||||
pip:
|
||||
name: "{{ ara_tests_ansible_name }}"
|
||||
version: "{{ _install_ansible_version | default(omit, True) }}"
|
||||
state: "{{ _install_ansible_state | default(omit, True) }}"
|
||||
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
register: _ansible_pip_install
|
||||
|
||||
rescue:
|
||||
# Installation of Ansible's cryptography dependency can fail to install with older versions of pip
|
||||
# with "No module named 'setuptools_rust': "https://github.com/pyca/cryptography/issues/5771
|
||||
- name: Update pip to workaround setuptools_rust issue
|
||||
pip:
|
||||
name: pip
|
||||
state: latest
|
||||
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
register: _pip_update
|
||||
when: "'setuptools_rust' in _ansible_pip_install.msg"
|
||||
|
||||
- name: Retry installing Ansible with an up to date pip
|
||||
pip:
|
||||
name: "{{ ara_tests_ansible_name }}"
|
||||
version: "{{ _install_ansible_version | default(omit, True) }}"
|
||||
state: "{{ _install_ansible_state | default(omit, True) }}"
|
||||
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
when: _pip_update is changed
|
||||
|
||||
- name: Install Ansible from distribution packages
|
||||
become: yes
|
||||
package:
|
||||
name: ansible
|
||||
state: present
|
||||
when: ara_api_install_method == "distribution"
|
||||
|
||||
- name: Get ARA plugins directory
|
||||
environment:
|
||||
PATH: "{{ path_with_virtualenv | default('/usr/bin:/usr/local/bin') }}"
|
||||
command: python3 -m ara.setup.plugins
|
||||
changed_when: false
|
||||
register: ara_setup_plugins
|
||||
|
||||
- name: Record Zuul metadata for ARA playbooks
|
||||
include_tasks: zuul_metadata.yaml
|
||||
when: zuul is defined
|
||||
|
||||
# These aren't in the same task (i.e, with loop) so we can tell individual test
|
||||
# runs apart easily rather than keeping all the output bundled in a single task.
|
||||
- environment:
|
||||
ANSIBLE_CALLBACK_PLUGINS: "{{ ara_setup_plugins.stdout }}/callback"
|
||||
ANSIBLE_ACTION_PLUGINS: "{{ ara_setup_plugins.stdout }}/action"
|
||||
ANSIBLE_LOOKUP_PLUGINS: "{{ ara_setup_plugins.stdout }}/lookup"
|
||||
ARA_SETTINGS: "{{ ara_api_settings }}"
|
||||
ARA_API_CLIENT: "{{ ara_api_client | default('offline') }}"
|
||||
ARA_API_SERVER: "{{ ara_api_server | default('http://127.0.0.1:8000') }}"
|
||||
ARA_DEFAULT_LABELS: "{{ _default_labels | join(', ') | default('default-label') }}"
|
||||
PATH: "{{ path_with_virtualenv | default('/usr/bin:/usr/local/bin') }}"
|
||||
vars:
|
||||
_test_root: "{{ ara_api_source_checkout }}/tests/integration"
|
||||
block:
|
||||
# smoke.yaml tests setting ara_playbook_name in one of three plays
|
||||
- name: Run smoke.yaml integration test
|
||||
command: "ansible-playbook -vvv {{ _test_root }}/smoke.yaml"
|
||||
|
||||
- name: Run lookups.yaml integration test
|
||||
command: "ansible-playbook -vvv {{ _test_root }}/lookups.yaml"
|
||||
|
||||
- name: Run hosts.yaml integration test
|
||||
command: "ansible-playbook -vvv {{ _test_root }}/hosts.yaml"
|
||||
|
||||
- name: Run import.yaml integration test
|
||||
command: "ansible-playbook -vvv {{ _test_root }}/import.yaml"
|
||||
|
||||
# Tests setting ara_playbook_name as an extra var
|
||||
- name: Run failed.yaml integration test
|
||||
command: >
|
||||
ansible-playbook -vvv {{ _test_root }}/failed.yaml -e ara_playbook_name="Failed playbook"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Run incomplete.yaml integration test
|
||||
shell: |
|
||||
ansible-playbook -vvv {{ _test_root }}/incomplete.yaml &
|
||||
sleep 5
|
||||
kill $!
|
||||
args:
|
||||
executable: /bin/bash
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Generate static report
|
||||
command: ara-manage generate {{ ara_api_root_dir }}/server/static
|
||||
|
||||
- name: List static report files
|
||||
command: ls -alR {{ ara_api_root_dir }}/server/static
|
@ -1,14 +0,0 @@
|
||||
ara_tests_cleanup: true
|
||||
ara_api_root_dir: "{{ ansible_user_dir }}/.ara-tests"
|
||||
ara_api_distributed_sqlite_root: "{{ ansible_user_dir }}/.ara-tests"
|
||||
ara_api_distributed_sqlite_prefix: ara-test-report
|
||||
ara_api_wsgi_server: gunicorn
|
||||
ara_api_secret_key: testing
|
||||
ara_api_debug: true
|
||||
ara_api_log_level: DEBUG
|
||||
ara_api_server: "http://127.0.0.1:8000"
|
||||
ara_api_client: http
|
||||
_test_directories:
|
||||
- "tests/some/path/ara-test-report"
|
||||
- "tests/dev/ara-test-report"
|
||||
- "tests/prod/ara-test-report"
|
@ -1,18 +0,0 @@
|
||||
ara_tests_cleanup: true
|
||||
ara_api_root_dir: "{{ ansible_user_dir }}/.ara-tests"
|
||||
ara_api_secret_key: testing
|
||||
ara_api_debug: true
|
||||
ara_api_log_level: DEBUG
|
||||
# Set to 0 because tests could be using the offline client
|
||||
ara_api_database_conn_max_age: 0
|
||||
ara_api_database_engine: django.db.backends.mysql
|
||||
ara_api_database_name: ara
|
||||
ara_api_database_user: ara
|
||||
ara_api_database_password: password
|
||||
ara_api_database_port: 3306
|
||||
# Configure cleanup crons to exercise the code path during tests
|
||||
ara_api_configure_cron: true
|
||||
# The host is defined dynamically based on the address of the database server
|
||||
# ara_api_database_host: 127.0.0.1
|
||||
_mysql_container_name: ara_tests_mariadb
|
||||
_mysql_image_name: docker.io/mariadb:10
|
@ -1,18 +0,0 @@
|
||||
ara_tests_cleanup: true
|
||||
ara_api_root_dir: "{{ ansible_user_dir }}/.ara-tests"
|
||||
ara_api_secret_key: testing
|
||||
ara_api_debug: true
|
||||
ara_api_log_level: DEBUG
|
||||
# Set to 0 because tests could be using the offline client
|
||||
ara_api_database_conn_max_age: 0
|
||||
ara_api_database_engine: django.db.backends.postgresql
|
||||
ara_api_database_name: ara
|
||||
ara_api_database_user: ara
|
||||
ara_api_database_password: password
|
||||
ara_api_database_port: 5432
|
||||
# Configure cleanup crons to exercise the code path during tests
|
||||
ara_api_configure_cron: true
|
||||
# The host is defined dynamically based on the address of the database server
|
||||
# ara_api_database_host: 127.0.0.1
|
||||
_postgresql_container_name: ara-postgresql-tests
|
||||
_postgresql_image_name: docker.io/postgres:10
|
@ -1,55 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Test the ARA API with the distributed sqlite backend
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
vars_files:
|
||||
- vars/distributed_sqlite_tests.yaml
|
||||
tasks:
|
||||
# Generate ourselves a fresh database to run tests with
|
||||
- name: Set up the API with the default sqlite backend
|
||||
include_role:
|
||||
name: ara_api
|
||||
public: yes
|
||||
|
||||
# These are tasks rather than a standalone playbook to give us an easy
|
||||
# access to all the variables within the same play.
|
||||
- include_tasks: test_tasks.yaml
|
||||
|
||||
- name: Enable the distributed sqlite backend
|
||||
vars:
|
||||
ara_api_distributed_sqlite: true
|
||||
include_role:
|
||||
name: ara_api
|
||||
public: yes
|
||||
|
||||
- name: Ensure there are no pending handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- name: Create test directories
|
||||
file:
|
||||
path: "{{ ara_api_distributed_sqlite_root }}/{{ item }}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
loop: "{{ _test_directories }}"
|
||||
|
||||
- name: Copy the database to the test directories
|
||||
copy:
|
||||
src: "{{ ara_api_database_name }}"
|
||||
dest: "{{ ara_api_distributed_sqlite_root }}/{{ item }}/ansible.sqlite"
|
||||
remote_src: true
|
||||
loop: "{{ _test_directories }}"
|
||||
|
||||
- name: Test that the API works
|
||||
uri:
|
||||
url: "http://127.0.0.1:8000/{{ item }}/api/v1/"
|
||||
return_content: yes
|
||||
register: api_test
|
||||
loop: "{{ _test_directories }}"
|
||||
|
||||
- name: Print API responses for debug purposes
|
||||
debug:
|
||||
msg: "{{ item['json'] | to_nice_json }}"
|
||||
loop: "{{ api_test.results }}"
|
@ -1,32 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Test the ARA API with fedora packages
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
vars:
|
||||
ara_api_install_method: distribution
|
||||
ara_api_version: latest
|
||||
ara_api_root_dir: "{{ ansible_user_dir }}/.ara-tests"
|
||||
ara_api_secret_key: testing
|
||||
ara_api_debug: true
|
||||
ara_api_log_level: DEBUG
|
||||
tasks:
|
||||
- block:
|
||||
- name: Set up the API with the ara_api role
|
||||
include_role:
|
||||
name: ara_api
|
||||
public: yes
|
||||
|
||||
# Despite installing from packages, we need access to the source for
|
||||
# running tests
|
||||
- name: Prepare git repository for ara
|
||||
git:
|
||||
repo: "{{ ara_api_source }}"
|
||||
dest: "{{ ara_api_source_checkout }}"
|
||||
version: "{{ (ara_api_version == 'latest') | ternary('HEAD', ara_api_version) }}"
|
||||
|
||||
# These are tasks rather than a standalone playbook to give us an easy
|
||||
# access to all the variables within the same play.
|
||||
- include_tasks: test_tasks.yaml
|
@ -1,82 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Start a mysql container
|
||||
hosts: ara-database-server
|
||||
gather_facts: yes
|
||||
vars_files:
|
||||
- vars/mysql_tests.yaml
|
||||
tasks:
|
||||
- name: Install podman
|
||||
become: yes
|
||||
package:
|
||||
name: podman
|
||||
state: present
|
||||
|
||||
- name: Start a mysql container
|
||||
command: |
|
||||
podman run -d \
|
||||
--name {{ _mysql_container_name }} \
|
||||
-p {{ ara_api_database_port }}:{{ ara_api_database_port }} \
|
||||
-e MYSQL_RANDOM_ROOT_PASSWORD=yes \
|
||||
-e MYSQL_DATABASE={{ ara_api_database_name }} \
|
||||
-e MYSQL_USER={{ ara_api_database_user }} \
|
||||
-e MYSQL_PASSWORD={{ ara_api_database_password }} \
|
||||
{{ _mysql_image_name }}
|
||||
register: db_container
|
||||
retries: 3
|
||||
delay: 5
|
||||
until: db_container is succeeded
|
||||
|
||||
# podman doesn't appear to be able to listen on ipv6 yet: https://github.com/containers/libpod/issues/3245
|
||||
# If we have a node on IPv6, redirect the traffic from v6 to v4 with socat
|
||||
- when: ansible_host | ipv6 != false
|
||||
become: yes
|
||||
block:
|
||||
- name: Install socat
|
||||
package:
|
||||
name: socat
|
||||
state: present
|
||||
|
||||
- name: Setup systemd service
|
||||
copy:
|
||||
dest: /etc/systemd/system/socat-mysql.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
content: |
|
||||
[Unit]
|
||||
Description=socat mysql ipv6 to ipv4
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/socat TCP6-LISTEN:3306,fork,bind=[{{ ansible_host }}] TCP4:127.0.0.1:3306
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
- name: Start socat network redirection for mysql over ipv6
|
||||
service:
|
||||
name: socat-mysql
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
||||
- name: Deploy and test ARA API with mysql
|
||||
hosts: ara-api-server
|
||||
gather_facts: yes
|
||||
vars_files:
|
||||
- vars/mysql_tests.yaml
|
||||
tasks:
|
||||
- name: Set database server host
|
||||
set_fact:
|
||||
ara_api_database_host: "{{ hostvars['database-server']['ansible_host'] }}"
|
||||
|
||||
- name: Set up the API with the ara_api Ansible role
|
||||
include_role:
|
||||
name: ara_api
|
||||
public: yes
|
||||
|
||||
# These are tasks rather than a standalone playbook to give us an easy
|
||||
# access to all the variables within the same play.
|
||||
- include_tasks: test_tasks.yaml
|
@ -1,80 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Start a postgresql container
|
||||
hosts: ara-database-server
|
||||
gather_facts: yes
|
||||
vars_files:
|
||||
- vars/postgresql_tests.yaml
|
||||
tasks:
|
||||
- name: Install podman
|
||||
become: yes
|
||||
package:
|
||||
name: podman
|
||||
state: present
|
||||
|
||||
- name: Start a postgresql container
|
||||
command: |
|
||||
podman run -d \
|
||||
--name {{ _postgresql_container_name }} \
|
||||
-p {{ ara_api_database_port }}:{{ ara_api_database_port }} \
|
||||
-e POSTGRES_DB={{ ara_api_database_name }} \
|
||||
-e POSTGRES_USER={{ ara_api_database_user }} \
|
||||
-e POSTGRES_PASSWORD={{ ara_api_database_password }} \
|
||||
{{ _postgresql_image_name }}
|
||||
register: db_container
|
||||
retries: 3
|
||||
delay: 5
|
||||
until: db_container is succeeded
|
||||
|
||||
# podman doesn't appear to be able to listen on ipv6 yet: https://github.com/containers/libpod/issues/3245
|
||||
# If we have a node on IPv6, redirect the traffic from v6 to v4 with socat
|
||||
- when: ansible_host | ipv6 != false
|
||||
become: yes
|
||||
block:
|
||||
- name: Install socat
|
||||
package:
|
||||
name: socat
|
||||
state: present
|
||||
|
||||
- name: Setup systemd service
|
||||
copy:
|
||||
dest: /etc/systemd/system/socat-postgresql.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
content: |
|
||||
[Unit]
|
||||
Description=socat postgresql ipv6 to ipv4
|
||||
[Service]
|
||||
ExecStart=/usr/bin/socat TCP6-LISTEN:5432,fork,bind=[{{ ansible_host }}] TCP4:127.0.0.1:5432
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
- name: Start socat network redirection for postgresql over ipv6
|
||||
service:
|
||||
name: socat-postgresql
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
||||
- name: Deploy and test ARA API with postgresql
|
||||
hosts: ara-api-server
|
||||
gather_facts: yes
|
||||
vars_files:
|
||||
- vars/postgresql_tests.yaml
|
||||
tasks:
|
||||
- name: Set database server host
|
||||
set_fact:
|
||||
ara_api_database_host: "{{ hostvars['database-server']['ansible_host'] }}"
|
||||
|
||||
- name: Set up the API with the ara_api Ansible role
|
||||
include_role:
|
||||
name: ara_api
|
||||
public: yes
|
||||
|
||||
# These are tasks rather than a standalone playbook to give us an easy
|
||||
# access to all the variables within the same play.
|
||||
- include_tasks: test_tasks.yaml
|
@ -1,28 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Set default labels for check, gate and promote pipelines
|
||||
set_fact:
|
||||
_default_labels:
|
||||
- "nodepool.provider:{{ nodepool.provider }}"
|
||||
- "zuul.change:{{ zuul.change }}"
|
||||
- "zuul.executor:{{ zuul.executor.hostname }}"
|
||||
- "zuul.job:{{ zuul.job }}"
|
||||
- "zuul.pipeline:{{ zuul.pipeline }}"
|
||||
- "zuul.project:{{ zuul.project.canonical_name }}"
|
||||
when:
|
||||
- zuul.pipeline is defined
|
||||
- zuul.pipeline in ["check", "gate", "promote"]
|
||||
|
||||
- name: Set default labels for periodic and post pipelines
|
||||
set_fact:
|
||||
_default_labels:
|
||||
- "nodepool.provider:{{ nodepool.provider }}"
|
||||
- "zuul.executor:{{ zuul.executor.hostname }}"
|
||||
- "zuul.job:{{ zuul.job }}"
|
||||
- "zuul.pipeline:{{ zuul.pipeline }}"
|
||||
- "zuul.project:{{ zuul.project.canonical_name }}"
|
||||
when:
|
||||
- zuul.pipeline is defined
|
||||
- zuul.pipeline in ["periodic", "post"]
|
@ -1,49 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Recover API server data
|
||||
hosts: ara-api-server
|
||||
gather_facts: yes
|
||||
vars:
|
||||
ara_api_root_dir: "{{ ansible_user_dir }}/.ara-tests"
|
||||
tasks:
|
||||
# The zuul-output directory is retrieved by the fetch-output role
|
||||
# https://opendev.org/zuul/zuul-jobs/src/branch/master/roles/fetch-output
|
||||
- name: Create log directory
|
||||
file:
|
||||
path: "{{ ansible_user_dir }}/zuul-output/logs"
|
||||
state: directory
|
||||
recurse: yes
|
||||
|
||||
- name: Recover integration test data
|
||||
command: cp -rp {{ ara_api_root_dir }}/server {{ ansible_user_dir }}/zuul-output/logs/server
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Link the static report to the Zuul build with multiple nodes
|
||||
zuul_return:
|
||||
data:
|
||||
zuul:
|
||||
artifacts:
|
||||
- name: "Integration test static report for {{ inventory_hostname }}"
|
||||
url: "{{ inventory_hostname }}/server/static/index.html"
|
||||
when: groups['all'] | length > 1
|
||||
|
||||
- name: Link the static report to the Zuul build with a single node
|
||||
zuul_return:
|
||||
data:
|
||||
zuul:
|
||||
artifacts:
|
||||
- name: Integration test static report
|
||||
url: "server/static/index.html"
|
||||
when: groups['all'] | length == 1
|
||||
|
||||
# Temporarily disable this to prevent "Executing local code is prohibited"
|
||||
# https://review.opendev.org/#/c/742229/
|
||||
#- name: Generate Zuul ARA report
|
||||
# hosts: localhost
|
||||
# vars:
|
||||
# ara_report_type: html
|
||||
# ara_report_path: ara-report
|
||||
# roles:
|
||||
# - ara-report
|
@ -1,34 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Recover mysql server data
|
||||
hosts: ara-database-server
|
||||
gather_facts: yes
|
||||
vars_files:
|
||||
- vars/mysql_tests.yaml
|
||||
tasks:
|
||||
- name: Ensure mysqldump is installed
|
||||
become: yes
|
||||
package:
|
||||
name: mariadb
|
||||
state: present
|
||||
|
||||
# The zuul-output directory is retrieved by the fetch-output role
|
||||
# https://opendev.org/zuul/zuul-jobs/src/branch/master/roles/fetch-output
|
||||
- name: Create log directory
|
||||
file:
|
||||
path: "{{ ansible_user_dir }}/zuul-output/logs"
|
||||
state: directory
|
||||
recurse: yes
|
||||
|
||||
# Dump is suffixed by .txt so we don't need magic mimetypes when
|
||||
# viewing on the web.
|
||||
- name: Dump database file
|
||||
shell: |
|
||||
mysqldump \
|
||||
--host=127.0.0.1 \
|
||||
--port={{ ara_api_database_port }} \
|
||||
--user={{ ara_api_database_user }} \
|
||||
--password={{ ara_api_database_password }} \
|
||||
{{ ara_api_database_name }} > {{ ansible_user_dir }}/zuul-output/logs/mysqldump.sql.txt
|
@ -1,40 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Recover postgresql server data
|
||||
hosts: ara-database-server
|
||||
gather_facts: yes
|
||||
vars_files:
|
||||
- vars/postgresql_tests.yaml
|
||||
tasks:
|
||||
- name: Ensure pg_dump is installed
|
||||
become: yes
|
||||
package:
|
||||
name: postgresql
|
||||
state: present
|
||||
|
||||
# The zuul-output directory is retrieved by the fetch-output role
|
||||
# https://opendev.org/zuul/zuul-jobs/src/branch/master/roles/fetch-output
|
||||
- name: Create log directory
|
||||
file:
|
||||
path: "{{ ansible_user_dir }}/zuul-output/logs"
|
||||
state: directory
|
||||
recurse: yes
|
||||
|
||||
- name: Set up postgre password file for passwordless commands
|
||||
lineinfile:
|
||||
path: "{{ ansible_user_dir }}/.pgpass"
|
||||
create: yes
|
||||
line: "127.0.0.1:{{ ara_api_database_port }}:{{ ara_api_database_name }}:{{ ara_api_database_user }}:{{ ara_api_database_password }}"
|
||||
mode: 0600
|
||||
|
||||
# Dump is suffixed by .txt so we don't need magic mimetypes when
|
||||
# viewing on the web.
|
||||
- name: Dump database file
|
||||
command: |
|
||||
pg_dump -w \
|
||||
--host=127.0.0.1 \
|
||||
--username={{ ara_api_database_user }} \
|
||||
--dbname={{ ara_api_database_name }} \
|
||||
--file={{ ansible_user_dir }}/zuul-output/logs/pg_dump.sql.txt
|
@ -1,11 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2020 The ARA Records Ansible authors
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Allow networking between multiple nodes
|
||||
hosts: all
|
||||
tasks:
|
||||
# https://opendev.org/zuul/zuul-jobs/src/branch/master/roles/multi-node-firewall
|
||||
- name: Set up multi-node firewall
|
||||
include_role:
|
||||
name: multi-node-firewall
|
Loading…
x
Reference in New Issue
Block a user