Init: mediaserver

This commit is contained in:
2023-02-08 12:13:28 +01:00
parent 848bc9739c
commit f7c23d4ba9
31914 changed files with 6175775 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
==========================
Google.Cloud Release Notes
==========================
.. contents:: Topics
v1.1.2
======
Bugfixes
--------
- fix `gcp_compute` no longer being a valid name of the inventory plugin
v1.1.1
======
Bugfixes
--------
- fix collection to work with Python 2.7
v1.1.0
======
Minor Changes
-------------
- GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the name parameter.
Bugfixes
--------
- Disk has been fixed to send the sourceSnapshot parameter.
- gcp_cloudtasks_queue - was not functional before, and is now functional.
- gcp_compute_* - these resources use the correct selflink (www.googleapis.com) as the domain, no longer erroneously reporting changes after an execution.
- gcp_compute_backend_service - no longer erroneously reports changes after an execution for ``capacity_scaler``.
- gcp_container_cluster - support GKE clusters greater than 1.19+, which cannot use basic-auth.
- gcp_crypto_key - skip_initial_version_creation defaults to the correct value.
- gcp_iam_role - now properly undeletes and recognizes soft deleted roles as absent.
- gcp_iam_role - update of a role is functional (GitHub
- gcp_spanner_database - recognize a non-existent resource as absent.
- gcp_storage_object - fix for correct version of dependency requirement.

View File

@@ -0,0 +1,101 @@
# Contributing to the google.cloud collection
## Workflow summary
1. [Clone the repository](#cloning).
1. Make the desired code change.
1. Add a [changelog fragment](https://docs.ansible.com/ansible/devel/community/development_process.html#changelogs-how-to) to describe your change.
1. [Run integration tests locally and ensure they pass](running-integration-tests).
1. Create a PR.
## Cloning
The `ansible-test` command expects that the repository is in a directory that matches it's collection,
under a directory `ansible_collections`. Clone ensuring that hierarchy:
```shell
mkdir -p $TARGET_DIR/ansible_collections/google
git clone <url> $TARGET_DIR/collections/google/cloud
```
## Running tests
### prequisites for all tests
- Install the `ansible` package.
- Some container runtime is necessary (e.g. `podman` or `docker`). The instructions use podman.
## Running integration tests
### Integration testing prequisites
#### Installing personal GCP credentials
The integration tests for this module require the use of real GCP credentials, and must provide
ansible-test those values. They can be added by authoring the following in `tests/integration/cloud-config-gcp.ini`:
```
[default]
gcp_project: @PROJECT_ID
gcp_cred_file: @CRED_FILE
gcp_cred_kind: @CRED_KIND
gcp_cred_email: @EMAIL
gcp_folder_id: @TEST_FOLDER (to create test projects)
```
#### Setting up the project for testing
Some of the setup of the project itself is done outside of the test,
and is expected to be configured beforehand.
For convenience, a bootstrap script is provided.
NOTE: running this script will make irreversible changes in your
GCP project (e.g. create an AppEngine project):
```bash
bash ./scripts/bootstrap-project.sh $PROJECT_ID $SERVICE_ACCOUNT_NAME
```
### Running
Run `ansible-test integration`. Currently some tests are disabled as [test are being verified and added](https://github.com/ansible-collections/google.cloud/issues/499).
## Role tests
### Prequisites for role tests
If you would like to use podman, you must
install the `molecule[podman]` package in PyPI:
```
pip install --upgrade molecule[podman]
```
### Running role tests
Ansible roles are tested via molecule.
```sh
module debug --test -s ${ROLE}
```
Role is the name of the role (e.g. gcloud, gcsfuse).
Add `-d podman` if you would like to use the podman driver.
If the linting fails, that is generally due to `ansible-lint`, which can be run directly:
```
ansible-lint
```
## Specific Tasks
The following enumerates detailed documentation for specific tasks related tot
the codebase.
### Updating the supported ansible-core version
1. modify the [ansible-integration-tests.yaml](.github/workflows/ansible-integration-tests.yml) to the version of ansible-core that you would like to test against.
1. (optional) update the version of ansible-core version required in [meta/runtime.yaml](meta/runtime.yml).

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -0,0 +1,80 @@
# Maintainer Documentation
## See CONTRIBUTING.md for more tasks
[CONTRIBUTING.md](./CONTRIBUTING.md) contains more instructions that could
apply to contributors and not just maintainers (e.g. update ansible-core version).
## CI GCP Project Configuration
To enable running integration tests, a test GCP project must be provided.
There is a Google-maintained CI project, `ansible-gcp-ci`, that is used for this purpose. For any questions or modification to this project, please contact a maintainer who is employed by Google.
## Reviewing PRs
### Merging PRs
Since running the full set of integration tests requires the usage of GCP
credentials which are stored as a secret, maintainers must verify that tests pass the integration test run that runs on push to the master branch after accepting a change.
## Release Process
### Overview
The process is as follows:
1. Update the version of the collection.
1. Update the changelog.
2. Create a GitHub release to tag the repo and begin the publishing process.
### Steps
#### Update Collection Version
Modify the [galaxy.yaml](./galaxy.yml) file to the desired collection version:
```yaml
version: {NEW_VERSION}
```
Ansible collection versions [must follow SEMVER](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections_distributing.html#collection-versions).
Alpha / beta releases are optional.
#### Update the changelog
Providing a valid [CHANGELOG.rst](./CHANGELOG.rst) is required for a certifiable
collection release.
Use the [antsibull-changelog](https://github.com/ansible-community/antsibull-changelog)
tool to generate the changelog:
```sh
pip install antsibull-changelog
antsibull-changelog release
```
This will remove all the changelog fragments from ./changelogs/fragments and
merge them into CHANGELOG.rst.
### Create a new GitHub release
Creating
- [publish to Ansible Galaxy](./.github/workflows/pythonpublish.yml).
### Publish to Automation Hub
*note*: As automation Hub only accepts production releases, this step
is only required for new full releases.
This step does not use GitHub actions, as API keys for Automation Hub
expire after 30 days of no use, and a maintainer may find themselves
refreshing tokens every time anyway.
Steps:
1. Build the package locally: `ansible-galaxy collection build .`
1. [Go to the Automation Hub my-namespaces page, then click on Google](https://console.redhat.com/ansible/automation-hub/repo/published/my-namespaces/google/)
1. Publish the package

View File

@@ -0,0 +1,37 @@
{
"collection_info": {
"namespace": "google",
"name": "cloud",
"version": "1.1.2",
"authors": [
"Google <alexstephen@google.com>",
"Google <yusuketsutsumi@google.com>"
],
"readme": "README.md",
"tags": [
"cloud",
"gcsfuse",
"stackdriver",
"logging",
"monitoring"
],
"description": "The Google Cloud Platform collection.",
"license": [
"GPL-2.0-or-later"
],
"license_file": null,
"dependencies": {},
"repository": "https://github.com/ansible-collections/google.cloud",
"documentation": null,
"homepage": "http://cloud.google.com",
"issues": "https://github.com/ansible-collections/google.cloud/issues"
},
"file_manifest_file": {
"name": "FILES.json",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "6d76f7df335c8b54ee0f0610fcd290ae22b97f1ca5d002314da3498d3a686889",
"format": 1
},
"format": 1
}

View File

@@ -0,0 +1,97 @@
# Google Cloud Platform Ansible Collection
This collection provides a series of Ansible modules and plugins for interacting with the [Google Cloud Platform](https://cloud.google.com)
This collection works with Ansible 2.9+
# Installation
```bash
ansible-galaxy collection install google.cloud
```
# Resources Supported
* App Engine FirewallRule (gcp_appengine_firewall_rule, gcp_appengine_firewall_rule_info)
* BigQuery Dataset (gcp_bigquery_dataset, gcp_bigquery_dataset_info)
* BigQuery Table (gcp_bigquery_table, gcp_bigquery_table_info)
* Cloud Bigtable Instance (gcp_bigtable_instance, gcp_bigtable_instance_info)
* Cloud Build Trigger (gcp_cloudbuild_trigger, gcp_cloudbuild_trigger_info)
* Cloud Functions CloudFunction (gcp_cloudfunctions_cloud_function, gcp_cloudfunctions_cloud_function_info)
* Cloud Scheduler Job (gcp_cloudscheduler_job, gcp_cloudscheduler_job_info)
* Cloud Tasks Queue (gcp_cloudtasks_queue, gcp_cloudtasks_queue_info)
* Compute Engine Address (gcp_compute_address, gcp_compute_address_info)
* Compute Engine Autoscaler (gcp_compute_autoscaler, gcp_compute_autoscaler_info)
* Compute Engine BackendBucket (gcp_compute_backend_bucket, gcp_compute_backend_bucket_info)
* Compute Engine BackendService (gcp_compute_backend_service, gcp_compute_backend_service_info)
* Compute Engine RegionBackendService (gcp_compute_region_backend_service, gcp_compute_region_backend_service_info)
* Compute Engine Disk (gcp_compute_disk, gcp_compute_disk_info)
* Compute Engine Firewall (gcp_compute_firewall, gcp_compute_firewall_info)
* Compute Engine ForwardingRule (gcp_compute_forwarding_rule, gcp_compute_forwarding_rule_info)
* Compute Engine GlobalAddress (gcp_compute_global_address, gcp_compute_global_address_info)
* Compute Engine GlobalForwardingRule (gcp_compute_global_forwarding_rule, gcp_compute_global_forwarding_rule_info)
* Compute Engine HttpHealthCheck (gcp_compute_http_health_check, gcp_compute_http_health_check_info)
* Compute Engine HttpsHealthCheck (gcp_compute_https_health_check, gcp_compute_https_health_check_info)
* Compute Engine HealthCheck (gcp_compute_health_check, gcp_compute_health_check_info)
* Compute Engine InstanceTemplate (gcp_compute_instance_template, gcp_compute_instance_template_info)
* Compute Engine Image (gcp_compute_image, gcp_compute_image_info)
* Compute Engine Instance (gcp_compute_instance, gcp_compute_instance_info)
* Compute Engine InstanceGroup (gcp_compute_instance_group, gcp_compute_instance_group_info)
* Compute Engine InstanceGroupManager (gcp_compute_instance_group_manager, gcp_compute_instance_group_manager_info)
* Compute Engine RegionInstanceGroupManager (gcp_compute_region_instance_group_manager, gcp_compute_region_instance_group_manager_info)
* Compute Engine InterconnectAttachment (gcp_compute_interconnect_attachment, gcp_compute_interconnect_attachment_info)
* Compute Engine Network (gcp_compute_network, gcp_compute_network_info)
* Compute Engine NetworkEndpointGroup (gcp_compute_network_endpoint_group, gcp_compute_network_endpoint_group_info)
* Compute Engine NodeGroup (gcp_compute_node_group, gcp_compute_node_group_info)
* Compute Engine NodeTemplate (gcp_compute_node_template, gcp_compute_node_template_info)
* Compute Engine RegionAutoscaler (gcp_compute_region_autoscaler, gcp_compute_region_autoscaler_info)
* Compute Engine RegionDisk (gcp_compute_region_disk, gcp_compute_region_disk_info)
* Compute Engine RegionUrlMap (gcp_compute_region_url_map, gcp_compute_region_url_map_info)
* Compute Engine RegionHealthCheck (gcp_compute_region_health_check, gcp_compute_region_health_check_info)
* Compute Engine ResourcePolicy (gcp_compute_resource_policy, gcp_compute_resource_policy_info)
* Compute Engine Route (gcp_compute_route, gcp_compute_route_info)
* Compute Engine Router (gcp_compute_router, gcp_compute_router_info)
* Compute Engine Snapshot (gcp_compute_snapshot, gcp_compute_snapshot_info)
* Compute Engine SslCertificate (gcp_compute_ssl_certificate, gcp_compute_ssl_certificate_info)
* Compute Engine Reservation (gcp_compute_reservation, gcp_compute_reservation_info)
* Compute Engine SslPolicy (gcp_compute_ssl_policy, gcp_compute_ssl_policy_info)
* Compute Engine Subnetwork (gcp_compute_subnetwork, gcp_compute_subnetwork_info)
* Compute Engine TargetHttpProxy (gcp_compute_target_http_proxy, gcp_compute_target_http_proxy_info)
* Compute Engine TargetHttpsProxy (gcp_compute_target_https_proxy, gcp_compute_target_https_proxy_info)
* Compute Engine RegionTargetHttpProxy (gcp_compute_region_target_http_proxy, gcp_compute_region_target_http_proxy_info)
* Compute Engine RegionTargetHttpsProxy (gcp_compute_region_target_https_proxy, gcp_compute_region_target_https_proxy_info)
* Compute Engine TargetInstance (gcp_compute_target_instance, gcp_compute_target_instance_info)
* Compute Engine TargetPool (gcp_compute_target_pool, gcp_compute_target_pool_info)
* Compute Engine TargetSslProxy (gcp_compute_target_ssl_proxy, gcp_compute_target_ssl_proxy_info)
* Compute Engine TargetTcpProxy (gcp_compute_target_tcp_proxy, gcp_compute_target_tcp_proxy_info)
* Compute Engine TargetVpnGateway (gcp_compute_target_vpn_gateway, gcp_compute_target_vpn_gateway_info)
* Compute Engine UrlMap (gcp_compute_url_map, gcp_compute_url_map_info)
* Compute Engine VpnTunnel (gcp_compute_vpn_tunnel, gcp_compute_vpn_tunnel_info)
* Google Kubernetes Engine Cluster (gcp_container_cluster, gcp_container_cluster_info)
* Google Kubernetes Engine NodePool (gcp_container_node_pool, gcp_container_node_pool_info)
* Cloud DNS ManagedZone (gcp_dns_managed_zone, gcp_dns_managed_zone_info)
* Cloud DNS ResourceRecordSet (gcp_dns_resource_record_set, gcp_dns_resource_record_set_info)
* Filestore Instance (gcp_filestore_instance, gcp_filestore_instance_info)
* Cloud IAM Role (gcp_iam_role, gcp_iam_role_info)
* Cloud IAM ServiceAccount (gcp_iam_service_account, gcp_iam_service_account_info)
* Cloud IAM ServiceAccountKey (gcp_iam_service_account_key, gcp_iam_service_account_key_info)
* Cloud Key Management Service KeyRing (gcp_kms_key_ring, gcp_kms_key_ring_info)
* Cloud Key Management Service CryptoKey (gcp_kms_crypto_key, gcp_kms_crypto_key_info)
* Cloud (Stackdriver) Logging Metric (gcp_logging_metric, gcp_logging_metric_info)
* ML Engine Model (gcp_mlengine_model, gcp_mlengine_model_info)
* ML Engine Version (gcp_mlengine_version, gcp_mlengine_version_info)
* Cloud Pub/Sub Topic (gcp_pubsub_topic, gcp_pubsub_topic_info)
* Cloud Pub/Sub Subscription (gcp_pubsub_subscription, gcp_pubsub_subscription_info)
* Memorystore (Redis) Instance (gcp_redis_instance, gcp_redis_instance_info)
* Resource Manager Project (gcp_resourcemanager_project, gcp_resourcemanager_project_info)
* Runtime Configurator Config (gcp_runtimeconfig_config, gcp_runtimeconfig_config_info)
* Runtime Configurator Variable (gcp_runtimeconfig_variable, gcp_runtimeconfig_variable_info)
* Service Usage Service (gcp_serviceusage_service, gcp_serviceusage_service_info)
* Cloud Source Repositories Repository (gcp_sourcerepo_repository, gcp_sourcerepo_repository_info)
* Cloud Spanner Instance (gcp_spanner_instance, gcp_spanner_instance_info)
* Cloud Spanner Database (gcp_spanner_database, gcp_spanner_database_info)
* Cloud SQL Instance (gcp_sql_instance, gcp_sql_instance_info)
* Cloud SQL Database (gcp_sql_database, gcp_sql_database_info)
* Cloud SQL User (gcp_sql_user, gcp_sql_user_info)
* Cloud SQL SslCert (gcp_sql_ssl_cert, gcp_sql_ssl_cert_info)
* Cloud Storage Bucket (gcp_storage_bucket, gcp_storage_bucket_info)
* Cloud Storage BucketAccessControl (gcp_storage_bucket_access_control, gcp_storage_bucket_access_control_info)
* Cloud Storage DefaultObjectACL (gcp_storage_default_object_acl, gcp_storage_default_object_acl_info)
* Cloud TPU Node (gcp_tpu_node, gcp_tpu_node_info)

View File

@@ -0,0 +1,873 @@
objects:
role: {}
plugins:
become: {}
cache: {}
callback: {}
cliconf: {}
connection: {}
filter: {}
httpapi: {}
inventory:
gcp_compute:
description: Google Cloud Compute Engine inventory source
name: gcp_compute
version_added: null
lookup: {}
module:
gcp_appengine_firewall_rule:
description: Creates a GCP FirewallRule
name: gcp_appengine_firewall_rule
namespace: ''
version_added: null
gcp_appengine_firewall_rule_info:
description: Gather info for GCP FirewallRule
name: gcp_appengine_firewall_rule_info
namespace: ''
version_added: null
gcp_bigquery_dataset:
description: Creates a GCP Dataset
name: gcp_bigquery_dataset
namespace: ''
version_added: null
gcp_bigquery_dataset_info:
description: Gather info for GCP Dataset
name: gcp_bigquery_dataset_info
namespace: ''
version_added: null
gcp_bigquery_table:
description: Creates a GCP Table
name: gcp_bigquery_table
namespace: ''
version_added: null
gcp_bigquery_table_info:
description: Gather info for GCP Table
name: gcp_bigquery_table_info
namespace: ''
version_added: null
gcp_bigtable_instance:
description: Creates a GCP Instance
name: gcp_bigtable_instance
namespace: ''
version_added: null
gcp_bigtable_instance_info:
description: Gather info for GCP Instance
name: gcp_bigtable_instance_info
namespace: ''
version_added: null
gcp_cloudbuild_trigger:
description: Creates a GCP Trigger
name: gcp_cloudbuild_trigger
namespace: ''
version_added: null
gcp_cloudbuild_trigger_info:
description: Gather info for GCP Trigger
name: gcp_cloudbuild_trigger_info
namespace: ''
version_added: null
gcp_cloudfunctions_cloud_function:
description: Creates a GCP CloudFunction
name: gcp_cloudfunctions_cloud_function
namespace: ''
version_added: null
gcp_cloudfunctions_cloud_function_info:
description: Gather info for GCP CloudFunction
name: gcp_cloudfunctions_cloud_function_info
namespace: ''
version_added: null
gcp_cloudscheduler_job:
description: Creates a GCP Job
name: gcp_cloudscheduler_job
namespace: ''
version_added: null
gcp_cloudscheduler_job_info:
description: Gather info for GCP Job
name: gcp_cloudscheduler_job_info
namespace: ''
version_added: null
gcp_cloudtasks_queue:
description: Creates a GCP Queue
name: gcp_cloudtasks_queue
namespace: ''
version_added: null
gcp_cloudtasks_queue_info:
description: Gather info for GCP Queue
name: gcp_cloudtasks_queue_info
namespace: ''
version_added: null
gcp_compute_address:
description: Creates a GCP Address
name: gcp_compute_address
namespace: ''
version_added: null
gcp_compute_address_info:
description: Gather info for GCP Address
name: gcp_compute_address_info
namespace: ''
version_added: null
gcp_compute_autoscaler:
description: Creates a GCP Autoscaler
name: gcp_compute_autoscaler
namespace: ''
version_added: null
gcp_compute_autoscaler_info:
description: Gather info for GCP Autoscaler
name: gcp_compute_autoscaler_info
namespace: ''
version_added: null
gcp_compute_backend_bucket:
description: Creates a GCP BackendBucket
name: gcp_compute_backend_bucket
namespace: ''
version_added: null
gcp_compute_backend_bucket_info:
description: Gather info for GCP BackendBucket
name: gcp_compute_backend_bucket_info
namespace: ''
version_added: null
gcp_compute_backend_service:
description: Creates a GCP BackendService
name: gcp_compute_backend_service
namespace: ''
version_added: null
gcp_compute_backend_service_info:
description: Gather info for GCP BackendService
name: gcp_compute_backend_service_info
namespace: ''
version_added: null
gcp_compute_disk:
description: Creates a GCP Disk
name: gcp_compute_disk
namespace: ''
version_added: null
gcp_compute_disk_info:
description: Gather info for GCP Disk
name: gcp_compute_disk_info
namespace: ''
version_added: null
gcp_compute_external_vpn_gateway:
description: Creates a GCP ExternalVpnGateway
name: gcp_compute_external_vpn_gateway
namespace: ''
version_added: null
gcp_compute_external_vpn_gateway_info:
description: Gather info for GCP ExternalVpnGateway
name: gcp_compute_external_vpn_gateway_info
namespace: ''
version_added: null
gcp_compute_firewall:
description: Creates a GCP Firewall
name: gcp_compute_firewall
namespace: ''
version_added: null
gcp_compute_firewall_info:
description: Gather info for GCP Firewall
name: gcp_compute_firewall_info
namespace: ''
version_added: null
gcp_compute_forwarding_rule:
description: Creates a GCP ForwardingRule
name: gcp_compute_forwarding_rule
namespace: ''
version_added: null
gcp_compute_forwarding_rule_info:
description: Gather info for GCP ForwardingRule
name: gcp_compute_forwarding_rule_info
namespace: ''
version_added: null
gcp_compute_global_address:
description: Creates a GCP GlobalAddress
name: gcp_compute_global_address
namespace: ''
version_added: null
gcp_compute_global_address_info:
description: Gather info for GCP GlobalAddress
name: gcp_compute_global_address_info
namespace: ''
version_added: null
gcp_compute_global_forwarding_rule:
description: Creates a GCP GlobalForwardingRule
name: gcp_compute_global_forwarding_rule
namespace: ''
version_added: null
gcp_compute_global_forwarding_rule_info:
description: Gather info for GCP GlobalForwardingRule
name: gcp_compute_global_forwarding_rule_info
namespace: ''
version_added: null
gcp_compute_health_check:
description: Creates a GCP HealthCheck
name: gcp_compute_health_check
namespace: ''
version_added: null
gcp_compute_health_check_info:
description: Gather info for GCP HealthCheck
name: gcp_compute_health_check_info
namespace: ''
version_added: null
gcp_compute_http_health_check:
description: Creates a GCP HttpHealthCheck
name: gcp_compute_http_health_check
namespace: ''
version_added: null
gcp_compute_http_health_check_info:
description: Gather info for GCP HttpHealthCheck
name: gcp_compute_http_health_check_info
namespace: ''
version_added: null
gcp_compute_https_health_check:
description: Creates a GCP HttpsHealthCheck
name: gcp_compute_https_health_check
namespace: ''
version_added: null
gcp_compute_https_health_check_info:
description: Gather info for GCP HttpsHealthCheck
name: gcp_compute_https_health_check_info
namespace: ''
version_added: null
gcp_compute_image:
description: Creates a GCP Image
name: gcp_compute_image
namespace: ''
version_added: null
gcp_compute_image_info:
description: Gather info for GCP Image
name: gcp_compute_image_info
namespace: ''
version_added: null
gcp_compute_instance:
description: Creates a GCP Instance
name: gcp_compute_instance
namespace: ''
version_added: null
gcp_compute_instance_group:
description: Creates a GCP InstanceGroup
name: gcp_compute_instance_group
namespace: ''
version_added: null
gcp_compute_instance_group_info:
description: Gather info for GCP InstanceGroup
name: gcp_compute_instance_group_info
namespace: ''
version_added: null
gcp_compute_instance_group_manager:
description: Creates a GCP InstanceGroupManager
name: gcp_compute_instance_group_manager
namespace: ''
version_added: null
gcp_compute_instance_group_manager_info:
description: Gather info for GCP InstanceGroupManager
name: gcp_compute_instance_group_manager_info
namespace: ''
version_added: null
gcp_compute_instance_info:
description: Gather info for GCP Instance
name: gcp_compute_instance_info
namespace: ''
version_added: null
gcp_compute_instance_template:
description: Creates a GCP InstanceTemplate
name: gcp_compute_instance_template
namespace: ''
version_added: null
gcp_compute_instance_template_info:
description: Gather info for GCP InstanceTemplate
name: gcp_compute_instance_template_info
namespace: ''
version_added: null
gcp_compute_interconnect_attachment:
description: Creates a GCP InterconnectAttachment
name: gcp_compute_interconnect_attachment
namespace: ''
version_added: null
gcp_compute_interconnect_attachment_info:
description: Gather info for GCP InterconnectAttachment
name: gcp_compute_interconnect_attachment_info
namespace: ''
version_added: null
gcp_compute_network:
description: Creates a GCP Network
name: gcp_compute_network
namespace: ''
version_added: null
gcp_compute_network_endpoint_group:
description: Creates a GCP NetworkEndpointGroup
name: gcp_compute_network_endpoint_group
namespace: ''
version_added: null
gcp_compute_network_endpoint_group_info:
description: Gather info for GCP NetworkEndpointGroup
name: gcp_compute_network_endpoint_group_info
namespace: ''
version_added: null
gcp_compute_network_info:
description: Gather info for GCP Network
name: gcp_compute_network_info
namespace: ''
version_added: null
gcp_compute_node_group:
description: Creates a GCP NodeGroup
name: gcp_compute_node_group
namespace: ''
version_added: null
gcp_compute_node_group_info:
description: Gather info for GCP NodeGroup
name: gcp_compute_node_group_info
namespace: ''
version_added: null
gcp_compute_node_template:
description: Creates a GCP NodeTemplate
name: gcp_compute_node_template
namespace: ''
version_added: null
gcp_compute_node_template_info:
description: Gather info for GCP NodeTemplate
name: gcp_compute_node_template_info
namespace: ''
version_added: null
gcp_compute_region_autoscaler:
description: Creates a GCP RegionAutoscaler
name: gcp_compute_region_autoscaler
namespace: ''
version_added: null
gcp_compute_region_autoscaler_info:
description: Gather info for GCP RegionAutoscaler
name: gcp_compute_region_autoscaler_info
namespace: ''
version_added: null
gcp_compute_region_backend_service:
description: Creates a GCP RegionBackendService
name: gcp_compute_region_backend_service
namespace: ''
version_added: null
gcp_compute_region_backend_service_info:
description: Gather info for GCP RegionBackendService
name: gcp_compute_region_backend_service_info
namespace: ''
version_added: null
gcp_compute_region_disk:
description: Creates a GCP RegionDisk
name: gcp_compute_region_disk
namespace: ''
version_added: null
gcp_compute_region_disk_info:
description: Gather info for GCP RegionDisk
name: gcp_compute_region_disk_info
namespace: ''
version_added: null
gcp_compute_region_health_check:
description: Creates a GCP RegionHealthCheck
name: gcp_compute_region_health_check
namespace: ''
version_added: null
gcp_compute_region_health_check_info:
description: Gather info for GCP RegionHealthCheck
name: gcp_compute_region_health_check_info
namespace: ''
version_added: null
gcp_compute_region_instance_group_manager:
description: Creates a GCP RegionInstanceGroupManager
name: gcp_compute_region_instance_group_manager
namespace: ''
version_added: null
gcp_compute_region_instance_group_manager_info:
description: Gather info for GCP RegionInstanceGroupManager
name: gcp_compute_region_instance_group_manager_info
namespace: ''
version_added: null
gcp_compute_region_target_http_proxy:
description: Creates a GCP RegionTargetHttpProxy
name: gcp_compute_region_target_http_proxy
namespace: ''
version_added: null
gcp_compute_region_target_http_proxy_info:
description: Gather info for GCP RegionTargetHttpProxy
name: gcp_compute_region_target_http_proxy_info
namespace: ''
version_added: null
gcp_compute_region_target_https_proxy:
description: Creates a GCP RegionTargetHttpsProxy
name: gcp_compute_region_target_https_proxy
namespace: ''
version_added: null
gcp_compute_region_target_https_proxy_info:
description: Gather info for GCP RegionTargetHttpsProxy
name: gcp_compute_region_target_https_proxy_info
namespace: ''
version_added: null
gcp_compute_region_url_map:
description: Creates a GCP RegionUrlMap
name: gcp_compute_region_url_map
namespace: ''
version_added: null
gcp_compute_region_url_map_info:
description: Gather info for GCP RegionUrlMap
name: gcp_compute_region_url_map_info
namespace: ''
version_added: null
gcp_compute_reservation:
description: Creates a GCP Reservation
name: gcp_compute_reservation
namespace: ''
version_added: null
gcp_compute_reservation_info:
description: Gather info for GCP Reservation
name: gcp_compute_reservation_info
namespace: ''
version_added: null
gcp_compute_resource_policy:
description: Creates a GCP ResourcePolicy
name: gcp_compute_resource_policy
namespace: ''
version_added: null
gcp_compute_resource_policy_info:
description: Gather info for GCP ResourcePolicy
name: gcp_compute_resource_policy_info
namespace: ''
version_added: null
gcp_compute_route:
description: Creates a GCP Route
name: gcp_compute_route
namespace: ''
version_added: null
gcp_compute_route_info:
description: Gather info for GCP Route
name: gcp_compute_route_info
namespace: ''
version_added: null
gcp_compute_router:
description: Creates a GCP Router
name: gcp_compute_router
namespace: ''
version_added: null
gcp_compute_router_info:
description: Gather info for GCP Router
name: gcp_compute_router_info
namespace: ''
version_added: null
gcp_compute_snapshot:
description: Creates a GCP Snapshot
name: gcp_compute_snapshot
namespace: ''
version_added: null
gcp_compute_snapshot_info:
description: Gather info for GCP Snapshot
name: gcp_compute_snapshot_info
namespace: ''
version_added: null
gcp_compute_ssl_certificate:
description: Creates a GCP SslCertificate
name: gcp_compute_ssl_certificate
namespace: ''
version_added: null
gcp_compute_ssl_certificate_info:
description: Gather info for GCP SslCertificate
name: gcp_compute_ssl_certificate_info
namespace: ''
version_added: null
gcp_compute_ssl_policy:
description: Creates a GCP SslPolicy
name: gcp_compute_ssl_policy
namespace: ''
version_added: null
gcp_compute_ssl_policy_info:
description: Gather info for GCP SslPolicy
name: gcp_compute_ssl_policy_info
namespace: ''
version_added: null
gcp_compute_subnetwork:
description: Creates a GCP Subnetwork
name: gcp_compute_subnetwork
namespace: ''
version_added: null
gcp_compute_subnetwork_info:
description: Gather info for GCP Subnetwork
name: gcp_compute_subnetwork_info
namespace: ''
version_added: null
gcp_compute_target_http_proxy:
description: Creates a GCP TargetHttpProxy
name: gcp_compute_target_http_proxy
namespace: ''
version_added: null
gcp_compute_target_http_proxy_info:
description: Gather info for GCP TargetHttpProxy
name: gcp_compute_target_http_proxy_info
namespace: ''
version_added: null
gcp_compute_target_https_proxy:
description: Creates a GCP TargetHttpsProxy
name: gcp_compute_target_https_proxy
namespace: ''
version_added: null
gcp_compute_target_https_proxy_info:
description: Gather info for GCP TargetHttpsProxy
name: gcp_compute_target_https_proxy_info
namespace: ''
version_added: null
gcp_compute_target_instance:
description: Creates a GCP TargetInstance
name: gcp_compute_target_instance
namespace: ''
version_added: null
gcp_compute_target_instance_info:
description: Gather info for GCP TargetInstance
name: gcp_compute_target_instance_info
namespace: ''
version_added: null
gcp_compute_target_pool:
description: Creates a GCP TargetPool
name: gcp_compute_target_pool
namespace: ''
version_added: null
gcp_compute_target_pool_info:
description: Gather info for GCP TargetPool
name: gcp_compute_target_pool_info
namespace: ''
version_added: null
gcp_compute_target_ssl_proxy:
description: Creates a GCP TargetSslProxy
name: gcp_compute_target_ssl_proxy
namespace: ''
version_added: null
gcp_compute_target_ssl_proxy_info:
description: Gather info for GCP TargetSslProxy
name: gcp_compute_target_ssl_proxy_info
namespace: ''
version_added: null
gcp_compute_target_tcp_proxy:
description: Creates a GCP TargetTcpProxy
name: gcp_compute_target_tcp_proxy
namespace: ''
version_added: null
gcp_compute_target_tcp_proxy_info:
description: Gather info for GCP TargetTcpProxy
name: gcp_compute_target_tcp_proxy_info
namespace: ''
version_added: null
gcp_compute_target_vpn_gateway:
description: Creates a GCP TargetVpnGateway
name: gcp_compute_target_vpn_gateway
namespace: ''
version_added: null
gcp_compute_target_vpn_gateway_info:
description: Gather info for GCP TargetVpnGateway
name: gcp_compute_target_vpn_gateway_info
namespace: ''
version_added: null
gcp_compute_url_map:
description: Creates a GCP UrlMap
name: gcp_compute_url_map
namespace: ''
version_added: null
gcp_compute_url_map_info:
description: Gather info for GCP UrlMap
name: gcp_compute_url_map_info
namespace: ''
version_added: null
gcp_compute_vpn_tunnel:
description: Creates a GCP VpnTunnel
name: gcp_compute_vpn_tunnel
namespace: ''
version_added: null
gcp_compute_vpn_tunnel_info:
description: Gather info for GCP VpnTunnel
name: gcp_compute_vpn_tunnel_info
namespace: ''
version_added: null
gcp_container_cluster:
description: Creates a GCP Cluster
name: gcp_container_cluster
namespace: ''
version_added: null
gcp_container_cluster_info:
description: Gather info for GCP Cluster
name: gcp_container_cluster_info
namespace: ''
version_added: null
gcp_container_node_pool:
description: Creates a GCP NodePool
name: gcp_container_node_pool
namespace: ''
version_added: null
gcp_container_node_pool_info:
description: Gather info for GCP NodePool
name: gcp_container_node_pool_info
namespace: ''
version_added: null
gcp_dns_managed_zone:
description: Creates a GCP ManagedZone
name: gcp_dns_managed_zone
namespace: ''
version_added: null
gcp_dns_managed_zone_info:
description: Gather info for GCP ManagedZone
name: gcp_dns_managed_zone_info
namespace: ''
version_added: null
gcp_dns_resource_record_set:
description: Creates a GCP ResourceRecordSet
name: gcp_dns_resource_record_set
namespace: ''
version_added: null
gcp_dns_resource_record_set_info:
description: Gather info for GCP ResourceRecordSet
name: gcp_dns_resource_record_set_info
namespace: ''
version_added: null
gcp_filestore_instance:
description: Creates a GCP Instance
name: gcp_filestore_instance
namespace: ''
version_added: null
gcp_filestore_instance_info:
description: Gather info for GCP Instance
name: gcp_filestore_instance_info
namespace: ''
version_added: null
gcp_iam_role:
description: Creates a GCP Role
name: gcp_iam_role
namespace: ''
version_added: null
gcp_iam_role_info:
description: Gather info for GCP Role
name: gcp_iam_role_info
namespace: ''
version_added: null
gcp_iam_service_account:
description: Creates a GCP ServiceAccount
name: gcp_iam_service_account
namespace: ''
version_added: null
gcp_iam_service_account_info:
description: Gather info for GCP ServiceAccount
name: gcp_iam_service_account_info
namespace: ''
version_added: null
gcp_iam_service_account_key:
description: Creates a GCP ServiceAccountKey
name: gcp_iam_service_account_key
namespace: ''
version_added: null
gcp_kms_crypto_key:
description: Creates a GCP CryptoKey
name: gcp_kms_crypto_key
namespace: ''
version_added: null
gcp_kms_crypto_key_info:
description: Gather info for GCP CryptoKey
name: gcp_kms_crypto_key_info
namespace: ''
version_added: null
gcp_kms_key_ring:
description: Creates a GCP KeyRing
name: gcp_kms_key_ring
namespace: ''
version_added: null
gcp_kms_key_ring_info:
description: Gather info for GCP KeyRing
name: gcp_kms_key_ring_info
namespace: ''
version_added: null
gcp_logging_metric:
description: Creates a GCP Metric
name: gcp_logging_metric
namespace: ''
version_added: null
gcp_logging_metric_info:
description: Gather info for GCP Metric
name: gcp_logging_metric_info
namespace: ''
version_added: null
gcp_mlengine_model:
description: Creates a GCP Model
name: gcp_mlengine_model
namespace: ''
version_added: null
gcp_mlengine_model_info:
description: Gather info for GCP Model
name: gcp_mlengine_model_info
namespace: ''
version_added: null
gcp_mlengine_version:
description: Creates a GCP Version
name: gcp_mlengine_version
namespace: ''
version_added: null
gcp_mlengine_version_info:
description: Gather info for GCP Version
name: gcp_mlengine_version_info
namespace: ''
version_added: null
gcp_pubsub_subscription:
description: Creates a GCP Subscription
name: gcp_pubsub_subscription
namespace: ''
version_added: null
gcp_pubsub_subscription_info:
description: Gather info for GCP Subscription
name: gcp_pubsub_subscription_info
namespace: ''
version_added: null
gcp_pubsub_topic:
description: Creates a GCP Topic
name: gcp_pubsub_topic
namespace: ''
version_added: null
gcp_pubsub_topic_info:
description: Gather info for GCP Topic
name: gcp_pubsub_topic_info
namespace: ''
version_added: null
gcp_redis_instance:
description: Creates a GCP Instance
name: gcp_redis_instance
namespace: ''
version_added: null
gcp_redis_instance_info:
description: Gather info for GCP Instance
name: gcp_redis_instance_info
namespace: ''
version_added: null
gcp_resourcemanager_project:
description: Creates a GCP Project
name: gcp_resourcemanager_project
namespace: ''
version_added: null
gcp_resourcemanager_project_info:
description: Gather info for GCP Project
name: gcp_resourcemanager_project_info
namespace: ''
version_added: null
gcp_runtimeconfig_config:
description: Creates a GCP Config
name: gcp_runtimeconfig_config
namespace: ''
version_added: null
gcp_runtimeconfig_config_info:
description: Gather info for GCP Config
name: gcp_runtimeconfig_config_info
namespace: ''
version_added: null
gcp_runtimeconfig_variable:
description: Creates a GCP Variable
name: gcp_runtimeconfig_variable
namespace: ''
version_added: null
gcp_runtimeconfig_variable_info:
description: Gather info for GCP Variable
name: gcp_runtimeconfig_variable_info
namespace: ''
version_added: null
gcp_serviceusage_service:
description: Creates a GCP Service
name: gcp_serviceusage_service
namespace: ''
version_added: null
gcp_serviceusage_service_info:
description: Gather info for GCP Service
name: gcp_serviceusage_service_info
namespace: ''
version_added: null
gcp_sourcerepo_repository:
description: Creates a GCP Repository
name: gcp_sourcerepo_repository
namespace: ''
version_added: null
gcp_sourcerepo_repository_info:
description: Gather info for GCP Repository
name: gcp_sourcerepo_repository_info
namespace: ''
version_added: null
gcp_spanner_database:
description: Creates a GCP Database
name: gcp_spanner_database
namespace: ''
version_added: null
gcp_spanner_database_info:
description: Gather info for GCP Database
name: gcp_spanner_database_info
namespace: ''
version_added: null
gcp_spanner_instance:
description: Creates a GCP Instance
name: gcp_spanner_instance
namespace: ''
version_added: null
gcp_spanner_instance_info:
description: Gather info for GCP Instance
name: gcp_spanner_instance_info
namespace: ''
version_added: null
gcp_sql_database:
description: Creates a GCP Database
name: gcp_sql_database
namespace: ''
version_added: null
gcp_sql_database_info:
description: Gather info for GCP Database
name: gcp_sql_database_info
namespace: ''
version_added: null
gcp_sql_instance:
description: Creates a GCP Instance
name: gcp_sql_instance
namespace: ''
version_added: null
gcp_sql_instance_info:
description: Gather info for GCP Instance
name: gcp_sql_instance_info
namespace: ''
version_added: null
gcp_sql_ssl_cert:
description: Creates a GCP SslCert
name: gcp_sql_ssl_cert
namespace: ''
version_added: null
gcp_sql_user:
description: Creates a GCP User
name: gcp_sql_user
namespace: ''
version_added: null
gcp_sql_user_info:
description: Gather info for GCP User
name: gcp_sql_user_info
namespace: ''
version_added: null
gcp_storage_bucket:
description: Creates a GCP Bucket
name: gcp_storage_bucket
namespace: ''
version_added: null
gcp_storage_bucket_access_control:
description: Creates a GCP BucketAccessControl
name: gcp_storage_bucket_access_control
namespace: ''
version_added: null
gcp_storage_default_object_acl:
description: Creates a GCP DefaultObjectACL
name: gcp_storage_default_object_acl
namespace: ''
version_added: null
gcp_storage_object:
description: Creates a GCP Object
name: gcp_storage_object
namespace: ''
version_added: null
gcp_tpu_node:
description: Creates a GCP Node
name: gcp_tpu_node
namespace: ''
version_added: null
gcp_tpu_node_info:
description: Gather info for GCP Node
name: gcp_tpu_node_info
namespace: ''
version_added: null
netconf: {}
shell: {}
strategy: {}
test: {}
vars: {}
version: 1.1.2

View File

@@ -0,0 +1,40 @@
ancestor: null
releases:
1.1.0:
changes:
bugfixes:
- Disk has been fixed to send the sourceSnapshot parameter.
- gcp_cloudtasks_queue - was not functional before, and is now functional.
- gcp_compute_* - these resources use the correct selflink (www.googleapis.com)
as the domain, no longer erroneously reporting changes after an execution.
- gcp_compute_backend_service - no longer erroneously reports changes after
an execution for ``capacity_scaler``.
- gcp_container_cluster - support GKE clusters greater than 1.19+, which cannot
use basic-auth.
- gcp_crypto_key - skip_initial_version_creation defaults to the correct value.
- gcp_iam_role - now properly undeletes and recognizes soft deleted roles as
absent.
- gcp_iam_role - update of a role is functional (GitHub
- gcp_spanner_database - recognize a non-existent resource as absent.
- gcp_storage_object - fix for correct version of dependency requirement.
minor_changes:
- GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the
name parameter.
fragments:
- 0001_disk.yml
- bugfixes.yaml
release_date: '2022-12-16'
1.1.1:
changes:
bugfixes:
- fix collection to work with Python 2.7
fragments:
- fix-2.7.yml
release_date: '2022-12-16'
1.1.2:
changes:
bugfixes:
- fix `gcp_compute` no longer being a valid name of the inventory plugin
fragments:
- fix-inventory-plugin.yml
release_date: '2022-12-21'

View File

@@ -0,0 +1,32 @@
changelog_filename_template: ../CHANGELOG.rst
changelog_filename_version_depth: 0
changes_file: changelog.yaml
changes_format: combined
ignore_other_fragment_extensions: true
keep_fragments: false
mention_ancestor: true
new_plugins_after_name: removed_features
notesdir: fragments
prelude_section_name: release_summary
prelude_section_title: Release Summary
sanitize_changelog: true
sections:
- - major_changes
- Major Changes
- - minor_changes
- Minor Changes
- - breaking_changes
- Breaking Changes / Porting Guide
- - deprecated_features
- Deprecated Features
- - removed_features
- Removed Features (previously deprecated)
- - security_fixes
- Security Fixes
- - bugfixes
- Bugfixes
- - known_issues
- Known Issues
title: Google.Cloud
trivial_section_name: trivial
use_fqcn: true

View File

@@ -0,0 +1,175 @@
---
requires_ansible: '>=2.9.10'
action_groups:
gcp:
- gcp_appengine_firewall_rule
- gcp_appengine_firewall_rule_info
- gcp_bigquery_dataset
- gcp_bigquery_dataset_info
- gcp_bigquery_table
- gcp_bigquery_table_info
- gcp_bigtable_instance
- gcp_bigtable_instance_info
- gcp_cloudbuild_trigger
- gcp_cloudbuild_trigger_info
- gcp_cloudfunctions_cloud_function
- gcp_cloudfunctions_cloud_function_info
- gcp_cloudscheduler_job
- gcp_cloudscheduler_job_info
- gcp_cloudtasks_queue
- gcp_cloudtasks_queue_info
- gcp_compute_address
- gcp_compute_address_info
- gcp_compute_autoscaler
- gcp_compute_autoscaler_info
- gcp_compute_backend_bucket
- gcp_compute_backend_bucket_info
- gcp_compute_backend_service
- gcp_compute_backend_service_info
- gcp_compute_disk
- gcp_compute_disk_info
- gcp_compute_external_vpn_gateway
- gcp_compute_external_vpn_gateway_info
- gcp_compute_firewall
- gcp_compute_firewall_info
- gcp_compute_forwarding_rule
- gcp_compute_forwarding_rule_info
- gcp_compute_global_address
- gcp_compute_global_address_info
- gcp_compute_global_forwarding_rule
- gcp_compute_global_forwarding_rule_info
- gcp_compute_health_check
- gcp_compute_health_check_info
- gcp_compute_http_health_check
- gcp_compute_http_health_check_info
- gcp_compute_https_health_check
- gcp_compute_https_health_check_info
- gcp_compute_image
- gcp_compute_image_info
- gcp_compute_instance
- gcp_compute_instance_group
- gcp_compute_instance_group_info
- gcp_compute_instance_group_manager
- gcp_compute_instance_group_manager_info
- gcp_compute_instance_info
- gcp_compute_instance_template
- gcp_compute_instance_template_info
- gcp_compute_interconnect_attachment
- gcp_compute_interconnect_attachment_info
- gcp_compute_network
- gcp_compute_network_endpoint_group
- gcp_compute_network_endpoint_group_info
- gcp_compute_network_info
- gcp_compute_node_group
- gcp_compute_node_group_info
- gcp_compute_node_template
- gcp_compute_node_template_info
- gcp_compute_region_autoscaler
- gcp_compute_region_autoscaler_info
- gcp_compute_region_backend_service
- gcp_compute_region_backend_service_info
- gcp_compute_region_disk
- gcp_compute_region_disk_info
- gcp_compute_region_health_check
- gcp_compute_region_health_check_info
- gcp_compute_region_instance_group_manager
- gcp_compute_region_instance_group_manager_info
- gcp_compute_region_target_http_proxy
- gcp_compute_region_target_http_proxy_info
- gcp_compute_region_target_https_proxy
- gcp_compute_region_target_https_proxy_info
- gcp_compute_region_url_map
- gcp_compute_region_url_map_info
- gcp_compute_reservation
- gcp_compute_reservation_info
- gcp_compute_resource_policy
- gcp_compute_resource_policy_info
- gcp_compute_route
- gcp_compute_route_info
- gcp_compute_router
- gcp_compute_router_info
- gcp_compute_snapshot
- gcp_compute_snapshot_info
- gcp_compute_ssl_certificate
- gcp_compute_ssl_certificate_info
- gcp_compute_ssl_policy
- gcp_compute_ssl_policy_info
- gcp_compute_subnetwork
- gcp_compute_subnetwork_info
- gcp_compute_target_http_proxy
- gcp_compute_target_http_proxy_info
- gcp_compute_target_https_proxy
- gcp_compute_target_https_proxy_info
- gcp_compute_target_instance
- gcp_compute_target_instance_info
- gcp_compute_target_pool
- gcp_compute_target_pool_info
- gcp_compute_target_ssl_proxy
- gcp_compute_target_ssl_proxy_info
- gcp_compute_target_tcp_proxy
- gcp_compute_target_tcp_proxy_info
- gcp_compute_target_vpn_gateway
- gcp_compute_target_vpn_gateway_info
- gcp_compute_url_map
- gcp_compute_url_map_info
- gcp_compute_vpn_tunnel
- gcp_compute_vpn_tunnel_info
- gcp_container_cluster
- gcp_container_cluster_info
- gcp_container_node_pool
- gcp_container_node_pool_info
- gcp_dns_managed_zone
- gcp_dns_managed_zone_info
- gcp_dns_resource_record_set
- gcp_dns_resource_record_set_info
- gcp_filestore_instance
- gcp_filestore_instance_info
- gcp_iam_role
- gcp_iam_role_info
- gcp_iam_service_account
- gcp_iam_service_account_info
- gcp_iam_service_account_key
- gcp_kms_crypto_key
- gcp_kms_crypto_key_info
- gcp_kms_key_ring
- gcp_kms_key_ring_info
- gcp_logging_metric
- gcp_logging_metric_info
- gcp_mlengine_model
- gcp_mlengine_model_info
- gcp_mlengine_version
- gcp_mlengine_version_info
- gcp_pubsub_subscription
- gcp_pubsub_subscription_info
- gcp_pubsub_topic
- gcp_pubsub_topic_info
- gcp_redis_instance
- gcp_redis_instance_info
- gcp_resourcemanager_project
- gcp_resourcemanager_project_info
- gcp_runtimeconfig_config
- gcp_runtimeconfig_config_info
- gcp_runtimeconfig_variable
- gcp_runtimeconfig_variable_info
- gcp_serviceusage_service
- gcp_serviceusage_service_info
- gcp_sourcerepo_repository
- gcp_sourcerepo_repository_info
- gcp_spanner_database
- gcp_spanner_database_info
- gcp_spanner_instance
- gcp_spanner_instance_info
- gcp_sql_database
- gcp_sql_database_info
- gcp_sql_instance
- gcp_sql_instance_info
- gcp_sql_ssl_cert
- gcp_sql_user
- gcp_sql_user_info
- gcp_storage_bucket
- gcp_storage_bucket_access_control
- gcp_storage_default_object_acl
- gcp_storage_object
- gcp_tpu_node
- gcp_tpu_node_info

View File

@@ -0,0 +1,111 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
ENV container=docker
{# Initial Package Installs and Container Prep #}
{% if item.image.split(':', 1)[0] in ["ubuntu"] %}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
locales software-properties-common rsyslog systemd systemd-cron sudo \
iproute2
RUN sed -i 's/^\($ModLoad imklog\)/#\1/' /etc/rsyslog.conf
{% elif item.image.split(':', 1)[0] in ["debian"] %}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
sudo systemd systemd-sysv \
build-essential wget
{% elif item.image.split(':', 1)[0] in ["centos"] %}
{% if item.image in ["centos:7"] %}
RUN yum makecache fast && yum -y install deltarpm \
{% elif item.image in ["centos:8"] %}
RUN yum makecache --timer \
{% endif %}
&& yum -y install epel-release \
&& yum -y update \
&& yum -y install sudo which
{% endif %}
{# Install of Python2 #}
{% if item.image in ["ubuntu:16.04"] %}
RUN apt-get update \
&& apt-get install -y --no-install-recommends python-setuptools wget \
&& wget https://bootstrap.pypa.io/get-pip.py \
&& python get-pip.py
{% elif item.image in ["debian:9"] %}
RUN apt-get update \
&& apt-get install -y --no-install-recommends libffi-dev libssl-dev \
python-pip python-dev python-setuptools python-wheel
{% elif item.image in ["centos:7"] %}
RUN yum -y install python-pip
{% endif %}
{# Install of Python3 #}
{% if item.image in ["ubuntu:18.04", "ubuntu:20.04", "debian:10"] %}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils python3-setuptools python3-pip
{% endif %}
{% if item.image in ["centos:8"] %}
RUN yum -y install hostname python3 python3-pip
{% endif %}
{# Steps for cleanup #}
{% if item.image.split(':', 1)[0] in ["ubuntu", "debian"] %}
RUN rm -Rf /var/lib/apt/lists/* \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man \
&& apt-get clean
{% elif item.image.split(':', 1)[0] in ["centos"] %}
RUN yum clean all
{% endif %}
{# Steps for clenaup of systemd #}
{% if item.image in ["centos:7", "centos:8", "debian:9"] %}
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*; \
mkdir -p /run/systemd/system
{% endif %}
{% if item.image in ["ubuntu:18.04", "ubuntu:20.04"] %}
# Remove unnecessary getty and udev targets that result in high CPU usage when using
# multiple containers with Molecule (https://github.com/ansible/molecule/issues/1104)
RUN rm -f /lib/systemd/system/systemd*udev* \
&& rm -f /lib/systemd/system/getty.target
{% endif %}
{% if item.image in ["centos:7", "centos:8"] %}
# Disable requiretty.
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
{% endif %}
{% if item.image.split(':', 1)[0] not in ["centos", "debian"] %}
# Fix potential UTF-8 errors with ansible-test.
RUN locale-gen en_US.UTF-8
{% endif %}
# Install Ansible inventory file.
RUN mkdir -p /etc/ansible
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts
{% if item.image in ["centos:7", "centos:8", "debian:9", "debian:10"] %}
VOLUME ["/sys/fs/cgroup"]
{% elif item.image in ["ubuntu:16.04", "ubuntu:18.04", "ubuntu:20.04"] %}
VOLUME ["/sys/fs/cgroup", "/tmp", "/run"]
{% endif %}
{% if item.image in ["centos:7", "centos:8"] %}
CMD ["/usr/sbin/init"]
{% elif item.image in ["ubuntu:16.04", "ubuntu:18.04", "ubuntu:20.04", "debian:9", "debian:10"] %}
CMD ["/lib/systemd/systemd"]
{% endif %}

View File

@@ -0,0 +1,15 @@
---
- name: Converge
hosts: all
pre_tasks:
- name: Install gpg for apt_key
ansible.builtin.apt:
name: gnupg
update_cache: true
when: ansible_os_family | lower == "debian"
roles:
- role: google.cloud.gcloud
gcloud_install_type: archive
gcloud_command_completion: true
gcloud_additional_components:
- cloud-build-local

View File

@@ -0,0 +1,26 @@
---
- name: Converge
hosts: all
pre_tasks:
- name: Update package cache
ansible.builtin.package:
update_cache: "yes"
changed_when: false
register: task_result
until: task_result is success
retries: 10
delay: 2
- name: Create containerd folder
ansible.builtin.file:
path: /etc/systemd/system/containerd.service.d
state: directory
mode: 0755
when: ansible_service_mgr == "systemd"
- name: Override file for containerd
ansible.builtin.copy:
src: files/override.conf
dest: /etc/systemd/system/containerd.service.d/override.conf
mode: 0644
when: ansible_service_mgr == "systemd"
roles:
- role: google.cloud.gcloud

View File

@@ -0,0 +1,2 @@
[Service]
ExecStartPre=

View File

@@ -0,0 +1,26 @@
---
dependency:
name: galaxy
driver:
name: docker
lint: |
set -e
yamllint .
ansible-lint
platforms:
- name: instance
image: ubuntu:18.04
privileged: true
ansible.builtin.command: "/lib/systemd/systemd"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: instance
image: debian:9
privileged: true
ansible.builtin.command: "/lib/systemd/systemd"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
provisioner:
name: ansible
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}

View File

@@ -0,0 +1,13 @@
---
- name: Converge
hosts: all
pre_tasks:
- name: Install gpg for apt_key
ansible.builtin.apt:
name: gnupg
update_cache: true
when: ansible_os_family | lower == "debian"
roles:
- role: google.cloud.gcloud
gcloud_additional_components:
- cloud-build-local

View File

@@ -0,0 +1,23 @@
from __future__ import (absolute_import, division, print_function)
import os
import testinfra.utils.ansible_runner
__metaclass__ = type
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_service(host):
service = host.service('docker')
assert service.is_running
assert service.is_enabled
def test_hosts_file(host):
f = host.file('/etc/hosts')
assert f.exists
assert f.user == 'root'
assert f.group == 'root'

View File

@@ -0,0 +1,9 @@
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
tasks:
- name: Example assertion
ansible.builtin.assert:
that: true

View File

@@ -0,0 +1,111 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
ENV container=docker
{# Initial Package Installs and Container Prep #}
{% if item.image.split(':', 1)[0] in ["ubuntu"] %}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
locales software-properties-common rsyslog systemd systemd-cron sudo \
iproute2
RUN sed -i 's/^\($ModLoad imklog\)/#\1/' /etc/rsyslog.conf
{% elif item.image.split(':', 1)[0] in ["debian"] %}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
sudo systemd systemd-sysv \
build-essential wget
{% elif item.image.split(':', 1)[0] in ["centos"] %}
{% if item.image in ["centos:7"] %}
RUN yum makecache fast && yum -y install deltarpm \
{% elif item.image in ["centos:8"] %}
RUN yum makecache --timer \
{% endif %}
&& yum -y install epel-release \
&& yum -y update \
&& yum -y install sudo which
{% endif %}
{# Install of Python2 #}
{% if item.image in ["ubuntu:16.04"] %}
RUN apt-get update \
&& apt-get install -y --no-install-recommends python-setuptools wget \
&& wget https://bootstrap.pypa.io/get-pip.py \
&& python get-pip.py
{% elif item.image in ["debian:9"] %}
RUN apt-get update \
&& apt-get install -y --no-install-recommends libffi-dev libssl-dev \
python-pip python-dev python-setuptools python-wheel
{% elif item.image in ["centos:7"] %}
RUN yum -y install python-pip
{% endif %}
{# Install of Python3 #}
{% if item.image in ["ubuntu:18.04", "ubuntu:20.04", "debian:10"] %}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils python3-setuptools python3-pip
{% endif %}
{% if item.image in ["centos:8"] %}
RUN yum -y install hostname python3 python3-pip
{% endif %}
{# Steps for cleanup #}
{% if item.image.split(':', 1)[0] in ["ubuntu", "debian"] %}
RUN rm -Rf /var/lib/apt/lists/* \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man \
&& apt-get clean
{% elif item.image.split(':', 1)[0] in ["centos"] %}
RUN yum clean all
{% endif %}
{# Steps for clenaup of systemd #}
{% if item.image in ["centos:7", "centos:8", "debian:9"] %}
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*; \
mkdir -p /run/systemd/system
{% endif %}
{% if item.image in ["ubuntu:18.04", "ubuntu:20.04"] %}
# Remove unnecessary getty and udev targets that result in high CPU usage when using
# multiple containers with Molecule (https://github.com/ansible/molecule/issues/1104)
RUN rm -f /lib/systemd/system/systemd*udev* \
&& rm -f /lib/systemd/system/getty.target
{% endif %}
{% if item.image in ["centos:7", "centos:8"] %}
# Disable requiretty.
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
{% endif %}
{% if item.image.split(':', 1)[0] not in ["centos", "debian"] %}
# Fix potential UTF-8 errors with ansible-test.
RUN locale-gen en_US.UTF-8
{% endif %}
# Install Ansible inventory file.
RUN mkdir -p /etc/ansible
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts
{% if item.image in ["centos:7", "centos:8", "debian:9", "debian:10"] %}
VOLUME ["/sys/fs/cgroup"]
{% elif item.image in ["ubuntu:16.04", "ubuntu:18.04", "ubuntu:20.04"] %}
VOLUME ["/sys/fs/cgroup", "/tmp", "/run"]
{% endif %}
{% if item.image in ["centos:7", "centos:8"] %}
CMD ["/usr/sbin/init"]
{% elif item.image in ["ubuntu:16.04", "ubuntu:18.04", "ubuntu:20.04", "debian:9", "debian:10"] %}
CMD ["/lib/systemd/systemd"]
{% endif %}

View File

@@ -0,0 +1,14 @@
---
- name: Converge
hosts: all
pre_tasks:
- name: Update package cache
ansible.builtin.package:
update_cache: "yes"
changed_when: false
register: task_result
until: task_result is success
retries: 10
delay: 2
roles:
- role: google.cloud.gcsfuse

View File

@@ -0,0 +1,2 @@
[Service]
ExecStartPre=

View File

@@ -0,0 +1,26 @@
---
dependency:
name: galaxy
driver:
name: docker
lint: |
set -e
yamllint .
ansible-lint
platforms:
- name: instance
image: ubuntu:18.04
privileged: true
ansible.builtin.command: "/lib/systemd/systemd"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: instance
image: debian:9
privileged: true
ansible.builtin.command: "/lib/systemd/systemd"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
provisioner:
name: ansible
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}

View File

@@ -0,0 +1,23 @@
from __future__ import (absolute_import, division, print_function)
import os
import testinfra.utils.ansible_runner
__metaclass__ = type
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_service(host):
service = host.service('docker')
assert service.is_running
assert service.is_enabled
def test_hosts_file(host):
f = host.file('/etc/hosts')
assert f.exists
assert f.user == 'root'
assert f.group == 'root'

View File

@@ -0,0 +1,9 @@
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
tasks:
- name: Example assertion
ansible.builtin.assert:
that: true

View File

@@ -0,0 +1,31 @@
# Collections Plugins Directory
This directory can be used to ship various plugins inside an Ansible collection. Each plugin is placed in a folder that
is named after the type of plugin it is in. It can also include the `module_utils` and `modules` directory that
would contain module utils and modules respectively.
Here is an example directory of the majority of plugins currently supported by Ansible;
```
└── plugins
├── action
├── become
├── cache
├── callback
├── cliconf
├── connection
├── filter
├── httpapi
├── inventory
├── lookup
├── module_utils
├── modules
├── netconf
├── shell
├── strategy
├── terminal
├── test
└── vars
```
A full list of plugin types can be found at [Working With Plugins](https://docs.ansible.com/ansible/devel/plugins/plugins.html).

View File

@@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Google Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
class ModuleDocFragment(object):
# GCP doc fragment.
DOCUMENTATION = r'''
options:
project:
description:
- The Google Cloud Platform project to use.
type: str
auth_kind:
description:
- The type of credential used.
type: str
required: true
choices: [ application, machineaccount, serviceaccount ]
service_account_contents:
description:
- The contents of a Service Account JSON file, either in a dictionary or as a JSON string that represents it.
type: jsonarg
service_account_file:
description:
- The path of a Service Account JSON file if serviceaccount is selected as type.
type: path
service_account_email:
description:
- An optional service account email address if machineaccount is selected
and the user does not wish to use the default email.
type: str
scopes:
description:
- Array of scopes to be used.
type: list
env_type:
description:
- Specifies which Ansible environment you're running this module within.
- This should not be set unless you know what you're doing.
- This only alters the User Agent string for any API requests.
type: str
notes:
- for authentication, you can set service_account_file using the
c(gcp_service_account_file) env variable.
- for authentication, you can set service_account_contents using the
c(GCP_SERVICE_ACCOUNT_CONTENTS) env variable.
- For authentication, you can set service_account_email using the
C(GCP_SERVICE_ACCOUNT_EMAIL) env variable.
- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env
variable.
- For authentication, you can set scopes using the C(GCP_SCOPES) env variable.
- Environment variables values will only be used if the playbook values are
not set.
- The I(service_account_email) and I(service_account_file) options are
mutually exclusive.
'''

View File

@@ -0,0 +1,90 @@
# (c) 2019, Eric Anderson <eric.sysmin@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Usage:
# vars:
# encrypted_myvar: "{{ var | b64encode | gcp_kms_encrypt(auth_kind='serviceaccount',
# service_account_file='gcp_service_account_file', projects='default',
# key_ring='key_ring', crypto_key='crypto_key') }}"
# decrypted_myvar: "{{ encrypted_myvar | gcp_kms_decrypt(auth_kind='serviceaccount',
# service_account_file=gcp_service_account_file, projects='default',
# key_ring='key_ring', crypto_key='crypto_key') }}"
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError
from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import GcpSession
class GcpMockModule(object):
def __init__(self, params):
self.params = params
def fail_json(self, *args, **kwargs):
raise AnsibleError(kwargs['msg'])
class GcpKmsFilter():
def run(self, method, **kwargs):
params = {
'ciphertext': kwargs.get('ciphertext', None),
'plaintext': kwargs.get('plaintext', None),
'additional_authenticated_data': kwargs.get('additional_authenticated_data', None),
'key_ring': kwargs.get('key_ring', None),
'crypto_key': kwargs.get('crypto_key', None),
'projects': kwargs.get('projects', None),
'scopes': kwargs.get('scopes', None),
'locations': kwargs.get('locations', 'global'),
'auth_kind': kwargs.get('auth_kind', None),
'service_account_file': kwargs.get('service_account_file', None),
'service_account_email': kwargs.get('service_account_email', None),
}
if not params['scopes']:
params['scopes'] = ['https://www.googleapis.com/auth/cloudkms']
fake_module = GcpMockModule(params)
if method == "encrypt":
return self.kms_encrypt(fake_module)
elif method == "decrypt":
return self.kms_decrypt(fake_module)
def kms_decrypt(self, module):
payload = {"ciphertext": module.params['ciphertext']}
if module.params['additional_authenticated_data']:
payload['additionalAuthenticatedData'] = module.params['additional_authenticated_data']
auth = GcpSession(module, 'cloudkms')
url = "https://cloudkms.googleapis.com/v1/projects/{projects}/locations/{locations}/" \
"keyRings/{key_ring}/cryptoKeys/{crypto_key}:decrypt".format(**module.params)
response = auth.post(url, body=payload)
return response.json()['plaintext']
def kms_encrypt(self, module):
payload = {"plaintext": module.params['plaintext']}
if module.params['additional_authenticated_data']:
payload['additionalAuthenticatedData'] = module.params['additional_authenticated_data']
auth = GcpSession(module, 'cloudkms')
url = "https://cloudkms.googleapis.com/v1/projects/{projects}/locations/{locations}/" \
"keyRings/{key_ring}/cryptoKeys/{crypto_key}:encrypt".format(**module.params)
response = auth.post(url, body=payload)
return response.json()['ciphertext']
def gcp_kms_encrypt(plaintext, **kwargs):
return GcpKmsFilter().run('encrypt', plaintext=plaintext, **kwargs)
def gcp_kms_decrypt(ciphertext, **kwargs):
return GcpKmsFilter().run('decrypt', ciphertext=ciphertext, **kwargs)
class FilterModule(object):
def filters(self):
return {
'gcp_kms_encrypt': gcp_kms_encrypt,
'gcp_kms_decrypt': gcp_kms_decrypt
}

View File

@@ -0,0 +1,627 @@
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
name: gcp_compute
plugin_type: inventory
short_description: Google Cloud Compute Engine inventory source
requirements:
- requests >= 2.18.4
- google-auth >= 1.3.0
extends_documentation_fragment:
- constructed
- inventory_cache
description:
- Get inventory hosts from Google Cloud Platform GCE.
- Uses a YAML configuration file that ends with gcp_compute.(yml|yaml) or gcp.(yml|yaml).
options:
plugin:
description: token that ensures this is a source file for the 'gcp_compute' plugin.
required: True
choices: ['google.cloud.gcp_compute', 'gcp_compute']
zones:
description: A list of regions in which to describe GCE instances.
If none provided, it defaults to all zones available to a given project.
type: list
folders:
description: A folder that contains many projects
type: list
required: False
projects:
description: A list of projects in which to describe GCE instances.
type: list
required: False
filters:
description: >
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/compute/docs/reference/rest/v1/instances/aggregatedList).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
type: list
hostnames:
description: A list of options that describe the ordering for which
hostnames should be assigned. Currently supported hostnames are
'public_ip', 'private_ip', 'name' or 'labels.vm_name'.
default: ['public_ip', 'private_ip', 'name']
type: list
name_suffix:
description: Custom domain suffix. If set, this string will be appended to all hosts.
default: ""
type: string
required: False
auth_kind:
description:
- The type of credential used.
required: True
choices: ['application', 'serviceaccount', 'machineaccount']
env:
- name: GCP_AUTH_KIND
version_added: "2.8.2"
scopes:
description: list of authentication scopes
type: list
default: ['https://www.googleapis.com/auth/compute']
env:
- name: GCP_SCOPES
version_added: "2.8.2"
service_account_file:
description:
- The path of a Service Account JSON file if serviceaccount is selected as type.
type: path
env:
- name: GCP_SERVICE_ACCOUNT_FILE
version_added: "2.8.2"
- name: GCE_CREDENTIALS_FILE_PATH
version_added: "2.8"
service_account_contents:
description:
- A string representing the contents of a Service Account JSON file. This should not be passed in as a dictionary,
but a string that has the exact contents of a service account json file (valid JSON).
type: string
env:
- name: GCP_SERVICE_ACCOUNT_CONTENTS
version_added: "2.8.2"
service_account_email:
description:
- An optional service account email address if machineaccount is selected
and the user does not wish to use the default email.
env:
- name: GCP_SERVICE_ACCOUNT_EMAIL
version_added: "2.8.2"
vars_prefix:
description: prefix to apply to host variables, does not include facts nor params
default: ''
use_contrib_script_compatible_sanitization:
description:
- By default this plugin is using a general group name sanitization to create safe and usable group names for use in Ansible.
This option allows you to override that, in efforts to allow migration from the old inventory script.
- For this to work you should also turn off the TRANSFORM_INVALID_GROUP_CHARS setting,
otherwise the core engine will just use the standard sanitization on top.
- This is not the default as such names break certain functionality as not all characters are valid Python identifiers
which group names end up being used as.
type: bool
default: False
version_added: '2.8'
retrieve_image_info:
description:
- Populate the C(image) host fact for the instances returned with the GCP image name
- By default this plugin does not attempt to resolve the boot image of an instance to the image name cataloged in GCP
because of the performance overhead of the task.
- Unless this option is enabled, the C(image) host variable will be C(null)
type: bool
default: False
version_added: '2.8'
"""
EXAMPLES = """
plugin: google.cloud.gcp_compute
zones: # populate inventory with instances in these regions
- us-east1-a
projects:
- gcp-prod-gke-100
- gcp-cicd-101
filters:
- machineType = n1-standard-1
- scheduling.automaticRestart = true AND machineType = n1-standard-1
service_account_file: /tmp/service_account.json
auth_kind: serviceaccount
scopes:
- 'https://www.googleapis.com/auth/cloud-platform'
- 'https://www.googleapis.com/auth/compute.readonly'
keyed_groups:
# Create groups from GCE labels
- prefix: gcp
key: labels
name_suffix: .example.com
hostnames:
# List host by name instead of the default public ip
- name
compose:
# Set an inventory parameter to use the Public IP address to connect to the host
# For Private ip use "networkInterfaces[0].networkIP"
ansible_host: networkInterfaces[0].accessConfigs[0].natIP
"""
import json
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.module_utils._text import to_text
from ansible.module_utils.basic import missing_required_lib
from ..module_utils.gcp_utils import (
GcpSession,
navigate_hash,
GcpRequestException,
HAS_GOOGLE_LIBRARIES,
)
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
# Mocking a module to reuse module_utils
class GcpMockModule(object):
def __init__(self, params):
self.params = params
def fail_json(self, *args, **kwargs):
raise AnsibleError(kwargs["msg"])
class GcpInstance(object):
def __init__(self, json, hostname_ordering, project_disks, should_format=True, name_suffix=""):
self.hostname_ordering = hostname_ordering
self.project_disks = project_disks
self.name_suffix = name_suffix
self.json = json
if should_format:
self.convert()
def to_json(self):
return self.json
def convert(self):
if "zone" in self.json:
self.json["zone_selflink"] = self.json["zone"]
self.json["zone"] = self.json["zone"].split("/")[-1]
if "machineType" in self.json:
self.json["machineType_selflink"] = self.json["machineType"]
self.json["machineType"] = self.json["machineType"].split("/")[-1]
if "networkInterfaces" in self.json:
for network in self.json["networkInterfaces"]:
if "network" in network:
network["network"] = self._format_network_info(network["network"])
if "subnetwork" in network:
network["subnetwork"] = self._format_network_info(
network["subnetwork"]
)
if "metadata" in self.json:
# If no metadata, 'items' will be blank.
# We want the metadata hash overriden anyways for consistency.
self.json["metadata"] = self._format_metadata(
self.json["metadata"].get("items", {})
)
self.json["project"] = self.json["selfLink"].split("/")[6]
self.json["image"] = self._get_image()
def _format_network_info(self, address):
"""
:param address: A GCP network address
:return a dict with network shortname and region
"""
split = address.split("/")
region = ""
if "global" in split:
region = "global"
else:
region = split[8]
return {"region": region, "name": split[-1], "selfLink": address}
def _format_metadata(self, metadata):
"""
:param metadata: A list of dicts where each dict has keys "key" and "value"
:return a dict with key/value pairs for each in list.
"""
new_metadata = {}
for pair in metadata:
new_metadata[pair["key"]] = pair["value"]
return new_metadata
def hostname(self):
"""
:return the hostname of this instance
"""
for order in self.hostname_ordering:
name = None
if order.startswith("labels."):
name = self.json[u"labels"].get(order[7:])
elif order == "public_ip":
name = self._get_publicip()
elif order == "private_ip":
name = self._get_privateip()
elif order == "name":
name = self.json[u"name"] + self.name_suffix
else:
raise AnsibleParserError("%s is not a valid hostname precedent" % order)
if name:
return name
raise AnsibleParserError("No valid name found for host")
def _get_publicip(self):
"""
:return the publicIP of this instance or None
"""
# Get public IP if exists
for interface in self.json["networkInterfaces"]:
if "accessConfigs" in interface:
for accessConfig in interface["accessConfigs"]:
if "natIP" in accessConfig:
return accessConfig[u"natIP"]
return None
def _get_image(self):
"""
:param instance: A instance response from GCP
:return the image of this instance or None
"""
image = None
if self.project_disks and "disks" in self.json:
for disk in self.json["disks"]:
if disk.get("boot"):
image = self.project_disks[disk["source"]]
return image
def _get_privateip(self):
"""
:param item: A host response from GCP
:return the privateIP of this instance or None
"""
# Fallback: Get private IP
for interface in self.json[u"networkInterfaces"]:
if "networkIP" in interface:
return interface[u"networkIP"]
class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
NAME = "google.cloud.gcp_compute"
_instances = (
r"https://www.googleapis.com/compute/v1/projects/%s/aggregated/instances"
)
def __init__(self):
super(InventoryModule, self).__init__()
self.group_prefix = "gcp_"
def _populate_host(self, item):
"""
:param item: A GCP instance
"""
hostname = item.hostname()
self.inventory.add_host(hostname)
for key in item.to_json():
try:
self.inventory.set_variable(
hostname, self.get_option("vars_prefix") + key, item.to_json()[key]
)
except (ValueError, TypeError) as e:
self.display.warning(
"Could not set host info hostvar for %s, skipping %s: %s"
% (hostname, key, to_text(e))
)
self.inventory.add_child("all", hostname)
def verify_file(self, path):
"""
:param path: the path to the inventory config file
:return the contents of the config file
"""
if super(InventoryModule, self).verify_file(path):
if path.endswith(("gcp.yml", "gcp.yaml")):
return True
elif path.endswith(("gcp_compute.yml", "gcp_compute.yaml")):
return True
return False
def fetch_list(self, params, link, query):
"""
:param params: a dict containing all of the fields relevant to build URL
:param link: a formatted URL
:param query: a formatted query string
:return the JSON response containing a list of instances.
"""
lists = []
resp = self._return_if_object(
self.fake_module, self.auth_session.get(link, params={"filter": query})
)
if resp:
lists.append(resp.get("items"))
while resp.get("nextPageToken"):
resp = self._return_if_object(
self.fake_module,
self.auth_session.get(
link,
params={"filter": query, "pageToken": resp.get("nextPageToken")},
),
)
lists.append(resp.get("items"))
return self.build_list(lists)
def build_list(self, lists):
arrays_for_zones = {}
for resp in lists:
for zone in resp:
if "instances" in resp[zone]:
if zone in arrays_for_zones:
arrays_for_zones[zone] = (
arrays_for_zones[zone] + resp[zone]["instances"]
)
else:
arrays_for_zones[zone] = resp[zone]["instances"]
return arrays_for_zones
def _get_query_options(self, filters):
"""
:param config_data: contents of the inventory config file
:return A fully built query string
"""
if not filters:
return ""
if len(filters) == 1:
return filters[0]
else:
queries = []
for f in filters:
# For multiple queries, all queries should have ()
if f[0] != "(" and f[-1] != ")":
queries.append("(%s)" % "".join(f))
else:
queries.append(f)
return " ".join(queries)
def _return_if_object(self, module, response):
"""
:param module: A GcpModule
:param response: A Requests response object
:return JSON response
"""
# If not found, return nothing.
if response.status_code == 404:
return None
# If no content, return nothing.
if response.status_code == 204:
return None
try:
response.raise_for_status
result = response.json()
except getattr(json.decoder, "JSONDecodeError", ValueError) as inst:
module.fail_json(msg="Invalid JSON response with error: %s" % inst)
except GcpRequestException as inst:
module.fail_json(msg="Network error: %s" % inst)
if navigate_hash(result, ["error", "errors"]):
module.fail_json(msg=navigate_hash(result, ["error", "errors"]))
return result
def _add_hosts(self, items, config_data, format_items=True, project_disks=None):
"""
:param items: A list of hosts
:param config_data: configuration data
:param format_items: format items or not
"""
if not items:
return
hostname_ordering = ["public_ip", "private_ip", "name"]
if self.get_option("hostnames"):
hostname_ordering = self.get_option("hostnames")
name_suffix = self.get_option("name_suffix")
for host_json in items:
host = GcpInstance(
host_json, hostname_ordering, project_disks, format_items, name_suffix
)
self._populate_host(host)
hostname = host.hostname()
self._set_composite_vars(
self.get_option("compose"), host.to_json(), hostname
)
self._add_host_to_composed_groups(
self.get_option("groups"), host.to_json(), hostname
)
self._add_host_to_keyed_groups(
self.get_option("keyed_groups"), host.to_json(), hostname
)
def _get_project_disks(self, config_data, query):
"""
project space disk images
"""
try:
self._project_disks
except AttributeError:
self._project_disks = {}
request_params = {"maxResults": 500, "filter": query}
for project in config_data["projects"]:
session_responses = []
page_token = True
while page_token:
response = self.auth_session.get(
"https://www.googleapis.com/compute/v1/projects/{0}/aggregated/disks".format(
project
),
params=request_params,
)
response_json = response.json()
if "nextPageToken" in response_json:
request_params["pageToken"] = response_json["nextPageToken"]
elif "pageToken" in request_params:
del request_params["pageToken"]
if "items" in response_json:
session_responses.append(response_json)
page_token = "pageToken" in request_params
for response in session_responses:
if "items" in response:
# example k would be a zone or region name
# example v would be { "disks" : [], "otherkey" : "..." }
for zone_or_region, aggregate in response["items"].items():
if "zones" in zone_or_region:
if "disks" in aggregate:
zone = zone_or_region.replace("zones/", "")
for disk in aggregate["disks"]:
if (
"zones" in config_data
and zone in config_data["zones"]
):
# If zones specified, only store those zones' data
if "sourceImage" in disk:
self._project_disks[
disk["selfLink"]
] = disk["sourceImage"].split("/")[-1]
else:
self._project_disks[
disk["selfLink"]
] = disk["selfLink"].split("/")[-1]
else:
if "sourceImage" in disk:
self._project_disks[
disk["selfLink"]
] = disk["sourceImage"].split("/")[-1]
else:
self._project_disks[
disk["selfLink"]
] = disk["selfLink"].split("/")[-1]
return self._project_disks
def fetch_projects(self, params, link, query):
module = GcpMockModule(params)
auth = GcpSession(module, 'cloudresourcemanager')
response = auth.get(link, params={'filter': query})
return self._return_if_object(module, response)
def projects_for_folder(self, config_data, folder):
link = 'https://cloudresourcemanager.googleapis.com/v1/projects'
query = 'parent.id = {0}'.format(folder)
projects = []
config_data['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
projects_response = self.fetch_projects(config_data, link, query)
if 'projects' in projects_response:
for item in projects_response.get('projects'):
projects.append(item['projectId'])
return projects
def parse(self, inventory, loader, path, cache=True):
if not HAS_GOOGLE_LIBRARIES:
raise AnsibleParserError(
"gce inventory plugin cannot start: %s"
% missing_required_lib("google-auth")
)
super(InventoryModule, self).parse(inventory, loader, path)
config_data = {}
config_data = self._read_config_data(path)
if self.get_option("use_contrib_script_compatible_sanitization"):
self._sanitize_group_name = (
self._legacy_script_compatible_group_sanitization
)
# setup parameters as expected by 'fake module class' to reuse module_utils w/o changing the API
params = {
"filters": self.get_option("filters"),
"projects": self.get_option("projects"),
"folders": self.get_option("folders"),
"scopes": self.get_option("scopes"),
"zones": self.get_option("zones"),
"auth_kind": self.get_option("auth_kind"),
"service_account_file": self.get_option("service_account_file"),
"service_account_contents": self.get_option("service_account_contents"),
"service_account_email": self.get_option("service_account_email"),
}
self.fake_module = GcpMockModule(params)
self.auth_session = GcpSession(self.fake_module, "compute")
query = self._get_query_options(params["filters"])
if self.get_option("retrieve_image_info"):
project_disks = self._get_project_disks(config_data, query)
else:
project_disks = None
# Cache logic
if cache:
cache = self.get_option("cache")
cache_key = self.get_cache_key(path)
else:
cache_key = None
cache_needs_update = False
if cache:
try:
results = self._cache[cache_key]
for project in results:
for zone in results[project]:
self._add_hosts(
results[project][zone],
config_data,
False,
project_disks=project_disks,
)
except KeyError:
cache_needs_update = True
projects = []
if params["projects"]:
projects = projects + params["projects"]
if params["folders"]:
for folder in params["folders"]:
projects = projects + self.projects_for_folder(config_data, folder)
if not cache or cache_needs_update:
cached_data = {}
for project in projects:
cached_data[project] = {}
params["project"] = project
zones = params["zones"]
# Fetch all instances
link = self._instances % project
resp = self.fetch_list(params, link, query)
for key, value in resp.items():
zone = key[6:]
if not zones or zone in zones:
self._add_hosts(value, config_data, project_disks=project_disks)
cached_data[project][zone] = value
if cache_needs_update:
self._cache[cache_key] = cached_data
@staticmethod
def _legacy_script_compatible_group_sanitization(name):
return name

View File

@@ -0,0 +1,456 @@
# Copyright (c), Google Inc, 2017
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ast
import os
import json
try:
import requests
HAS_REQUESTS = True
except ImportError:
HAS_REQUESTS = False
try:
import google.auth
import google.auth.compute_engine
from google.oauth2 import service_account
from google.auth.transport.requests import AuthorizedSession
HAS_GOOGLE_LIBRARIES = True
except ImportError:
HAS_GOOGLE_LIBRARIES = False
from ansible.module_utils.basic import AnsibleModule, env_fallback
from ansible.module_utils.six import string_types
from ansible.module_utils._text import to_text, to_native
def navigate_hash(source, path, default=None):
if not source:
return None
key = path[0]
path = path[1:]
if key not in source:
return default
result = source[key]
if path:
return navigate_hash(result, path, default)
return result
class GcpRequestException(Exception):
pass
def remove_nones_from_dict(obj):
new_obj = {}
for key in obj:
value = obj[key]
if value is not None and value != {} and value != []:
new_obj[key] = value
# Blank dictionaries should return None or GCP API may complain.
if not new_obj:
return None
return new_obj
# Handles the replacement of dicts with values -> the needed value for GCP API
def replace_resource_dict(item, value):
if isinstance(item, list):
items = []
for i in item:
items.append(replace_resource_dict(i, value))
return items
if not item:
return item
return item.get(value)
# Handles all authentication and HTTP sessions for GCP API calls.
class GcpSession(object):
def __init__(self, module, product):
self.module = module
self.product = product
self._validate()
def get(self, url, body=None, **kwargs):
"""
This method should be avoided in favor of full_get
"""
kwargs.update({'json': body})
return self.full_get(url, **kwargs)
def post(self, url, body=None, headers=None, **kwargs):
"""
This method should be avoided in favor of full_post
"""
kwargs.update({'json': body, 'headers': headers})
return self.full_post(url, **kwargs)
def post_contents(self, url, file_contents=None, headers=None, **kwargs):
"""
This method should be avoided in favor of full_post
"""
kwargs.update({'data': file_contents, 'headers': headers})
return self.full_post(url, **kwargs)
def delete(self, url, body=None):
"""
This method should be avoided in favor of full_delete
"""
kwargs = {'json': body}
return self.full_delete(url, **kwargs)
def put(self, url, body=None, params=None):
"""
This method should be avoided in favor of full_put
"""
kwargs = {'json': body}
return self.full_put(url, params=params, **kwargs)
def patch(self, url, body=None, **kwargs):
"""
This method should be avoided in favor of full_patch
"""
kwargs.update({'json': body})
return self.full_patch(url, **kwargs)
def list(self, url, callback, params=None, array_name='items',
pageToken='nextPageToken', **kwargs):
"""
This should be used for calling the GCP list APIs. It will return
an array of items
This takes a callback to a `return_if_object(module, response)`
function that will decode the response + return a dictionary. Some
modules handle the decode + error processing differently, so we should
defer to the module to handle this.
"""
resp = callback(self.module, self.full_get(url, params, **kwargs))
items = resp.get(array_name) if resp.get(array_name) else []
while resp.get(pageToken):
if params:
params['pageToken'] = resp.get(pageToken)
else:
params = {'pageToken': resp[pageToken]}
resp = callback(self.module, self.full_get(url, params, **kwargs))
if resp.get(array_name):
items = items + resp.get(array_name)
return items
# The following methods fully mimic the requests API and should be used.
def full_get(self, url, params=None, **kwargs):
kwargs['headers'] = self._set_headers(kwargs.get('headers'))
try:
return self.session().get(url, params=params, **kwargs)
except getattr(requests.exceptions, 'RequestException') as inst:
# Only log the message to avoid logging any sensitive info.
self.module.fail_json(msg=inst.message)
def full_post(self, url, data=None, json=None, **kwargs):
kwargs['headers'] = self._set_headers(kwargs.get('headers'))
try:
return self.session().post(url, data=data, json=json, **kwargs)
except getattr(requests.exceptions, 'RequestException') as inst:
self.module.fail_json(msg=inst.message)
def full_put(self, url, data=None, **kwargs):
kwargs['headers'] = self._set_headers(kwargs.get('headers'))
try:
return self.session().put(url, data=data, **kwargs)
except getattr(requests.exceptions, 'RequestException') as inst:
self.module.fail_json(msg=inst.message)
def full_patch(self, url, data=None, **kwargs):
kwargs['headers'] = self._set_headers(kwargs.get('headers'))
try:
return self.session().patch(url, data=data, **kwargs)
except getattr(requests.exceptions, 'RequestException') as inst:
self.module.fail_json(msg=inst.message)
def full_delete(self, url, **kwargs):
kwargs['headers'] = self._set_headers(kwargs.get('headers'))
try:
return self.session().delete(url, **kwargs)
except getattr(requests.exceptions, 'RequestException') as inst:
self.module.fail_json(msg=inst.message)
def _set_headers(self, headers):
if headers:
return self._merge_dictionaries(headers, self._headers())
return self._headers()
def session(self):
return AuthorizedSession(
self._credentials())
def _validate(self):
if not HAS_REQUESTS:
self.module.fail_json(msg="Please install the requests library")
if not HAS_GOOGLE_LIBRARIES:
self.module.fail_json(msg="Please install the google-auth library")
if self.module.params.get('service_account_email') is not None and self.module.params['auth_kind'] != 'machineaccount':
self.module.fail_json(
msg="Service Account Email only works with Machine Account-based authentication"
)
if (self.module.params.get('service_account_file') is not None or
self.module.params.get('service_account_contents') is not None) and self.module.params['auth_kind'] != 'serviceaccount':
self.module.fail_json(
msg="Service Account File only works with Service Account-based authentication"
)
def _credentials(self):
cred_type = self.module.params['auth_kind']
if cred_type == 'application':
credentials, project_id = google.auth.default(scopes=self.module.params['scopes'])
return credentials
if cred_type == 'serviceaccount' and self.module.params.get('service_account_file'):
path = os.path.realpath(os.path.expanduser(self.module.params['service_account_file']))
if not os.path.exists(path):
self.module.fail_json(
msg="Unable to find service_account_file at '%s'" % path
)
return service_account.Credentials.from_service_account_file(path).with_scopes(self.module.params['scopes'])
if cred_type == 'serviceaccount' and self.module.params.get('service_account_contents'):
try:
cred = json.loads(self.module.params.get('service_account_contents'))
except json.decoder.JSONDecodeError as e:
self.module.fail_json(
msg="Unable to decode service_account_contents as JSON"
)
return service_account.Credentials.from_service_account_info(cred).with_scopes(self.module.params['scopes'])
if cred_type == 'machineaccount':
return google.auth.compute_engine.Credentials(
self.module.params['service_account_email'])
self.module.fail_json(msg="Credential type '%s' not implemented" % cred_type)
def _headers(self):
user_agent = "Google-Ansible-MM-{0}".format(self.product)
if self.module.params.get('env_type'):
user_agent = "{0}-{1}".format(user_agent, self.module.params.get('env_type'))
return {
'User-Agent': user_agent
}
def _merge_dictionaries(self, a, b):
new = a.copy()
new.update(b)
return new
class GcpModule(AnsibleModule):
def __init__(self, *args, **kwargs):
arg_spec = kwargs.get('argument_spec', {})
kwargs['argument_spec'] = self._merge_dictionaries(
arg_spec,
dict(
project=dict(
required=False,
type='str',
fallback=(env_fallback, ['GCP_PROJECT'])),
auth_kind=dict(
required=True,
fallback=(env_fallback, ['GCP_AUTH_KIND']),
choices=['machineaccount', 'serviceaccount', 'application'],
type='str'),
service_account_email=dict(
required=False,
fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_EMAIL']),
type='str'),
service_account_file=dict(
required=False,
fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_FILE']),
type='path'),
service_account_contents=dict(
required=False,
fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_CONTENTS']),
no_log=True,
type='jsonarg'),
scopes=dict(
required=False,
fallback=(env_fallback, ['GCP_SCOPES']),
type='list',
elements='str'),
env_type=dict(
required=False,
fallback=(env_fallback, ['GCP_ENV_TYPE']),
type='str')
)
)
mutual = kwargs.get('mutually_exclusive', [])
kwargs['mutually_exclusive'] = mutual.append(
['service_account_email', 'service_account_file', 'service_account_contents']
)
AnsibleModule.__init__(self, *args, **kwargs)
def raise_for_status(self, response):
try:
response.raise_for_status()
except getattr(requests.exceptions, 'RequestException') as inst:
self.fail_json(
msg="GCP returned error: %s" % response.json(),
request={
"url": response.request.url,
"body": response.request.body,
"method": response.request.method,
}
)
def _merge_dictionaries(self, a, b):
new = a.copy()
new.update(b)
return new
# This class does difference checking according to a set of GCP-specific rules.
# This will be primarily used for checking dictionaries.
# In an equivalence check, the left-hand dictionary will be the request and
# the right-hand side will be the response.
# Rules:
# Extra keys in response will be ignored.
# Ordering of lists does not matter.
# - exception: lists of dictionaries are
# assumed to be in sorted order.
class GcpRequest(object):
def __init__(self, request):
self.request = request
def __eq__(self, other):
return not self.difference(other)
def __ne__(self, other):
return not self.__eq__(other)
# Returns the difference between a request + response.
# While this is used under the hood for __eq__ and __ne__,
# it is useful for debugging.
def difference(self, response):
return self._compare_value(self.request, response.request)
def _compare_dicts(self, req_dict, resp_dict):
difference = {}
for key in req_dict:
if resp_dict.get(key):
difference[key] = self._compare_value(req_dict.get(key), resp_dict.get(key))
# Remove all empty values from difference.
sanitized_difference = {}
for key in difference:
if difference[key]:
sanitized_difference[key] = difference[key]
return sanitized_difference
# Takes in two lists and compares them.
# All things in the list should be identical (even if a dictionary)
def _compare_lists(self, req_list, resp_list):
# Have to convert each thing over to unicode.
# Python doesn't handle equality checks between unicode + non-unicode well.
difference = []
new_req_list = self._convert_value(req_list)
new_resp_list = self._convert_value(resp_list)
# We have to compare each thing in the request to every other thing
# in the response.
# This is because the request value will be a subset of the response value.
# The assumption is that these lists will be small enough that it won't
# be a performance burden.
for req_item in new_req_list:
found_item = False
for resp_item in new_resp_list:
# Looking for a None value here.
if not self._compare_value(req_item, resp_item):
found_item = True
if not found_item:
difference.append(req_item)
difference2 = []
for value in difference:
if value:
difference2.append(value)
return difference2
# Compare two values of arbitrary types.
def _compare_value(self, req_value, resp_value):
diff = None
# If a None is found, a difference does not exist.
# Only differing values matter.
if not resp_value:
return None
# Can assume non-None types at this point.
try:
if isinstance(req_value, list):
diff = self._compare_lists(req_value, resp_value)
elif isinstance(req_value, dict):
diff = self._compare_dicts(req_value, resp_value)
elif isinstance(req_value, bool):
diff = self._compare_boolean(req_value, resp_value)
# Always use to_text values to avoid unicode issues.
elif to_text(req_value) != to_text(resp_value):
diff = req_value
# to_text may throw UnicodeErrors.
# These errors shouldn't crash Ansible and should be hidden.
except UnicodeError:
pass
return diff
# Compare two boolean values.
def _compare_boolean(self, req_value, resp_value):
try:
# Both True
if req_value and isinstance(resp_value, bool) and resp_value:
return None
# Value1 True, resp_value 'true'
if req_value and to_text(resp_value) == 'true':
return None
# Both False
if not req_value and isinstance(resp_value, bool) and not resp_value:
return None
# Value1 False, resp_value 'false'
if not req_value and to_text(resp_value) == 'false':
return None
return resp_value
# to_text may throw UnicodeErrors.
# These errors shouldn't crash Ansible and should be hidden.
except UnicodeError:
return None
# Python (2 esp.) doesn't do comparisons between unicode + non-unicode well.
# This leads to a lot of false positives when diffing values.
# The Ansible to_text() function is meant to get all strings
# into a standard format.
def _convert_value(self, value):
if isinstance(value, list):
new_list = []
for item in value:
new_list.append(self._convert_value(item))
return new_list
if isinstance(value, dict):
new_dict = {}
for key in value:
new_dict[key] = self._convert_value(value[key])
return new_dict
return to_text(value)

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