444 Commits

Author SHA1 Message Date
Sagi Shnaidman
e0458dd1a6 Remove obsolete secret from stable branch
Change-Id: Ia323aab30a148c089dabb64c738d0b9cbde7e20f
2024-12-17 22:56:05 +02:00
Sagi Shnaidman
f448ac258d Linter and CI tasks fixes
Change-Id: I0bcd30fc21de7838094b992cecc3a0e850c4da3a
2024-12-17 22:17:48 +02:00
Jakob Meng
e4be201f20 Properly documented openstacksdk version requirements
With "extends_documentation_fragment: ['openstack.cloud.openstack']"
it is not necessary to list required Python libraries in section
'requirements' of DOCUMENTATION docstring in modules. Ansible will
merge requirements from doc fragments and DOCUMENTATION docstring
which previously resulted in duplicates such as in server module [0]:

* openstacksdk
* openstacksdk >= 0.36, < 0.99.0
* python >= 3.6

When removing the 'requirements' section from server module, then
Ansible will list openstacksdk once only:

* openstacksdk >= 0.36, < 0.99.0
* python >= 3.6

To see what documentation Ansible will produce for server module run:

  ansible-doc --type module openstack.cloud.server

[0] https://docs.ansible.com/ansible/latest/collections/openstack/\
    cloud/server_module.html

Change-Id: Ia53c2c34436c7a72080602f5699e82d20f677b8b
2023-01-16 13:52:45 +01:00
Jakob Meng
bc16f70e1d Removed TripleO related Zuul CI jobs
TripleO jobs are no longer monitored.

Change-Id: Ibbc1323818225ce05b5f3492247450dc68ec0bc4
2023-01-15 19:43:58 +01:00
Jakob Meng
dec8ecda5a Refactored coe_cluster{,_template} modules
Change-Id: I209b242b43d8b79740752cd2c405705d247326c4
(cherry picked from commit 647ffef375)
2023-01-11 15:09:27 +01:00
Jakob Meng
dd383c010c Fixed docs
Change-Id: I33953e9293a2ef2715bfcf076a262c474da40dc3
(cherry picked from commit 122afc170c)
2023-01-10 16:13:26 +01:00
Jakob Meng
acd0f01443 Updated docs
Co-Authored-By: Sagi Shnaidman <sshnaidm@redhat.com>

Change-Id: Ib94adb1c6d6237800db13b3cc243e0897aa6a49f
(cherry picked from commit 7d9de2858a)
2023-01-10 14:18:44 +01:00
Jakob Meng
a4260040c6 Improved compatibility with both tox>3,<4 and tox>=4
Tox>3,<4 does not support dots in generative envlists and tox>=4 changed
its behaviour when it detects hyphens in env names [1].

[1] 0580121601/src/tox/tox_env/python/api.py (L130)

Change-Id: I63ad716415755d2a140a6ade97d22bd18236a0df
(cherry picked from commit 7945d7f01a)
2022-12-30 17:01:49 +01:00
Jakob Meng
ef5b217411 Moved Octavia image upload and CirrOS image identification to Ansible
Change-Id: Ief843310ce57a2d1062d86c54cd7ad6e0f705b68
(cherry picked from commit 85fa2bb2b6)
2022-12-14 18:27:48 +01:00
Jakob Meng
6592363c7c Refactored ci script with shellcheck suggestions and install collections
Change-Id: I071e50eadfaf0f17f413a0c5f86e5d6b96356b36
(cherry picked from commit 4e1718db49)
2022-12-14 15:30:43 +01:00
Jakob Meng
922032cb9f Dropped obsolete module templates
Module templates have little benefit because
* they are not documented anywhere,
* their structure is not suitable for our modules, hence not a
  single module is written according to the templates,
* contributers better base their own modules on existing modules
  because we have modules for most OpenStack components,
* they are outdated, e.g. normalizing is a relict of
  openstacksdk<0.99.0 and results,
* they are bloated, e.g. *_info module is doing preliminary checks
  and creating filters in separate functions which proved in other
  modules to be much better readable when inlined,
* they are hard to understand, e.g. argument_spec definition is
  a huge Jinja2 template which does nothing except for copying
  arguments from one place to another,
* they are not tested.

Change-Id: I460b75c09a361e712bbfb002c1ad1d03b3dff8ee
(cherry picked from commit 133af96666)
2022-12-14 15:26:08 +01:00
Jakob Meng
a11943d9b1 Renamed image->image_name and flavor->flavor_name to avoid collisions
Change-Id: I09a133b5c4f6c71e10d274be1c70b7edcce1c83c
(cherry picked from commit a8f6dbd904)
2022-12-14 15:24:10 +01:00
Jakob Meng
84160f6f78 Allow external commands in tox and use non-master branches on older releases
Co-Authored-By: Ghanshyam Mann <gmann@ghanshyammann.com>

Change-Id: I76e0fc0e574d791e8f4d83ccc22289fa06360709
(cherry picked from commit 94c150b2e7)
2022-12-14 15:23:08 +01:00
Jakob Meng
1b03f918ac Release 1.10.0 version
Change-Id: Ia5c6809d820865fd477d6956707a195ab672f069
2022-10-04 11:07:23 +02:00
Vladimir Hasko
c435002734 Add SDK logging option for openstack ansible collections.
The solution is based on implementation of logging option
in Open Telekom Cloud collections.

Change-Id: Ie8b309d2aaa8da57794888848fc5414de207e54f
(cherry picked from commit 19cd6262cf)
2022-09-30 10:44:53 +02:00
Jakob Meng
e8bba38e2e Ensure openstacksdk compatibility in inventory plugin
Story: 2010337
Task: 46470
Change-Id: Ieb624b76627b5127d7a6c4d95233bbd5c2f16182
2022-09-29 20:47:04 +02:00
Jakob Meng
058bd87f2a Lowered maximum OpenStack SDK version to 0.98.999 in inventory plugin
Story: 2010337
Task: 46470
Change-Id: I873b41b85fee3035e35972e7d90048b6ac3722b2
2022-09-29 19:11:33 +02:00
Sagi Shnaidman
7772bf125d Don't use deprecated distutils from python 3.10
distutils is deprecated in 3.10: https://peps.python.org/pep-0632/
Ansible requires it to be replaced[1]

[1] https://github.com/ansible-community/community-topics/issues/96
https://github.com/ansible-collections/news-for-maintainers/issues/18

Change-Id: I2bae37f206319e8f9ace468f5b94f6be643b6a3c
(cherry picked from commit ccbbc319ce)
2022-09-28 10:28:21 +00:00
Sagi Shnaidman
17e78e5173 Use Python 3.10 for Ansible's devel branch
Use Python 3.10 on Ubuntu 22.04 LTS (Jammy Jellyfish)
for Ansible 2.14 branch, since it supports Python from 3.9 now.
https://docs.ansible.com/ansible/devel/roadmap/ROADMAP_2_14.html
Change-Id: Ib20feb82729fe0b641aafa9c8b92060b1d85f9c9
(cherry picked from commit 515cc66287)
2022-09-20 09:50:50 +00:00
Jakob Meng
0e9a6f26c2 Release 1.9.1 version
Change-Id: I2d53fb4ef05c916f38482bd694a1b42d30d3d1d5
2022-09-08 14:05:36 +02:00
Jakob Meng
8dfcd17731 Do not remove trailing spaces when reading public key in keypair module
Previously, openstack.cloud.keypair would remove trailing spaces after
reading a public key from a file. The openstack cli tool, python-\
openstackclient, does not do so, i.e. it does not use rstrip to remove
spaces at the end [1]. This breaks idempotency when using openstack
cli tool and our keypair module at the same time.

The rstrip code was introduced to keypair when our modules were still
part of ansible (non-core) in a completely unrelated change [2].

Now, keypair module does no longer alter the public key and instead
uploads it unchanged to OpenStack API.

[1] 7df94c9f82/openstackclient/compute/v2/keypair.py (L103)
[2] 341efbf7ae

Story: 2008574
Task: 41726
Change-Id: Ia09658467d98516ca1ea612e7301629b2f69d2d1
(cherry picked from commit 73827a3d57)
2022-09-07 14:04:48 +00:00
Sagi Shnaidman
39bb4909ee Fix release job
include_vars works on the controller only, use loading facts
to get variables from galaxy.yml
Change-Id: Idf45354650dea93bd8bdbfa9fa2ba52abda93cc0
2022-08-27 02:08:06 +03:00
Jakob Meng
ce60e71bde Release 1.9.0 version
Change-Id: I50bfae762f4e3f0f5de41db749942b8bdb51f5fd
Signed-off-by: Jakob Meng <code@jakobmeng.de>
2022-08-25 10:49:00 +02:00
Jakob Meng
b579d03968 Fixed code violating Flake8 rule E275
assert [1] is a Python keyword hence Flake8 raised an error:
"E275 missing whitespace after keyword" [2].

[1] https://docs.python.org/3/reference/lexical_analysis.html#keywords
[2] https://www.flake8rules.com/rules/E275.html

Change-Id: I76bbe10b850c38a3fbb38c4a2f5ee17ca5b91b4e
(cherry picked from commit 1bf22feb2d)
2022-08-01 15:03:32 +00:00
Jakob Meng
8743f24c4b Refactored TripleO jobs
Added a note that we do not have to build the RPM of the Ansible
OpenStack collection from source because TripleO Quickstart installs
the collection from job.required-projects [1]. The latter shadows the
RPM release which is installed later by TripleO because it has a
higher precedence in ansible.cfg [2][3].

Changed the job hierarchy to base jobs tripleo-ci-centos-8-\
standalone-build and tripleo-ci-centos-9-standalone-build. This reduces
the number of variables we have to define. In particular, variables
containers_base_image, build_container_images and featureset will be
inherited from parent jobs. The CentOS9 jobs are no longer based on
the CentOS8 job which prevents issues with job variant collections
due to our branched repository.

Added more Ansible modules to files which trigger TripleO jobs,
because Ansible role os_tempest [4] requires those modules and is
called in TripleO jobs. Modules which have been added include:
* openstack.cloud.compute_flavor
* openstack.cloud.image
* openstack.cloud.network
* openstack.cloud.router
* openstack.cloud.subnet

Dropped tripleo-ci-centos-9-standalone-osa from check jobs because the
master branch of TripleO C9 will have the OpenStack SDK 1.x.x release
series only which requires the master branch of the Ansible OpenStack
collection. The only RDO branches with openstacksdk <0.99.0 which will
be maintained longterm are C8 Train, C8 Wallaby and C9 Wallaby.

Dropped TripleO job based on C8 Train from check and periodic and moved
it to experimental. It is unlikely that C8 Train will receive updates
for Ansible OpenStack collection.

[1] cb1595223b/quickstart.sh (L123)
[2] cb1595223b/ansible.cfg (L19)
[3] cb1595223b/quickstart.sh (L595)
[4] https://opendev.org/openstack/openstack-ansible-os_tempest.git

Change-Id: Ibde318678a3e44fdc297a6f29761eb0c7d77cbc9
(cherry picked from commit fc2dda1d86)
2022-07-19 10:28:23 +02:00
Arx Cruz
7a9837dfb5 Backport improvements to endpoint module
- Adds endpoint tests
- Update docs

Change-Id: Ibd647d0c2cd2f90310f381e56088e7e8e93f76fc
(cherry picked from commit 452404ee87)
2022-07-12 10:33:50 +02:00
Arx Cruz
26b53e78b2 Backport improvements to catalog_service
- Adds tests
- Update docs
- Add option aliases

This patch do the following:

* Update catalog_service to use new openstacksdk
* Add catalog_service role to test catalog_service module

Change-Id: I6778f5e91cb0ead63cede28af0111d7ffbbf3ab1
(cherry picked from commit 7c7e61d36b)
2022-07-07 11:35:40 +00:00
Arx Cruz
b8c2310963 Backport improvements to role_assignment
- Refactor module

Change-Id: I09258e18d50acb57501ea1b47d9422dad857607e
(cherry picked from commit 8d5195fdf2)
2022-07-07 06:43:33 +00:00
anbanerj
915a78d7af Backport improvements to keypair_info
- Updates docs
- Improves test coverage

Change-Id: I09c75717a620272904b023179c726a19c4bca000
(cherry picked from commit 595f7d1093)
2022-07-06 15:19:50 +02:00
Dmitriy Rabotyagov
60c39d495f Make publish_collection more universal
With this change we replace zuul.projects with zuul.project that will
imply any project which will run the job. Also we read galaxy.yml as
vars file to predict packed collection naming for futher upload.

Change-Id: I66e27f3026689ad719384203fe66d65f5bca46ce
Needed-By: https://review.opendev.org/c/openstack/ansible-config_template/+/846391
(cherry picked from commit 8f27184f30)
2022-06-27 07:11:54 +00:00
Jakob Meng
2052a47324 Applied workaround in CI for issue #78017 in ansible-core
Module ansible.builtin.user in ansible-core 2.13.0 and 2.13.1 is
affected by #78017 [1] which results in an exception being raised
in ci/roles/keypair/tasks/main.yml [2]. Until this issue is fixed,
we will exclude the broken versions 2.13.0 and 2.13.1 in
requirements.txt [3].

[1] https://github.com/ansible/ansible/issues/78017
[2] 802e46d554/ci/roles/keypair/tasks/main.yml (L72)
[3] https://opendev.org/openstack/ansible-collections-openstack/src/branch/master/tests/requirements.txt

Change-Id: I61bec4e62ecbcf357f3c1279a7373049077cb8d4
Signed-off-by: Jakob Meng <code@jakobmeng.de>
(cherry picked from commit c6c1c6a070)
2022-06-26 14:31:18 +00:00
Zuul
3ecd3b6e64 Merge "Backport improvements to recordset module" into stable/1.0.0 2022-06-17 01:20:56 +00:00
Rafael Castillo
c4a296c07c Backport improvements to recordset module
- General refactoring of module
- Move recordset specific tests from the dns role to new recordset role
- Adds additional tests to recordset role

Note that this is not a clean cherry pick due to sdk changes

Change-Id: If8fda40780050d271c9d869d8959ef569644fd88
(cherry picked from commit 97b05533f1)
2022-06-16 13:41:44 -07:00
Rafael Castillo
6b58d28a4e Backport enhancements to host_aggregate module
- Update the module to return an aggregate object
- Adds a role to test the module

Note that this is not a clean cherry pick as it excludes changes related
to new sdk compatibility.

Change-Id: I6a98ba8466863b41fc996855fd12cf9f3097abe0
(cherry picked from commit 4ea2c5b50d)
2022-06-02 12:45:01 +02:00
Jakob Meng
620956c61d Changed our DevStack based Zuul CI jobs to voting
Keep jobs with devel branch of Ansible non-voting to prevent
Ansible from blocking our Zuul CI gates.

Change-Id: Iba427d1852e56aaafc394c8265d3d1f28ca9574b
2022-06-01 20:50:10 +02:00
Jakob Meng
970fb2489c Warn users about us breaking backward compatibility
Change-Id: I7a2867329f65af6330abccb1954bf49b92cd8721
(cherry picked from commit dee39a71b6)
2022-05-27 14:54:28 +02:00
Jakob Meng
8cc678acc1 Use bifrost's stable/yoga branch for jobs with OpenStack SDK 0.x.x
Bifrost's master branch installs the latest OpenStack SDK from PyPI
which currently is the first release candidate (0.99.0) of the
upcoming first major release of OpenStack SDK 1.0.0. Jobs on our
stable/1.0.0 branch are compatible with older releases of OpenStack SDK
only. This patch does checkout stable/yoga branch of Bifrost which
installs a sufficiently old release of OpenStack SDK due to
opendev.org/openstack/requirements/upper-constraints.txt.

Change-Id: I49a7b50aee45197d9309d959ff49e763f370619b
2022-05-27 09:38:18 +02:00
Jakob Meng
75558c5c2e Lowered maximum OpenStack SDK version to 0.98.999
Alongside OpenStack SDK 1.0.0 we will release a new collection version
2.0.0 which is compatible to OpenStack SDK 1.x.x series only. Code in
branch stable/1.0.0 will remain compatible to OpenStack SDK 0.x.x
series only. Release candidates for the first major release of
OpenStackSDK 1.x.x will be numbered using 0.99.x versions.

At Ansible OpenStack modules PTG on 2022-04-07 it was decided to raise
an error if one is using a incompatible releases of the OpenStack SDK
with our collection. We decided against showing warnings only because
they can be missed easily and functionality  will be broken but
probably hardly detectable when using the wrong SDK.

This patch caps the maximum required SDK versions to 0.98.999, so
that an error will be raised when users try to use our collection with
an incompatible SDK release, e.g. use code from our stable/1.0.0 branch
with a OpenStack SDK 0.99.x or 1.x.x release.

Change-Id: Ic077f7a906698025edf20acf22c7a5c6caa8734a
2022-05-24 14:47:34 +02:00
Jakob Meng
b4bde6af5c Updated pip constraints for release candidates of OpenStackSDK's first major release
A release candidate for the first major release of OpenStackSDK 1.x.x
has been published with version number 0.99.0. Release candidates will
be numbered using 0.99.x versions.

Ref.: https://meetings.opendev.org/irclogs/%23openstack-release/%23openstack-release.2022-05-19.log.html

Change-Id: I51a5b803f6646d3b1c5e198072cb3da19925fc3f
(cherry picked from commit c7ae7a5f98)
2022-05-24 10:36:23 +02:00
Jakob Meng
b935f21f44 Changed TripleO jobs to use correct release files
Commit bc27851617 [1] in opendev.org/openstack/tripleo-ci changed the
release filename for periodic jobs to promotion-testing-hash-*.yml [2]
instead of using e.g. train.yml for OpenStack Train based releases [3].
Due to this change, container images were not pulled from the local
image registry but from trunk.registry.rdoproject.org instead [2]. This
caused our periodic jobs to fail during container image build because
when using a local registry a different namespace prefix "openstack"
(instead of *-binary such as centos-binary) is used which is not valid
on trunk.registry.rdoproject.org.

As a workaround, we force TripleO jobs to run as check jobs, no matter
what pipeline they run in [4].

Thanks to Sandeep Yadav <sandyada@redhat.com> for discovering the root
cause of this issue and providing a workaround!

Ref.:
[1] bc27851617
[2] https://github.com/openstack/tripleo-quickstart/blob/master/config/release/tripleo-ci/CentOS-8/promotion-testing-hash-train.yml#L7
[3] https://github.com/openstack/tripleo-quickstart/blob/master/config/release/tripleo-ci/CentOS-8/train.yml
[4] https://opendev.org/openstack/tripleo-ci/src/branch/master/roles/ci-common-vars/vars/main.yaml#L24

Change-Id: Ib7d8fc9e6781e43e04f0a9feee261b9f3f29e1fe
(cherry picked from commit 4db7a6238b)
2022-05-11 13:24:29 +00:00
Jakob Meng
3c047406dc Backported changes to identity_group_info from master branch
Added ci integration tests and updated return value documentation.
Reverted function calls which would break backward compatibility
with previous collection releases.

Change-Id: I24e64c9455618952ee612d7413882f0ac022189f
(cherry picked from commit a6805cd019)
2022-05-11 10:43:20 +02:00
Jakob Meng
be8965c7fc Removed Zuul CI job for OpenStack Queens
Change-Id: I2884a74fe5f8ae6b4f141bba935e432a09c94c52
2022-05-11 06:53:04 +00:00
Jan Horstmann
acf64a1f72 Set owner in image module
Previously the owner field was not set by module
`cloud.openstack.image`, although it is specified as a module parameter.
The usual approach in `ansible-collections-openstack` is to accept both
names and IDs when referencing openstack resources.
Therefore this commit follows the approach taken by
`python-openstackclient` in [1] and introduces a `project` and a
`project_domain` parameter to identify projects by name or ID and
assign the ID to the `owner` attribute of the image.
The `owner` parameter is left as an alias to `project` in the module.

Story: 2009983
Task: 45012

[1]
cf2de9af79

Change-Id: I3654587df8e40d554aac5126df307961f335332c
2022-05-10 13:47:33 +02:00
anbanerj
a4894337d4 Backported changes to image_info from master branch
Added ci integration tests, updated return value documentation and
refactored to simplify code. Reverted changes such as function calls
and return values which would break backward compatibility with
previous collection releases.

Change-Id: Ibf934568f069c305747fc24fbb22ce3fc095286c
(cherry picked from commit c1a9794207)
2022-05-10 10:00:48 +02:00
Jakob Meng
0b0a80796f Backported changes to identity_role_info from master branch
Added ci integration tests, updated return value documentation and
refactored to simplify code.

Change-Id: If8a1145a31d685d41367383930e6fd08d64c6ae8
(cherry picked from commit 1d22a94a90)
2022-05-09 17:05:18 +02:00
Jakob Meng
c63ff6fbc8 Backported changes to identity_domain_info from master branch
Added ci integration tests and updated return value documentation.
Reverted function calls which would break backward compatibility
with previous collection releases.

Change-Id: Ic7915fd3334266783ea5e9d442ef304fa734ca00
(cherry picked from commit b31fdf8320)
2022-05-09 13:25:27 +02:00
Jakob Meng
4f8f6ffaf4 Backported changes to identity_user from master branch
Renamed ci integration tests to match module name, updated return
value documentation and refactored to simplify code. The module will
no longer fail if no password is supplied since it is perfectly fine
to create a user with an password. Reverted function calls which
would break backward compatibility with previous collection
releases.

Change-Id: I97ee9b626f269abde3be7b2b9211d2bb5b7b3c26
(cherry picked from commit fd1b9fc0d2)
2022-05-06 14:28:34 +02:00
Jakob Meng
0204bbeede Backported changes to identity_user_info from master branch
Added ci integration tests and updated return value documentation.
Reverted function calls which would break backward compatibility
with previous collection releases.

Change-Id: I99e98a529ce74ff2ca77a67d09f188228e6a0e37
(cherry picked from commit 2df07f3523)
2022-05-05 13:14:09 +02:00
Jakob Meng
5626a8d4c9 Removed job definitions for master branch
Previously, all job definitions where shared across each .zuul.yaml in
both branches. When a job definition was changed in one branch, Zuul CI
could pick the job definition from the other branch, which was not
intended.

The problem arises when mixing explicit job.branches matchers with
implicit branch matching, when defining same jobs on multiple branches.
Zuul CI expects that jobs to be defined in one or the other branch, not
both at the same time. One should only use job.branches matchers from
single-branched projects, e.g. trusted config repos. When defining jobs
in branched repositories one selects which job definition to use by the
branch associated with the triggering event instead.
Each trigger has a branch associated with it, whether it is the branch
targeted by the change being proposed, the branch to which a commit
merged, a branch attached to a timer trigger etc. This branch name is
searched across involved projects in order to determine what job
definition should be used.

The job.branches directive is rarely applied to a job which will be
copied to multiple branches. When you have multiple copies of a job
with the job.branches attribute, Zuul CI could pick any of the job
definitions which might not be the one you expected.
The job.branches attribute is useful in single branch config
repositories where a specific job definition has to be applied to a
specific branch of the repository. Another definition of the job
will exist in another branch of the config repository.

This patch removes job definitions which are specific to other
branches, except for parent jobs which are shared across branches.

Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: Idb12d9eef9116a19b1323b2ce45ef672ae4a4f5e
2022-05-04 15:21:35 +02:00
Rafael Castillo
a3bb143f34 Sychronize updates to identity_role from master branch
Rename ci role to match the module name. Reverted function calls
which would break backward compatibility with previous collection
releases.

Change-Id: Ie59da441d39fe2d0e49430662d853bc9628181e0
(cherry picked from commit cc1b5ecae8)
2022-05-04 09:21:32 +02:00
Jakob Meng
9c16ee4df3 Fixed return values in compute_service_info module again
OpenStack SDK 0.53 added parameters is_forced_down and updated_at
in openstack/compute/v2/service.py, hence our compute_service_info
module will return different values depending on which release of
the OpenStack SDK is used.

Ref.: 5450c45253

Change-Id: I4b055266555cb91681d0ab6edcaa850e061f3afb
(cherry picked from commit 4a7330364e)
2022-05-03 07:41:08 +00:00
Jakob Meng
a70a4c3424 Fixed return value disable{d,s}_reason in compute_service_info module
OpenStack SDK 0.53 renamed parameter disables_reason to disabled_reason
in openstack/compute/v2/service.py, hence our compute_service_info
module will return different values depending on which release of
the OpenStack SDK is used.

Ref.: 5450c45253

Change-Id: I1c0f787f7f67c92f92dd106fc8d55580461e4aa3
(cherry picked from commit cf5007d478)
2022-05-02 12:30:33 +00:00
Jakob Meng
708ed756ca Temporarily run passing tests in our Zuul CI jobs only
With merging the code for 1.0.0 of OpenStack SDK into the master branch
several of our modules and CI tests broke. To be able to merge patches
we had to set most of our jobs to non-voting, so atm we do not have a
good code coverage in Zuul CI.

This patch temporarily skips broken tests so that we can set our jobs
back to voting and get some basic code coverage from CI. Follow up
patches which fix modules are supposed to readd skipped tests on
occasion.

Change-Id: Ice42d0bdc12c24227a323ad9c5d3fd33870975c4
(cherry picked from commit c10cc9dd8c)
2022-04-28 13:46:06 +00:00
Jakob Meng
c83884e5c8 Changed our Zuul CI *-octavia job to non-voting
Our *-octavia jobs pull OpenStack SDK from PyPI and PyPI is still
serving the 0.x.x series of the SDK because 1.0.0 has not been
released yet. A recent commit bb25330ddc [1][2] broke compatibility
to older SDK releases prior to 1.0.0 and since then our *-octavia
job on our master branch is failing.

Ref.:
[1] https://review.opendev.org/c/openstack/ansible-collections-openstack/+/839033
[2] bb25330ddc

Change-Id: I4bacc358cca08a71694c590202066c8565a96f02
(cherry picked from commit 3ead86904a)
2022-04-28 11:17:05 +00:00
Jakob Meng
655ed21ffa Restricted galaxy-importer script to Python 3.6+
Ansible Galaxy content importer is using format strings [1] which
are supported since Python 3.6. Our Zuul CI job for OpenStack Queens
uses Ubuntu 16.04 LTS (Xenial Xerus) as its base image which has
Python 3.5 only.

Ref.:
[1] b7140d6b3b/galaxy_importer/main.py (L117)

Change-Id: I5d3b2f71937a0e4ab9a8d49df10744f7d95a7de2
(cherry picked from commit 9f60f0f26d)
2022-04-28 08:34:57 +00:00
Jakob Meng
e64211213a Constrain filters in compute_service_info to SDK >= 0.53.0
Older releases of OpenStack SDK do not support filtering services.

Change-Id: I613c76b8f794ea2024939e07250a50edc5b9e49a
(cherry picked from commit e85a0b809a)
2022-04-28 05:49:47 +00:00
Jakob Meng
39676b664a Removed object tags from ci role server
Tag object was introduced to server role in commit c8a5be6b30 [1] to
allow skipping server tests when volumes are not available.

Whenever tag object is specified, Ansible will run those three tasks
in role server. But as our server module has not been ported to
OpenStack SDK 1.0.0 series it will fail even if someone only wants to
test our object ci role.

This patch removes all occurrences of the object tag in the ci server
role. Since it is not used anywhere in our code it will not break ci.

Ref.:
[1] c8a5be6b30

Change-Id: I222fac499c9a3cb16c4581fb4347170a4d97f833
(cherry picked from commit bba1da17c9)
2022-04-27 18:12:01 +00:00
Jakob Meng
220f2b7dca Added support for specifying a maximum version of the OpenStack SDK
Alongside OpenStack SDK 1.0.0 we will release a new collection version
2.0.0 which is compatible to OpenStack SDK 1.x.x series only. Code in
branch stable/1.0.0 will remain compatible to OpenStack SDK 0.x.x
series only.

At Ansible OpenStack modules PTG on 2022-04-07 it was decided to raise
an error if one is using a incompatible releases of the OpenStack SDK
with our collection. We decided against showing warnings only because
they can be missed easily and functionality  will be broken but
probably hardly detectable when using the wrong SDK.

This patch implements the code to raise errors when users are trying
to use our collection with an incompatible SDK release, e.g. use code
from our stable/1.0.0 branch with a OpenStack SDK 1.x.x release.

It does not yet change the minimum and maximum required SDK versions
because OpenStack SDK 1.0.0 has not yet been released to PyPI and
SDK's master branch still does not return a 1.x.x version number.

Change-Id: I1052d21cf8f108dbc99619cd4c4072488645b855
(cherry picked from commit bc6622e0e7)
2022-04-27 09:45:55 +00:00
Jakob Meng
0af7a252bd Use Rocky release of Heat in Queens job
The oldest branch in Heat repository is stable/rocky. Previously,
Zuul CI would use the master branch of Heat since it could not find
stable/queens branch but master branch has incompatibilities with
our Queens job.

Change-Id: Iaeca759cad641d4923fc63489fd65f57d9f1345a
(cherry picked from commit e869564e3c)
2022-04-27 08:12:10 +00:00
Arx Cruz
e8f9457893 Move dns zone info to use proxy layer
Make it compatible with new SDK.
Although this one was already using self.con.dns.zones to retrieve the
zones, it wasn't using the to_dict(computed=False) and was still
removing the location (which is obsolate when you use to_dict.

Change-Id: Ie2a5b772acc0c8c8338f6f1da877564a077e3b7a
(cherry picked from commit 0c6e8bed69)
2022-04-26 15:07:46 +02:00
Jakob Meng
29831685d8 Follow up to bump of minimum required OpenStack SDK release to SDK 0.36.0 (Train)
Commit 879270aa47 [1] bumped the required minimum SDK release
but missed to update two locations in code and docs.

Ref.:
[1] 879270aa47

Change-Id: I725a26b07484619f6f2c460e974821f81d60b153
(cherry picked from commit 5a43bdb873)
2022-04-26 11:53:05 +02:00
Jesper Schmitz Mouridsen
82311440b5 Support description in sg-rule creation
Change-Id: I7800a91682b143b29c30e97661e057c6c41f4663
Signed-off-by: Jesper Schmitz Mouridsen <jesper@schmitz.computer>
(cherry picked from commit ecf4897a55)
2022-04-26 11:50:23 +02:00
Jakob Meng
57012cbaa3 Drop username from return values of identity_user_info
Users would have a non-null username only with Identity API v2 which
was available in Keystone of OpenStack Pike. Identity API v2 has been
removed since OpenStack Queens [1].

Function search_users() from OpenStack SDK still returns the username
attribute because of [2][3] but it will always be None since
Keystone's API does not return username since OpenStack Pike.

[1] https://docs.openstack.org/releasenotes/keystone/queens.html
[2] 975cabbdd8/openstack/cloud/_utils.py (L246)
[3] 76b081efe4

Change-Id: I2054dd55662698dabd0f2b3565c31dcd3bf24e5a
(cherry picked from commit 5fc8fca06b)
2022-04-21 10:36:46 +00:00
Jakob Meng
5b453c62d1 Dropped broken linter job openstack-tox-linters-ansible-2.9
Running older linter releases while we have a more up to date
Ansible 2.12 based linter does not provide value and thus wastes
ci resources. Our Ansible 2.9 based linter is broken atm and since
it is EOL soon anyway we drop this job. We still have a linter job
based on the last stable release and one based on Ansible's
devel branch.

Our tox environment for Ansible 2.9 will be dropped in a later
patch once all Ansible 2.9 based jobs have been removed.

Change-Id: I9cd3f729b06516bbd9a3c7985b65fcf294c8bdd7
(cherry picked from commit f09cccdb9e)
2022-04-21 09:34:20 +00:00
Jakob Meng
8e1f1d6475 Temporarily set job openstack-tox-linters-ansible-2.9 to non-voting
Python module rstcheck which is used by ansible-test deprecated
Python versions prior 3.7 in version 3.5.0 and removed support
in 4.0.0 [1]. Ubuntu 18.04 LTS (Bionic Beaver) comes with Python
3.6 by default, so rstcheck prints a FutureWarning which confuses
ansible-test:

  Run command: ***/python -m rstcheck --report warning
  --ignore-substitutions _,br,release,today,version
  docs/openstack_guidelines.rst
  Traceback (most recent call last):
    File "***/ansible-test", line 28, in <module>
      main()
    File "***/ansible-test", line 24, in main
      cli_main()
    File "***/ansible_test/_internal/cli.py", line 130, in main
      args.func(config)
    File "***/ansible_test/_internal/sanity/__init__.py", line 193,
    in command_sanity
      result = test.test(args, sanity_targets, version)
    File "***/ansible_test/_internal/sanity/rstcheck.py", line 80,
    in test
      results = parse_to_list_of_dict(pattern, stderr)
    File "***/ansible_test/_internal/util.py", line 799, in
    parse_to_list_of_dict
      raise Exception('Pattern "%s" did not match values:\n%s' %
      (pattern, '\n'.join(unmatched)))
  Exception: Pattern "^(?P<path>[^:]*):(?P<line>[0-9]+):
  \((?P<level>INFO|WARNING|ERROR|SEVERE)/[0-4]\) (?P<message>.*)$"
  did not match values:
  ***/rstcheck.py:51: FutureWarning: Python versions prior 3.7 are
  deprecated. Please update your python version.
    FutureWarning
  ERROR: Command "/usr/bin/env ANSIBLE_TEST_CONTENT_ROOT=***/
  ansible_collections/openstack/cloud LC_ALL=en_US.UTF-8 ***/python3.6
  ***/ansible-test sanity -v --python 3.6 --skip-test
  metaclass-boilerplate --skip-test future-import-boilerplate plugins/
  docs/ meta/ scripts/ --metadata ***.json --truncate 0 --redact
  --color no --requirements" returned exit status 1.

We cannot constrain the version of rstcheck which ansible-test installs
into its Python virtual environment. This has to be fixed in Ansible
itself, a pull request against Ansible 2.9 has been opened [2].

Ref.:
[1] https://github.com/myint/rstcheck/blob/master/README.rst
[2] https://github.com/ansible/ansible/pull/77568

As a workaround we temporarily set our Ubuntu 18.04 based linter job
openstack-tox-linters-ansible-2.9 to non-voting and remove it from
check dependencies and as a gate job.

Thanks to Arx Cruz and Jesper Schmitz Mouridsen for pointing out this
issue and its root cause ☺️

Change-Id: Ic6f2febc5a40a29534ac4c7f41f714865099086a
(cherry picked from commit 2bf82c2669)
2022-04-20 07:04:58 +00:00
Arx Cruz
4b9e2295e0 Fix logic in routers_info
The list of fixed ips on the routers info was wrong, adding only the
last one instead of the all of them.

Change-Id: I0bb352ea1845d25cff3aeae507aa55ba473b0a45
2022-04-12 18:47:13 +00:00
Sagi Shnaidman
5bb8312171 Release 1.8.0 version
Change-Id: Id5dbee79e2df9a0bd0185d649cbcbf5c0e288178
2022-04-08 12:30:59 +03:00
Jakob Meng
b3ac841442 Dropped deprecated return values in floating_ip_info and assert remaining fields
Attributes such as location and tenant_id are computed by OpenStack
SDK. We do not return these fields in floating_ip_info because e.g.
tenant_id has been marked as deprecated and is a copy of the
project_id field.

Ref.: 70a06d9990

Added an assertion to CI which checks that all advertised fields
are returned by floating_ip_info. This helps with detecting breaking
changes in future updates.

Change-Id: I62e4681cd57f82054f68efe1dc59be2cca118135
2022-04-06 07:58:46 +00:00
Arx Cruz
37c52c321d Changed compute_flavor_info module to use OpenStack SDK's proxy layer
We still return computed values here to keep backward compatibility.

Change-Id: Idad13228efe55b2dd35224cc37c61657590f9b8e
2022-04-05 13:46:15 +02:00
Arx Cruz
6edc70f965 Updated return value docs of compute_service_info module
We still return computed values here to keep backward compatibility.

Change-Id: I11af9486a6a284d1756380548fca22435c43765a
2022-04-04 11:33:06 +02:00
Jakob Meng
cc8cd08c03 Fixed Ansible branch in base job openstack-tox-linters-ansible
Ansible's git repository has no master branch but a devel and several
stable-* branches instead.

Change-Id: I43844c8a1cefceb7337e5a6ff1e8b8df451efb26
2022-04-04 10:28:25 +02:00
Ümit Seren
b572bf8ae9 Add subnet pool module
Change-Id: Ib8b5481a1e257490f2a9ff62659a70ea2e920304
2022-03-31 20:05:11 +00:00
Gaudenz Steinlin
b3e0d610ea Add 'all_projects' to server_action module
This allows to execute actions on servers outside of the current auth
scoped project if the user has permission to do so.

Change-Id: Ifb3f40973a76ad8c57bcbcbcb8e73c917681096b
2022-03-31 12:18:09 +00:00
Jakob Meng
291e8b8640 Refactored tox requirements for different Ansible releases
Sorted pip requirements file to improve readability.

Moved pip requirements for tests into tests subdirectory and dropped
'pip-' prefix to shorten filenames and conform with common naming
scheme for pip requirements files.

Added constrains on OpenStack SDK 1.*.* to job ansible-collections-\
openstack-functional-devstack-releases on master branch because only
stable/1.0.0 branch is compatible to the OpenStack SDK 0.*.* series.

Changed job ansible-collections-openstack-functional-devstack-releases
on master branch to non-voting because OpenStack SDK 1.*.* has not
been released to PyPI yet, so tests on master branch are expected to
fail once we introduce breaking changes from stable/1.0.0 branch.

Change-Id: I6b6bb8c6900f7c8341bbf3f9a24999fbf693ba4b
2022-03-31 10:19:50 +02:00
Sagi Shnaidman
f70a50e363 Fix ansible-lint issues for newest version
Change-Id: I8238b5d5e49c2a4a8ed3228de23349092c9e1220
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2022-03-29 18:51:01 +00:00
Jakob Meng
befcc4353d Reenabled check-import.sh which tests imports to Ansible Galaxy
Reverted commit 1f3417cdef [1] which disabled check-import.sh script.
Python module galaxy_importer will return a non-zero return value on
errors since commit 4f5fd0f29c [2].

Use galaxy-importer 0.3.1 for Ansible 2.9 and galaxy-importer 0.3.2
for later Ansible releases because galaxy-importer moved from ansible
2.9 to ansible-core 2.11 in 0.3.2 [3].

Ref.:
[1] 1f3417cdef
[2] 4f5fd0f29c
[3] 9893354783

Change-Id: I898149727d80cd7effe6a04ca77a13ef1774e781
2022-03-29 15:20:17 +02:00
Jakob Meng
8a91352a38 Added job variants for stable/1.0.0 branch to Zuul CI config
Releases of OpenStack SDK on PyPI will soon switch to the 1.*.* series
which our stable/1.0.0 branch is incompatible with. Previously, in
commit 0f532d10f3, several jobs have been changed to run on master
branch only.

This patch adds siblings jobs for our stable/1.0.0 branch which
pull the latest SDK releases of the 0.*.* series from PyPI instead.

Ref.: 0f532d10f3

Change-Id: Iefc6acfa4c25eb5d9ab062a3bfa655be2188cb77
2022-03-29 09:29:51 +02:00
Jakob Meng
1d7fd25ac0 Set Zuul CI job for OpenStack Train to voting
Job *-train-ansible-2.11 failed since commit 031475d42e because that
patch caused most jobs to install the latest Python packages of
OpenStack SDK and other requirements from PyPI to tox' virtualenv
instead of respecting the override-checkout keywords and using
releases of OpenStack Train. Commit 87858ab976 and its follow ups
has fixed this issue.

Ref.:
031475d42e
87858ab976

Change-Id: Ib12e6195db9bb232735ea5a785ccc88bc749ea17
2022-03-28 13:44:36 +02:00
Jakob Meng
44fa06cba1 Fixed job hierarchy for Zuul CI
Added a parent job *-functional-devstack-base which defines basic job
attributes such as job.required-projects. It does not restrict branches
because else Zuul would not find a matching parent job variant during
job freeze when child jobs are on other branches. It does not define
attributes job.override-checkout and job.required-projects.override-\
checkout because else Zuul would use this branch when matching variants
for parent jobs during job freeze.

Jobs *-devstack-{xena,wallaby,train}-ansible-2.{11,12} have been
changed to inherit from *-devstack-base instead of *-devstack-ansible-\
2.{11,12}. The latter do not run for branch stable/1.0.0 which caused
Zuul to dismiss the *-devstack-{xena,wallaby,train}-ansible-2.{11,12}
when collecting parent job variants during job freeze:
The previous parent jobs *-devstack-ansible-2.{11,12} set job.branches
to master so Zuul cannot match that job when it collects job variants
and thus would ignore the child jobs.

Likewise, jobs *-devstack-{xena,wallaby,train}-ansible-2.{11,12} cannot
inherit from any parent job which sets job.required-projects.override-\
checkout on openstack/devstack because Zuul would use that git ref
instead of stable branch defined below to checkout projects of parent
devstack jobs when collecting variants for parent jobs.

Added a warning to the beginning of .zuul.yaml to keep this file in
sync between branches to avoid issues e.g. with job scheduling. Zuul CI
will search in master branch first when collecting job variants during
job freeze which can have unwanted side effects. For example, when
parent job *-base has been changed in stable/1.0.0 branch, Zuul could
still use *-base variants from master branch during job freeze on child
jobs such as *-ussuri-ansible-2.11 etc.

Change-Id: I3ca4ed5795c45a5565a374f04a1ddb29816bf114
2022-03-28 10:50:22 +02:00
Jakob Meng
26bc8a0666 Synchronized galaxy.yml and galaxy.yml.in files
Change-Id: Ic93a0d1f93e2d86358085c7442ad73d52b9a55ba
2022-03-25 16:01:40 +01:00
Jakob Meng
19d0562551 Fixed branch matching for parent jobs when on stable/1.0.0 branch
When a patch is submitted against a branch, Zuul CI will collect job
variants for each ci job and all its parent jobs. If both job.\
override-checkout and job.required-projects.override-checkout
attributes are not defined, then Zuul will for each (parent) job match
the current branch of the patch against all branches of the project in
which the job is defined. If no such branch exist in a project, then no
job variant matches and this job will be ignored [1].
For example, if a patch is submitted for our stable/1.0.0 branch, then
Zuul CI will try to match 'stable/1.0.0' against all branches in the
projects where job ansible-collections-openstack-functional-devstack
and its parent job openstacksdk-functional-devstack are defined. The
first is defined in openstack/ansible-collections-openstack/.zuul.yaml,
so a match for stable/1.0.0 will be found. But openstacksdk-functional-\
devstack is defined in openstack/openstacksdk/.zuul.yaml which has no
branch stable/1.0.0 defined. So Zuul will not schedule job ansible-\
collections-openstack-functional-devstack at all.

The solution is twofold. First, the base jobs such as ansible-\
collections-openstack-functional-devstack have to be changed to always
checkout existing branches in projects which define (parent) jobs.
Using job.override-checkout might have unintended sideeffects because
it will checkout the specified branch for all required projects which
also includes the project which the patch was submitted for. Instead
we set job.required-projects.override-checkout for all projects which
define parent jobs. For example, in ansible-collections-openstack-\
functional-devstack we set job.required-projects.override-checkout to
master for opendev.org/openstack/devstack which defines parent job
openstack-functional-devstack.

In child jobs which (re)define job.override-checkout, we have to change
job.required-projects.override-checkout for all projects which define
parent jobs to the value of job.override-checkout. If we fail to update
job.required-projects.override-checkout then Zuul will checkout the
branch which was defined in the base jobs because job.\
required-projects.override-checkout has higher precedence than job.\
override-checkout.

Setting attribute project.<pipeline>.debug to true helps with debugging
these job scheduling issues. "If this is set to true, Zuul will include
debugging information in reports it makes about items in the pipeline.
This should not normally be set, but in situations were it is difficult
to determine why Zuul did or did not run a certain job, the additional
information this provides may help" [2].

Note, once job scheduling has been completed, Zuul will use a different
algorithm to checkout projects which are listed in job.\
required-projects [3][4]. It will fallback to a default branch if no
matching branch can be found in projects [5].

Ref.:
[1] https://opendev.org/zuul/zuul/src/branch/master/zuul/model.py#L6996
[2] https://zuul-ci.org/docs/zuul/latest/config/project.html#attr-project.%3Cpipeline%3E.debug
[3] https://zuul-ci.org/docs/zuul/latest/job-content.html#git-repositories
[4] https://opendev.org/zuul/zuul/src/branch/master/zuul/executor/server.py#L1648
[5] https://zuul-ci.org/docs/zuul/latest/config/project.html#attr-project.default-branch

Change-Id: I31f9607ab7e2e2ae8534429da7f5e5f235560c56
2022-03-24 14:33:27 +00:00
Jakob Meng
07c3ed0c17 Changed jobs against master branch of OpenStack SDK to non-voting
Our collection has not been ported to the new OpenStack SDK 1.* yet.
Until the migration has been completed successfully, we have to set
all jobs which use the master branch of the SDK to non-voting.

Change-Id: I8fbf568ab87360bf34125dbf1d939c075d3764ae
(cherry picked from commit 5b53433348)
2022-03-24 12:57:29 +00:00
Jakob Meng
8708167b5f Run jobs for older OpenStack releases on stable/1.0.0 branch only
OpenStack SDK 0.* releases, from OpenStack Zed and earlier, are only
supported by our stable/1.0.0 branch. Our master branch does not
support old SDK releases anymore, so we restrict Zuul CI jobs
which run older OpenStack releases to patches against our
stable/1.0.0 branch.

Change-Id: I45bf5f90ba2265ab3b9faab77b75babf693b52bb
2022-03-24 11:10:16 +01:00
Kevin Carter
a9565779b5 Fixed job hierarchy in Zuul CI configuration
Reparented ansible-collections-openstack-functional-devstack-{xena,\
wallaby,train}-ansible-2.{11,12} jobs from ansible-collections-\
openstack-functional-devstack-ansible-devel to corresponding ansible-\
collections-openstack-functional-devstack-ansible-2.{9,11,12} jobs
because the previous inheritance hierarchy had no benefits.

The new hierarchy has been straightened, i.e. redundant voting
overrides have been removed and jobs now properly inherit variables
such as tox_envlist and required projects such as github.com/ansible/\
ansible for the specified ansible releases.

Change-Id: I33addad110f4f15ec56dfea0fd18954c55d24b82
Signed-off-by: Kevin Carter <kecarter@redhat.com>
Signed-off-by: Jakob Meng <code@jakobmeng.de>
2022-03-24 10:43:02 +01:00
Jakob Meng
5c2069c47d Run tripleo*{train,wallaby}-osa jobs on stable/1.0.0 branch only
Our master branch is compatible to OpenStack SDK 1.* releases only,
while our stable/1.0.0 branch works with OpenStack SDK 0.* releases
only. Users of train or wallaby branches of TripleO will use packages
which are provided by RDO and we will pin them to our stable/1.0.0
anyway. Using OpenStack SDK 1.* from PyPI with TripleO train/wallaby
is not supported.

Change-Id: Ia6bcd3809e2a63ec9c11db4eeeca837839c9c0a9
2022-03-22 14:08:19 +01:00
Jakob Meng
583df2a8a9 Dropped inherited variable tox_install_siblings
Change-Id: I9f67c404d1b0ae23daf527b373f196ab17efc9a3
2022-03-22 12:11:33 +01:00
Jakob Meng
0f532d10f3 Run *-releases job on master branch only
Latest releases of OpenStack SDK will soon be 1.* versioned which
our stable/1.0.0 branch is incompatible with. We will have to add
a siblings job for *-releases later which pulls the latest release
of the 0.* series of the OpenStack SDK and runs on commits for our
stable/1.0.0 branch.

Change-Id: I77f6730e8c9e5840be460795a17c9d48aeecccd0
2022-03-22 11:40:56 +01:00
Jakob Meng
87858ab976 Fixed python packages in tox virtualenvs
Reverted commit 031475d42e which changed tox_install_siblings to
false in base job ansible-collections-openstack-functional-devstack.
This caused most jobs to install the latest Python packages of
OpenStack SDK and other requirements from PyPI to tox' virtualenv
instead of respecting the override-checkout keywords.

Ref.: 031475d42e

Change-Id: Ide693ef95c613454e1cfb2ee1880793a49f6524e
2022-03-22 11:25:51 +01:00
Jakob Meng
09c3e4bdc9 Run *-octavia job on master branch only
Latest releases of OpenStack SDK will soon be 1.* versioned which
our stable/1.0.0 branch is incompatible with. We will have to add
a siblings job for octavia later which pulls the latest release
of the 0.* series of the OpenStack SDK and runs on commits for our
stable/1.0.0 branch.

Change-Id: I8cfc7cf609d10ff96a03ae7f1f407ee0ec2da20c
2022-03-22 10:54:33 +01:00
Jakob Meng
ebffbe4fe8 Disable jobs against master branch of OpenStack SDK on stable/1.0.0 branch
Run Zuul jobs which test against the master branch of OpenStack SDK
only for commits on our master branch because branch stable/1.0.0 is
compatible only to OpenStack SDK 0.* releases.

Change-Id: I35849df166f3f36f4e3e2870ccd8d5fe9e33e50f
2022-03-22 09:11:40 +01:00
anbanerj
cbcfce2e23 Remove old, unsupported parameters from documentation in image_info module
This patch removes "deleted" and "deleted_at" from the doc in image_info module.
These params were never returned since image_info started using openstacksdk.

Change-Id: Id5aa9164bacf7808fd21235bd7327569344295ab
2022-03-18 10:57:44 +00:00
Will Szumski
406558dae9 Handle aggregate host list set to None
A freshly created host aggregate can have the host list set to None,
consequently you'd hit:

```
failed: [localhost] (item={'name': 'gpu', 'hosts': [], 'metadata': {'type': 'gpu'}}) => {"ansible_loop_var": "item", "changed": false, "item": {"hosts": [], "metadata": {"type": "gpu"}, "name": "gpu"}, "module_stderr": "Traceback (most recent call last):\n  File \"/var/lib/home/stackhpc/.ansible/tmp/ansible-tmp-1642696576.6728637-1456290-187052400642084/Ansiba
llZ_host_aggregate.py\", line 100, in <module>\n    _ansiballz_main()\n  File \"/var/lib/home/stackhpc/.ansible/tmp/ansible-tmp-1642696576.6728637-1456290-187052400642084/AnsiballZ_host_aggregate.py\", line 92, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/var/lib/home/stackhpc/.ansible/tmp/ansible-tmp-1642696576.672
8637-1456290-187052400642084/AnsiballZ_host_aggregate.py\", line 41, in invoke_module\n    run_name='__main__', alter_sys=True)\n  File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, p
kg_name, script_name)\n  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_os_nova_host_aggregate_payload_qwjtdtjj/ansible_os_nova_host_aggregate_payload.zip/ansible_collections/openstack/cloud/plugins/modules/host_aggregate.py\", line 214, in <module>\n  File \"/tmp/ansible_os_nova_host_aggregate
_payload_qwjtdtjj/ansible_os_nova_host_aggregate_payload.zip/ansible_collections/openstack/cloud/plugins/modules/host_aggregate.py\", line 210, in main\n  File \"/tmp/ansible_os_nova_host_aggregate_payload_qwjtdtjj/ansible_os_nova_host_aggregate_payload.zip/ansible_collections/openstack/cloud/plugins/module_utils/openstack.py\", line 407, in __call__\n  File \
"/tmp/ansible_os_nova_host_aggregate_payload_qwjtdtjj/ansible_os_nova_host_aggregate_payload.zip/ansible_collections/openstack/cloud/plugins/modules/host_aggregate.py\", line 176, in run\n  File \"/tmp/ansible_os_nova_host_aggregate_payload_qwjtdtjj/ansible_os_nova_host_aggregate_payload.zip/ansible_collections/openstack/cloud/plugins/modules/host_aggregate.py
\", line 138, in _update_hosts\nTypeError: 'NoneType' object is not iterable\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
```

I've not investigated which API and library combinations elict this
behaviour, but it does seem to occur. We can safely handle this
possibility in backwards compatible way.

It is possible to workaround this issue by invoking the module a second
time.

Change-Id: Ie14391f18c0f65833d00a4b4f6b1b314a0903d2b
2022-03-18 07:59:56 +00:00
Zuul
c8d89f81a5 Merge "Fix assertion after stack deletion" into stable/1.0.0 2022-03-14 13:40:30 +00:00
Jakob Meng
c0e1f56894 Fix assertion after stack deletion
After a stack has been removed with module stack, a call to module
stack_info might still return this stack with its status set to
'DELETE_COMPLETE' and its status_reason defined as 'Stack DELETE
completed successfully'.

Change-Id: Ice843c403669b4a4e1b12ec73db1fb00d1405980
2022-03-14 10:03:17 +00:00
Jan Weiher
a031968f80 Router: Remove unneeded 'filter' parameter
Change-Id: If46916e3480fced3be919c6d39b82a6c64321065
2022-03-14 08:31:31 +00:00
Jakob Meng
2e78559cc1 Bumped minimum required OpenStack SDK release to SDK 0.36.0 (Train)
For example, to_dict's computed parameter is available since
SDK 0.18 (Stein) only.

Overview on OpenStack SDK versions in various distributions:
* ArchLinux has SDK 0.59.0
* CentOS 7 has SDK 0.36 (Train)
* CentOS 8 has SDK 0.36 (Train), SDK 0.46 (Ussuri),
  SDK 0.50 (Victoria) and SDK 0.55 (Wallaby)
* Debian 10 (Buster) has SDK 0.17.2 and Ansible 2.7.7 which
  does not support Ansible collections anyway. Debian's
  buster-backports repository has Ansible 2.9.16 but backports
  are provided on an as-is basis, with risk of incompatibilities.
* Debian 11 (Bullseye) has SDK 0.50.0
* Ubuntu 18.04 LTS has SDK 0.11.3 which is not supported by
  this collection since the lowest supported version so far
  is 0.13
* Ubuntu 20.04 LTS has SDK 0.46.0
* Red Hat OpenStack (RHOSP) 16.0-16.2 have SDK 0.36 (Train)

Change-Id: I45d3c05c2ec983993aacc7414213b394b59f5552
2022-03-10 13:17:08 +00:00
Jakob Meng
bf939a4ce0 Release 1.7.2 version
Primary reason for this new release is to fix the mess we did yesterday
when we accidentially merged release 1.7.1 and all changes from the
stable branch into the master branch. This release 1.7.2 does not really
change anything except fixing the guidelines.

Change-Id: I1ad23bd36746a180f8851df294df4e01213bdf2f
2022-03-10 11:43:44 +01:00
Jakob Meng
24d6f36602 Release 1.7.1 version
Change-Id: I958ba6890a54c59e0ccdb9249d959c745acfb8e9
(cherry picked from commit b640e6207c)
2022-03-10 08:47:36 +00:00
Sagi Shnaidman
dd9cdde3d8 Fix docs for openstack fragment
Change-Id: I7fef01dbd11137e26d3ff0bd0088dc405559b272
2022-03-09 20:33:32 +00:00
Zuul
da4a68c188 Merge "Remove new SDK job from stable/1.0.0 CI" into stable/1.0.0 2022-03-09 17:45:08 +00:00
Zuul
a7a190f3c0 Merge "Fix inventory plugin doc for new ansible" into stable/1.0.0 2022-03-09 17:45:07 +00:00
Sagi Shnaidman
ce73c9db34 Remove new SDK job from stable/1.0.0 CI
Change-Id: I04b45ec3dea19f3223929237cdbae702886a9982
2022-03-09 18:54:28 +02:00
Jan Weiher
0e102b1411 [LB] Add support for setting monitor_address
Change-Id: I4897c6343813519859bd19fa162829fe2a6dc573
(cherry picked from commit 37a51ec6ad)
2022-03-09 14:06:29 +00:00
Sagi Shnaidman
9f58d54721 Fix inventory plugin doc for new ansible
Change-Id: I8bd8767d2ac0117e03c9b23882494d45847b15cf
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
(cherry picked from commit 3c7a8f39a2)
2022-03-09 14:06:03 +00:00
Sagi Shnaidman
79d7827d17 Run jobs on stable branch
Disable temporarly train job since it fails.
Change-Id: I012b03fd8c9158a2280691f00304e5f013f045f6
2022-02-23 23:07:02 +02:00
Piotr Parczewski
ba9aa9967f Fix os_quota docs
Change-Id: Ic2717669d0e9e8bb48bb7ed81fd5f5f55928fa55
2022-02-16 14:48:52 +02:00
Sagi Shnaidman
617e8fb552 Release 1.7.0 version
Change-Id: Ic09e1bb4b072c79de8af6036afae5f99f63042c0
2022-02-15 12:56:31 +02:00
Sagi Shnaidman
5abf89d805 Add CentOS 9 wallaby and master
Change-Id: I7cf0014ea51cb42daa039d435fe65a58de35f4ff
2022-02-15 11:50:59 +02:00
Sagi Shnaidman
0599d05103 Add CentOS 9 tripleo job
Change-Id: Id7e6836e228ae9874e71b61c1cacaf4e10d3bda7
2022-02-14 18:42:00 +02:00
Zuul
9c28af7d12 Merge "Adds use_name variable" 2022-02-13 12:09:57 +00:00
Alex Hussey
bcb5d18492 Adds use_name variable
This commit adds the ability to specify whether the ansible_host and
ansible_ssh_host variables should use 'name' inplace of 'interface_ip'.

The primary use case for this, is if you want to access hosts using
the instance name defined in OpenStack instead of the floating IP.
This is usually when using a jump/bastion host.

Implements: use_names
Change-Id: I809cca0f27f16b37cb9c1c18121f468ccf5c805c
2022-02-10 21:44:38 +11:00
Sagi Shnaidman
7aa626377b Remove project properties tests and support
Keystone project doesn't have project "properties" documented and
discourage users to use them. Remove support for this feature and
tests for it. It was removed from new SDK as well.

Change-Id: I2e47ade56c3df5945e991d11d70f429760c0d852
2022-02-10 12:05:17 +02:00
Harald Jensås
0a7889b9a2 Add openstack.cloud.baremetal_port module
Create, Update, Remove ironic ports from OpenStack.

NOTE: Does not support 'is_smart_nic', afict this is
      not implemented in openstacksdk.

Change-Id: I6d9519988e98b10d0f7bd19b1387fb1f3b657046
2022-02-09 23:41:19 +01:00
Harald Jensås
a1b920742f Add openstack.cloud.baremetal_port_info module
Retrieve information about Bare Metal ports from OpenStack

NOTE: Does not support 'is_smart_nic', afict this is
      not implemented in openstacksdk.

Change-Id: I1d57ab976ac3b4c5552b9b21db7e90e25fd71764
2022-02-09 14:23:01 +01:00
Zuul
bd55e1f905 Merge "Add openstack.cloud.baremetal_node_info" 2022-02-09 09:48:57 +00:00
Harald Jensås
20329c0329 Add openstack.cloud.baremetal_node_info
Add module baremetal_node_info / os_ironic_info.
Retrieve information about Bare Metal nodes from OpenStack

Change-Id: I597a66b817bb6b53ecad7503e44f6818aec031a2
2022-02-03 20:23:13 +01:00
Sagi Shnaidman
bdf472a53f Move identity domain to use proxy layer
Make it compatible with new SDK and fix bug with "enabled"

Change-Id: I1f577fae27c24c257571d1cf90e49527470edace
2022-02-02 19:35:37 +02:00
Sagi Shnaidman
b7fb23b097 Add zuul artifact
Change-Id: I01a4b1bf8347461f47316f8b9e3571262cb080cc
2022-01-30 20:42:17 +02:00
Sagi Shnaidman
6ed02eff2d Write tests log to a separate file
Change-Id: I18649c24cb048c4ef5dbab85272975dad7584cd1
2022-01-27 15:53:38 +02:00
Zuul
cb396cf03d Merge "Add dns_[name,domain] to the port module" 2022-01-26 12:56:10 +00:00
hamza alqtaishat
20c2633ea3 Add dns_[name,domain] to the port module
The dns-integration extension adds the dns_name and dns_domain attributes
with this change updated/set operations can be done on those attributes

Change-Id: I4bb0f8692dec3fba5ab50f07571029f374761a5b
2022-01-25 22:51:38 +00:00
Sagi Shnaidman
6569e07023 Add new SDK job non-voting
Change-Id: I9cb89573cb0b6c206016c44b1261971586a57105
2022-01-25 21:00:51 +02:00
Sagi Shnaidman
031475d42e Fix CI for new openstack SDK
Change-Id: I14ced5861cac0656f8b2096a166a45f770d2bf35
2022-01-25 12:39:31 +02:00
Ivan ROGER
5e2ab3d8c3 Fix identity user lookup with a domain
Task: 44308
Story: 2009790
Change-Id: I3bc99ebdf8bc915d7b1ae5e98230058a3f43223f
2022-01-18 15:39:32 +01:00
Sagi Shnaidman
f3b12fed68 Release 1.6.0 version
Change-Id: Ia93e0c9ad892cafabfa43de1578800c099cb5804
2022-01-13 14:46:19 +02:00
Zuul
39a627d4a0 Merge "Add Neutron RBAC modules" 2022-01-12 11:13:53 +00:00
hamza alqtaishat
4eb7c43539 Add compute services list module
The module retrieve the nova compute services info
filters by
 * host
 * binary ( nova-compute, nova-conductor, ... )

Closes-Bug: 2009775
Change-Id: I0f9cac27a7a91727ba1d005e04431e8f83c46fa8
2022-01-11 17:14:54 +00:00
Ashraf Hasson
8c6d1041fa Add Neutron RBAC modules
Change-Id: Ibaff06561055c5cd024abb789dae075dd7871f08
2022-01-11 11:59:58 -05:00
Zuul
26530ac97b Merge "Leave queens job only in experimental" 2021-12-18 23:25:14 +00:00
Zuul
b3e07a1864 Merge "quota: Adds metadata_items parameter" 2021-12-18 23:18:44 +00:00
Sagi Shnaidman
94933250e8 Leave queens job only in experimental
Change-Id: Ibc77dfe72e972948c0b4b018c8f4b18dc7dec790
2021-12-18 22:23:24 +02:00
Pierre Riteau
1582956dcd Remove failing job from gate
Change-Id: I7920e99efd152c2f5a9839bdcbe96a14d6587688
2021-12-17 23:40:05 +01:00
Sagi Shnaidman
b1952e0c4b Replace victoria job by xena one
Move victoria job to experimental, add xena job to check/gate.
Change-Id: Ia0376bf253b9f0ce2f13222982e7e9b8582a93d6
2021-12-16 22:08:44 +02:00
Sagi Shnaidman
9cd6d2f69a Move queens job to experimental
Change-Id: I2df552e6fa98e642b9ccce891d730bb96dedb9a8
2021-12-16 21:56:30 +02:00
Will Szumski
86a57498e8 quota: Adds metadata_items parameter
This is used to set the maximum number of metadata items per instance.

Change-Id: Ib5b86126ec25e9e84436d7ee7f79e43e22637272
2021-12-16 18:59:40 +00:00
Zuul
15f73aa72e Merge "Release 1.5.3 version with bugfixes" 2021-11-11 12:44:09 +00:00
Zuul
22a7f516f3 Merge "server_volume: check specified server is found" 2021-11-11 12:44:07 +00:00
Sagi Shnaidman
de54be5ecd Release 1.5.3 version with bugfixes
Change-Id: I90f72c7ea5869331633ad655275722fdb69570aa
2021-11-11 13:58:54 +02:00
Baptiste Mille-Mathias
3f1a693bd6 server_volume: check specified server is found
... in order to fail nicely instead of throwing an exception.

Change-Id: I6d7f793b4058fdcaffd015724ae9b53aa21e5367
2021-11-11 11:11:45 +01:00
Sagi Shnaidman
8e87ad651f Don't require allowed_address_pairs for port
Port can miss allowed_address_pairs parameter.

Story: 2009192
Task: 43246
Resolves: rhbz#2021810

Change-Id: I8fcc19889eaaec6342c8d7910a55f06e98dbd368
2021-11-10 18:11:43 +02:00
Sagi Shnaidman
b2f3cf3210 Release 1.5.2 version
Change-Id: Id8eb73da64631e1f25b5febd8a9f6dbee9707476
2021-11-09 13:39:40 +02:00
Sagi Shnaidman
11c7cd23f8 Fix issue with same host and group names
When host and group name is the same, the inventory fails to run.
Use different method of adding host to inventory with this case.

Fixes rhbz#2017495
Change-Id: Iad288c3c11d0791be33b379554577eab8381b44d
2021-11-02 11:39:24 +02:00
Zuul
59d0e4c3a4 Merge "Flavor properties are not deleted on changes and id will stay" 2021-11-01 09:57:08 +00:00
Jiri Stransky
014665ddac Add documentation links to README.md
Change-Id: I04235d8485cf46038c979de799a9666429163fab
2021-10-25 13:32:04 +02:00
Sven Anders
21b70f6b9b Flavor properties are not deleted on changes and id will stay
Fixing a bug on compute_falvor that causes that extra_specs
are deleted and the id is changing when a property of the
falvor is changed.


Changing the id will cause that a server which is using the falvor is
afterwards not assigned to the falvor anymore.


Story: 2009260
Change-Id: If7cbce107ce99de79749359e257933e4247e3634
2021-10-07 05:14:58 +00:00
Zuul
ecaff2a798 Merge "Add client and member listener timeouts for persistence (Ex. SSH)" 2021-10-05 15:44:50 +00:00
Sagi Shnaidman
02e9e87964 Clean up the old jobs for rocky,stein,queens
And return voting to train job
Change-Id: I9e39b8a5862f2a93a12498e7dd5ea8e9b978fbb1
2021-10-05 13:47:25 +03:00
Sagi Shnaidman
980536c32e Move CI to use Ansible 2.12 version as main
Move only from victoria, since Ansible 2.12 is installed with
py > 3.8.
Remove ussuri from voting jobs, use it for experimental only.
Change-Id: I74b7272794ea5fbafb7d81a5cf0068c09130bb0d
2021-10-04 15:05:51 +03:00
Alexandru Verdes
a9a0d23441 Add client and member listener timeouts for persistence (Ex. SSH)
Add possibility to specify connection timeouts for SSH listeners.
These values are available in openstacksdk:
95ee95f52c/openstack/load_balancer/v2/listener.py (L89)

Change-Id: Ief1abd9018bb6dab73702cc416e5a916f8baa0d7
2021-10-01 09:17:55 +00:00
Zuul
011515de2d Merge "Added missing warn() used in cloud.openstack.quota" 2021-09-21 16:40:31 +00:00
Daniel Speichert
4292a00f75 Added missing warn() used in cloud.openstack.quota
Change-Id: Ic7ba09cb464049a9ce0db4bafdba30a67b4c8b86
2021-09-15 14:38:30 -04:00
Zuul
bbefa8c156 Merge "Don't run functional jobs on galaxy.yml change" 2021-09-02 14:41:19 +00:00
Sagi Shnaidman
b023aa337a Don't run functional jobs on galaxy.yml change
Change-Id: Ib736f927f448bd2d53cb7f3e3723a9bfc8ea3bf2
2021-09-02 13:45:44 +03:00
Sagi Shnaidman
c13f02fd54 Release 1.5.1 version
Change-Id: Ib87202496ed05a6d2717d13a787f389a9c8d1336
2021-09-02 12:44:20 +03:00
Sagi Shnaidman
ae4e7f3c06 Remove tests directory from ansible-tests
Because we don't include tests in collection tar.
Change-Id: I3697f7b0ccd115ff1859658417d51e1643e10be8
2021-08-16 16:06:10 +03:00
Sagi Shnaidman
2d554d1e22 Add support check mode for all info modules
As it's required by new ansible-test rules.
See https://github.com/ansible-collections/overview/issues/45#issuecomment-893543025
Change-Id: Ib6b73e810b972997b8de2b4a9eb8e07e246823d5
2021-08-16 15:56:27 +03:00
Sagi Shnaidman
770b283593 Reenable octavia job to vote
Add swap memory because octavia LB is killed by OOM killer.
Change-Id: I5cfb5b19cd2a11198a98993b86b8474310ee2cdc
2021-08-11 13:55:17 +03:00
Zuul
42921c6d9f Merge "Changed minversion in tox to 3.18.0" 2021-08-09 15:52:36 +00:00
likui
292aabb477 Changed minversion in tox to 3.18.0
The patch bumps min version of tox to 3.18.0 in order to
replace tox's whitelist_externals by allowlist_externals option:
https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23

Change-Id: Ia8700e03773398bc9347259bc504ae56c0978882
2021-08-09 20:08:27 +08:00
Jakob Meng
3a08a9c07c Allow to attach multiple floating ips to a server
OpenStack allows to attach multiple floating ips to a single server.
Previously, only one floating ip was supported by this module. It
would call openstacksdk's get_server_public_ip(), which in turn
would return just one of the attached floating ips. If this floating
ip would not point to the right nat_destination or fixed_address,
then the module would fail.

If no floating ip had been attached to a server, then this module
would call openstacksdk's add_ips_to_server() with both parameters
"floating_ip_address" and "network" to attach a floating ip to the
server. But both parameters are mutually exclusive [1], i.e.
add_ips_to_server() will ignore "floating_ip_address" if "network"
is set and then choose any non-attached floating ip from "network".
If "floating_ip_address" has not been created in OpenStack and
"network" is not given, then this module would not create this
floating ip [2].

The new module code allows to create and add more than one floating
ip to a server. It priorizes more specific parameters over generic
ones, i.e. if both "floating_ip_address" and "network" are given,
then "floating_ip_address" precedes "network".

Parameter "network" is now required if "floating_ip_address" is
specified, because both are necessary when creating floating ips.

Module documentation and args have been updated accordingly.

Ref.:
[1] a6b0ece282/openstack/cloud/_floating_ip.py (L987)
[2] a6b0ece282/openstack/cloud/_floating_ip.py (L907)

Task: 40939
Story: 2008181
Change-Id: I1ada1be0994f526f72f81f7458782afbcca3c92c
2021-08-06 15:02:20 +02:00
Jakob Meng
0e370b2c51 Only add or remove router interfaces when needed
Previously, when updating a router all its interfaces where removed and
readded by Ansible's os_router module. As a unwanted side effect all
active connections of the router and nat'ed devices where dropped,
closing e.g. all active tcp sessions. Now, only necessary changes
are applied.

Task: 40136
Story: 2007845
Change-Id: I172caf360e6e342dd54865da5a5b72b0dc0205c8
2021-08-03 13:22:13 +00:00
Sagi Shnaidman
0441403c42 Run ansible devel sanity tests on py38
And fix some module typos.
Disable voting for octavia jobs till investigation.
Change-Id: Ie4cb69aa2337b0f951ac194cf456e4515dbc24fb
2021-08-03 01:32:31 +03:00
Sagi Shnaidman
4160888887 Reenable ansible 2.11 linters job
After PR fix[1] was merged, reenable 2.11 job.

[1] https://github.com/ansible/ansible/pull/75358
Change-Id: Ida493c4316b682c3c2664bbe48c8dffc72f6ac8c
2021-07-30 09:07:17 +03:00
Sagi Shnaidman
07374a1f0d Add mandatory requires_ansible version to metadata
Disable ansible-test since it's broken in 2.11[1]

[1] https://github.com/ansible/ansible/issues/75353
Change-Id: Idd2f99ddfe507b5b02de206c1f8c75692d6a84a2
2021-07-29 17:05:11 +03:00
Sagi Shnaidman
8a395a04cf Remove semver check from release job
Jinja in Zuul Ansible version doesn't support semver key for versions.
Change-Id: I8bf9aa17e18f9b6d2c8e307f4368d1cea3362cb5
2021-07-29 10:20:32 +03:00
Zuul
441a61fd8c Merge "Change the pipeline of releasing to tag pipeline" 2021-07-28 23:14:40 +00:00
Sagi Shnaidman
c05b1fdbaf Change the pipeline of releasing to tag pipeline
Because zuul pre-release pipeline is pep400 compliant, but no
semver compliant, we can't push pre-release tags. Galaxy expects
from tags to be pure semver (not pep440).
Change the pipeline to be 'tag' and be triggered by any tag.

Change-Id: Ia288452668179723e35452d6e9579fb1dd0c4c3a
2021-07-28 23:43:51 +03:00
Zuul
9cd92208d6 Merge "Wait for pool to be active and online" 2021-07-28 16:55:56 +00:00
Sagi Shnaidman
5ef192f1f2 Add automatic release job triggered by tag
Currently put it in pre-release pipeline to test that it's ok.

Change-Id: I791478464ed59933273bb0e5f88f3636074c6729
2021-07-28 15:11:07 +03:00
Jesper Schmitz Mouridsen
aed60716ee Wait for pool to be active and online
In order to use a newly generated pool for a new
healthmonitor the pool must be online and active,
to avoid 409 conflict, when trying to update a pool
with e.g pending update as a status.

Change-Id: I160a75c6fbbf1555f3adcb444c77057f59b4cdfb
2021-07-19 13:05:33 +02:00
cuongmax
938b90ea19 Add protocol listener octavia
Signed-off-by: cuongmax <ptitcuongmax@gmail.com>
Change-Id: I98c316865837e7c68fa3eed2f5304950ebfc2141
2021-07-17 09:17:55 +07:00
Zuul
ce853a8f9f Merge "Add missing info to changelog" 2021-06-24 20:42:05 +00:00
Sagi Shnaidman
9911c7f93a Add missing info to changelog
Change-Id: Ic6113a785090cc05771fb2f4730dc25f40a8d4dc
2021-06-24 23:13:24 +03:00
Sagi Shnaidman
8c890e656b Update IRC server in README
Change-Id: Ida13b691ae09c2222ae1c83a88b47702fdf684f4
2021-06-24 16:59:56 +03:00
Sagi Shnaidman
b839f9e25d Bump to devel 1.5.1-dev version
Change-Id: I99857903ed22f46e4bbf317dab49f5e581141ea2
2021-06-23 18:41:14 +03:00
Sagi Shnaidman
b7765776a7 Release 1.5.0 version
Change-Id: I433087510adf633e9656f844680ef22c1aff1a72
2021-06-23 17:41:08 +03:00
Zuul
4490e008c4 Merge "Only apply necessary changes to subnets" 2021-06-23 14:35:49 +00:00
Zuul
f376d4679e Merge "fix update on empty list of allowed address pairs" 2021-06-23 13:10:44 +00:00
Zuul
12ec8c63c2 Merge "Add address scope module" 2021-06-23 11:38:23 +00:00
Jan Hartkopf
72f371c157 fix update on empty list of allowed address pairs
Story: 2008986
Task: 42636
Change-Id: I1a500673d870b706d9187ce9780fc72d3603bad9
2021-06-23 10:43:16 +00:00
Jakob Meng
ce421fe370 Only apply necessary changes to subnets
Previously, all subnet properties were updated if any value did not match.
But this behaviour caused errors like e.g. "Current gateway ip 192.168.0.1
already in use by port [ID]. Unable to update." even if that gateway was
not about to be changed.

Task: 40927
Story: 2008172
Change-Id: I049b0dade4c7ea3e1ef24777ae558f650caa136c
2021-06-23 10:40:57 +00:00
Ümit Seren
f20ec3a151 Add address scope module
Change-Id: If02e03f124a8677cba42aa7019947e8f00ea476f
2021-06-22 23:23:50 +02:00
Zuul
a89ec027b0 Merge "Switch Snapshot module to OpenStackModule" 2021-06-22 20:53:47 +00:00
Zuul
322f96c4db Merge "Switch Quota module to OpenStackModule" 2021-06-22 20:48:11 +00:00
Zuul
50b55560fc Merge "Switch user_info module to OpenStackModule" 2021-06-21 17:16:09 +00:00
Zuul
0c0013504e Merge "Switch ProjectAccess module to OpenStackModule" 2021-06-21 17:04:10 +00:00
Zuul
e651838f3e Merge "Switch role_assignment module to OpenStackModule" 2021-06-21 17:04:07 +00:00
Zuul
4553282545 Merge "Switch identity_role module to OpenStackModule" 2021-06-21 16:19:07 +00:00
Zuul
235628dace Merge "Switch hostaggregate module to OpenStackModule" 2021-06-21 15:20:38 +00:00
Zuul
4ee8621b37 Merge "Dns zone info module" 2021-06-17 17:09:58 +00:00
Zuul
d07039a7ec Merge "Switch lb_listener module to OpenStackModule" 2021-06-17 16:13:49 +00:00
Zuul
54728a83fa Merge "Switch lb_member module to OpenStackModule" 2021-06-17 16:13:46 +00:00
Zuul
8431232eeb Merge "Switch lb_pool module to OpenStackModule" 2021-06-17 15:58:57 +00:00
Zuul
b21b8b1084 Merge "Switch catalog_service module to OpenStackModule" 2021-06-17 15:06:35 +00:00
Zuul
e2ffed388e Merge "Switch group_assignment module to OpenStackModule" 2021-06-17 14:06:08 +00:00
Zuul
ff44a1d1e5 Merge "Switch KeystoneFederationProtocolInfo module to OpenStackModule" 2021-06-17 12:05:32 +00:00
Zuul
9f893824c5 Merge "Switch federation_mapping module to OpenStackModule" 2021-06-17 11:59:37 +00:00
Zuul
b9df964149 Merge "Switch federation_mapping_info module to OpenStackModule" 2021-06-17 11:20:33 +00:00
Zuul
0c8fe9002e Merge "Switch floating_ip module to OpenStackModule" 2021-06-17 11:20:20 +00:00
Zuul
e010db6273 Merge "Switch federation_idp_info module to OpenStackModule" 2021-06-17 11:20:09 +00:00
Zuul
88277a59af Merge "Switch port_info module to OpenStackModule" 2021-06-17 11:20:05 +00:00
Zuul
1a4d0128c7 Merge "Add check_mode attribute to OpenstackModule" 2021-06-17 11:20:02 +00:00
Polina Gubina
03a86669de Dns zone info module
Change-Id: I99f084bcb2fa3d4a203f439a55eef162ab82d43d
2021-06-17 10:52:05 +00:00
Artem Goncharov
fa7526a0ec Switch hostaggregate module to OpenStackModule
Change-Id: I86ebbcc52b6558f4110fc439ed13fb590dddb590
2021-06-17 13:41:22 +03:00
Artem Goncharov
7446ab23b8 Switch ProjectAccess module to OpenStackModule
Switch project_access module to the general OpenStackModule.

Change-Id: I359fcf8d815413b52b993b343c458c8c986bc247
2021-06-17 13:28:10 +03:00
Zuul
4171ee52b7 Merge "Switch endpoint module to OpenStackModule" 2021-06-16 20:46:52 +00:00
Zuul
60f1b8e2a5 Merge "Switch ServerGroup module to OpenStackModule" 2021-06-16 19:12:51 +00:00
Zuul
0bff3f286f Merge "Switch Stack module to OpenStackModule" 2021-06-16 19:12:48 +00:00
Zuul
5188e281b9 Merge "Switch flavor_info module to OpenStackModule" 2021-06-16 11:46:04 +00:00
Zuul
966b6597f3 Merge "Switch Recordset module to OpenStackModule" 2021-06-16 11:45:59 +00:00
Zuul
5636d502ce Merge "Switch identity_domain_info module to OpenStackModule" 2021-06-16 08:56:22 +00:00
Zuul
4db925b452 Merge "Switch auth module to OpenStackModule" 2021-06-16 08:20:43 +00:00
Zuul
3ce4455bc8 Merge "Switch coe_cluster_template module to OpenStackModule" 2021-06-16 08:20:22 +00:00
Zuul
309c3025ba Merge "Switch identity_user module to OpenStackModule" 2021-06-16 08:20:19 +00:00
Zuul
637d321a9a Merge "Switch flavor module to OpenStackModule" 2021-06-16 06:30:51 +00:00
Zuul
74c18f34f3 Merge "Switch identity_group_info module to OpenStackModule" 2021-06-15 18:25:46 +00:00
Zuul
00be40a462 Merge "Switch port module to OpenStackModule" 2021-06-15 18:25:43 +00:00
Zuul
1eb5d85b68 Merge "Switch coe_cluster module to OpenStackModule" 2021-06-15 17:25:29 +00:00
Zuul
d0a4d6e8cc Merge "Switch object module to OpenStackModule" 2021-06-15 14:22:05 +00:00
Zuul
29c03592cc Merge "Switch identity_group module to OpenStackModule" 2021-06-15 14:22:02 +00:00
Zuul
7888b51053 Merge "Switch federation_idp module to OpenStackModule" 2021-06-15 13:37:38 +00:00
Zuul
0e4dc21bab Merge "Switch identity_domain module to OpenStackModule" 2021-06-15 12:18:35 +00:00
Zuul
623b4afbd1 Merge "Floating ip info module" 2021-06-15 10:13:12 +00:00
Zuul
80e6597f96 Merge "Switch federation_protocol module to OpenStackModule" 2021-06-15 09:30:54 +00:00
Zuul
8f1512166e Merge "Switch ServerMetadata module to OpenStackModule" 2021-06-15 09:05:08 +00:00
Sagi Shnaidman
eabe945194 Add check_mode attribute to OpenstackModule
Change-Id: I4a779113f7bf293b5f059d662a1a562d4192e537
2021-06-14 14:04:47 +03:00
Artem Goncharov
06115c77b7 Switch Quota module to OpenStackModule
Switch quota module to the general OpenStackModule.

Change-Id: I28a61bf70b161358b76e3adb70b32896613e9aba
2021-06-14 13:48:29 +03:00
Zuul
4a1b092efb Merge "Fail if referenced source image for a new volume does not exist" 2021-06-07 15:46:16 +00:00
Zuul
da1fab6629 Merge "Fix host_aggregate to tolerate aggregate.hosts being None" 2021-06-07 15:45:40 +00:00
Zuul
0efb855c68 Merge "Update checks for validate_certs in openstack_cloud_from_module" 2021-06-07 15:45:33 +00:00
Georgina Shippey
329a5ef50d Update checks for validate_certs in openstack_cloud_from_module
Change I51105f11565c5ff33b04add36259c8703af11240 moved validate_certs default from None to False.
This causes checks to fail in openstack_cloud_from_module as validate_certs is never None anymore.

This patch changes reverts the default back to None, and reflects this in the documentation.

Task: 41776
Story: 2008600
Change-Id: Ic79510f863cf3a39c3f5c6d99f61d335f92f9388
2021-06-01 17:22:37 +01:00
Christian Rohmann
47708e0172 Fix host_aggregate to tolerate aggregate.hosts being None
Story: 2008925
Task: 42524

Change-Id: I0b2f8d0578b764ba3484d45c212f81ad728072e5
2021-06-01 12:45:44 +02:00
Polina Gubina
17d5c7de8e Floating ip info module
Change-Id: If932651c9d7a1819f805a49b020826682c5b8087
2021-05-27 12:03:04 +03:00
Christian Rohmann
82792ab5d5 Fail if referenced source image for a new volume does not exist
Story: 2008926
Task: 42525
Change-Id: I867d6869744528aae3034a7e0add2d0e922a97ff
2021-05-26 18:21:08 +02:00
Zuul
d4033b4cea Merge "Remove pip job" 2021-05-25 21:10:10 +00:00
Zuul
426b6e782a Merge "Make tripleo master job voting" 2021-05-25 21:10:06 +00:00
Zuul
75b2c60960 Merge "Fix inventory plugin on Ansible 2.11" 2021-05-25 19:59:49 +00:00
Sagi Shnaidman
c9527889a0 Remove pip job
Pip installation is not recommended for collections anyway, so
let's drop this check to make CI more tiny.
Change-Id: I3d02f0c8101a5c46404563b64e8bea78fe422a59
2021-05-25 20:48:01 +03:00
per-lind
42a5cb5601 Fix inventory plugin on Ansible 2.11
The bug here is that the openstack inventory plugin will no longer work with Ansible 2.11. You can test an inventory file (named openstack.yml) with either of these syntaxes:

plugin: openstack
plugin: openstack.cloud.openstack
The first option errors due to custom validation present in openstack's own inventory plugin:

[WARNING]: * Failed to parse /home/alancoding/repos/awx/testing/openstack/openstack.yml with auto plugin: plugin
config file, but not for us: openstack

Because this was written back before FQCNs (fully-qualified collection names) were a thing. Before it migrated to a collection, "openstack" was the expectation, but then self.NAME for the inventory plugin changed to "openstack.cloud.openstack", meaning that "openstack" by itself would no longer work. That made sense until Ansible core introduced routing where it would recognize "openstack" and route it to "openstack.cloud.openstack" for purposes of the "auto" inventory plugin routing. See the routing entry at:

2cbfd1e350/lib/ansible/config/ansible_builtin_runtime.yml (L9548)

The second option errors with:

[WARNING]: * Failed to parse /home/alancoding/repos/awx/testing/openstack_fqcn/openstack.yml with auto plugin:
Invalid value "openstack.cloud.openstack" for configuration option "plugin_type: inventory plugin:
ansible_collections.openstack.cloud.plugins.inventory.openstack setting: plugin ", valid values are: ['openstack']

This is due to Ansible core enforcing stricter validation of options. Merged in this PR ansible/ansible#73162

That broke many inventory plugins because the practice before the migration to collections was to list the name in the choices for the "plugin" option. This has been fixed in other collections.

Because neither of these options work, the inventory plugin is not usable in recent Ansible versions.

Suggested patch here:

https://github.com/AlanCoding/ansible-collections-openstack/compare/fqcn_name?expand=1

This allows the user to use either syntax, because there's an argument for the validity of both.

credit to https://github.com/AlanCoding

Change-Id: Ie1211796929d0bc12c7a48764bd8efc7defdd2d7
2021-05-25 19:42:04 +02:00
Sagi Shnaidman
aa387aab3a Make tripleo master job voting
And train as non-voting - mostly for informational purpose.
Change-Id: Ib0d186865591922614d8d7f786da520cd26c3976
2021-05-25 13:45:31 +03:00
Artem Goncharov
af79857bfb Switch Stack module to OpenStackModule
Switch stack module to the general OpenStackModule.

Change-Id: I98006adcb16c57d5d00990ef6cb76298ff9af9f9
2021-05-25 10:37:19 +02:00
Artem Goncharov
a51d922bee Switch identity_domain module to OpenStackModule
Change-Id: I8d7250cbc5396af25b9720c6f5ccb3925a398ac7
2021-05-21 12:15:29 +00:00
Artem Goncharov
0cbaeb6fbb Switch identity_role module to OpenStackModule
Change-Id: I57c2c558bd01c984453fb11048e8a888ec4d9eea
2021-05-21 12:14:49 +00:00
Artem Goncharov
532857c0b2 Switch federation_idp module to OpenStackModule
Change-Id: I9de209373991c8d999b0514549ad5808981441f1
2021-05-21 14:14:16 +02:00
Artem Goncharov
acd9bc993b Switch group_assignment module to OpenStackModule
Change-Id: I443ed6785500a0e4aafe9c976a11c022e8f23db0
2021-05-21 12:13:15 +00:00
Artem Goncharov
0904ddd2fe Switch federation_protocol module to OpenStackModule
Change-Id: I28a69171df0d4b2df768458f0b5cff72c3937f59
2021-05-21 14:12:08 +02:00
Artem Goncharov
2120814356 Switch KeystoneFederationProtocolInfo module to OpenStackModule
Switch keystone federation_protocol_info module to the general OpenStackModule.

Change-Id: Ia42c602ad7ea01dcb27d77370cc2617ec51aaaf3
2021-05-21 14:07:25 +02:00
Artem Goncharov
ad70a20af5 Switch identity_group module to OpenStackModule
Change-Id: I880e425a5b334abfe7b9498d70229427292c2296
2021-05-21 14:05:25 +02:00
Artem Goncharov
a32cff23c7 Switch Recordset module to OpenStackModule
Switch dns.recordset module to the general OpenStackModule.

Change-Id: I858880834acce6112eadd7e78e339f39b7c455da
2021-05-21 14:04:34 +02:00
Artem Goncharov
f29a8407af Switch port module to OpenStackModule
Switch port module to the general OpenStackModule.

Change-Id: I66fcc0bc126563a6652253151e098fab62f9c68f
2021-05-21 14:02:49 +02:00
Artem Goncharov
555178ecc6 Switch user_info module to OpenStackModule
Drop deprecated block to keep simplicity.

Change-Id: I9e64913cd157f2985ef720ddecfbeb9ad996fa2c
2021-05-21 14:01:46 +02:00
Artem Goncharov
f93172677c Switch ServerGroup module to OpenStackModule
Switch ServerGroup module to the general OpenStackModule.

Change-Id: Ib80483fbc6c3d93003b690997014d8d08315296d
2021-05-21 13:57:38 +02:00
Artem Goncharov
2a461cadd9 Switch ServerMetadata module to OpenStackModule
Switch ServerMetadata module to the general OpenStackModule.

Change-Id: If3f3086a964c47407ec82dda662d2c1524283fb6
2021-05-21 13:56:43 +02:00
Artem Goncharov
e3c61aeefd Switch Snapshot module to OpenStackModule
Switch snapshot module to the general OpenStackModule.

Change-Id: I0f4281324e5276122f51722c7b8e79ee185fd476
2021-05-21 13:47:50 +02:00
Artem Goncharov
3e4413ec31 Switch auth module to OpenStackModule
Change-Id: I6e81a6a8171f62651dce0a4b3cc794b045a5a453
2021-05-21 07:47:42 +00:00
Artem Goncharov
37afe5f2e6 Switch catalog_service module to OpenStackModule
Change-Id: I77332c1af2311a472702e90f72ea9b21d385df3c
2021-05-21 07:46:26 +00:00
Artem Goncharov
7e190d12b4 Switch coe_cluster module to OpenStackModule
Change-Id: Idb316136840001e406f76c08d99654d32e14d168
2021-05-21 07:46:15 +00:00
Artem Goncharov
3d9f9a0f87 Switch coe_cluster_template module to OpenStackModule
Change-Id: I486d98d3f4ec480254a0dcb82a5cb48a9ecc8d3f
2021-05-21 07:44:43 +00:00
Artem Goncharov
57e1087177 Switch flavor module to OpenStackModule
Change-Id: I49302c7ca72b85c74c00e436bc4d695115471f70
2021-05-21 07:44:28 +00:00
Artem Goncharov
6cb6e70645 Switch flavor_info module to OpenStackModule
Change-Id: I96f876bdf1eab0e451ee6d251b62f6aaa52ffc6f
2021-05-21 07:43:56 +00:00
Artem Goncharov
662ac61640 Switch endpoint module to OpenStackModule
Change-Id: Ibd208374297342764c79ffe3968e360cc3ae004d
2021-05-21 07:43:44 +00:00
Artem Goncharov
891fb6df53 Switch federation_idp_info module to OpenStackModule
Change-Id: I7d37e83da3bccd13ed4c7bd5f0dce5bfe9e205cb
2021-05-21 07:42:41 +00:00
Artem Goncharov
0c6752215b Switch federation_mapping module to OpenStackModule
Change-Id: If50b83aaae9eb684624a5fe34415c3b67d10b65f
2021-05-21 07:42:30 +00:00
Artem Goncharov
a6f1177584 Switch federation_mapping_info module to OpenStackModule
Change-Id: Ia0abcaea7694396a6c7b7f8fd01a3b29f27c7729
2021-05-21 07:40:56 +00:00
Artem Goncharov
2dc2806c57 Switch floating_ip module to OpenStackModule
Change-Id: I0d406b527a2389d5299ab4e5f5c557737fe2ad99
2021-05-21 07:40:05 +00:00
Artem Goncharov
59df183660 Switch identity_domain_info module to OpenStackModule
Change-Id: If866ef04ae822b09b162773262e49ec8f33f5e92
2021-05-21 07:38:50 +00:00
Artem Goncharov
2c287d754c Switch identity_group_info module to OpenStackModule
Change-Id: I6e425cad55e7c1c9df44c4f2688c023e5011d2e9
2021-05-21 07:38:13 +00:00
Artem Goncharov
28d32b53e8 Switch identity_user module to OpenStackModule
Change-Id: I61a43ac31f23758204d11fe72754a50993dcc294
2021-05-21 07:36:31 +00:00
Artem Goncharov
2cb67620aa Switch lb_listener module to OpenStackModule
Switch loadbalancer listener module to the general OpenStackModule.

Change-Id: Ifa6372bc5ee18e3ec47edaf630a3149609e1db0b
2021-05-21 07:33:15 +00:00
Artem Goncharov
5217b6bdc4 Switch lb_member module to OpenStackModule
Switch loadbalancer member module to the general OpenStackModule.

Change-Id: I92d09c27205f8fa01df9ddab96448c433c42ef79
2021-05-21 07:32:54 +00:00
Artem Goncharov
96ea60a883 Switch lb_pool module to OpenStackModule
Switch loadbalancer_pool module to the general OpenStackModule.

Change-Id: I75dfd34dd65f73ae8d7584729aa0c14fd14ee366
2021-05-21 07:32:00 +00:00
Artem Goncharov
0eef3cb978 Switch object module to OpenStackModule
Switch object module to the general OpenStackModule.

Change-Id: Ic90d796fe4bbec118c148ffd468458bd98990422
2021-05-21 07:30:55 +00:00
Artem Goncharov
e695000daa Switch port_info module to OpenStackModule
Switch networking port_info module to OpenStackModule. Drop part of
deprecated functionality to keep it simple.

Change-Id: I1d310e369ba2fde76478d9751bd8151fe20e2ba7
2021-05-21 07:29:51 +00:00
Artem Goncharov
0258878400 Switch role_assignment module to OpenStackModule
Switch role_assignment module to the general OpenStackModule.

Change-Id: I67df08cced62fb729cb1d4fbb43ac5977fca61de
2021-05-21 09:25:58 +02:00
Paul Belanger
ea7ba854d5 Add bindep.txt for ansible-builder
This allows users to properly build openstacksdk when using
ansible-builder.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Change-Id: I6cef73dedeac75a072309f7f2b6682906102a20d
2021-05-19 14:04:33 -04:00
Dmitriy Rabotyagov
6b3bf3bba0 Add support to setting image tags
Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/783849
Change-Id: Idee1f3c16cb07db39395b434d406628a9c5b152d
2021-05-18 16:30:01 +00:00
Zuul
daaa6bf561 Merge "Switch project and project_info module to OpenStackModule" 2021-05-12 21:31:19 +00:00
Sagi Shnaidman
2027eb1f46 Add non-voting train TripleO jobs
Because we use modules starting from train, let's check we don't
break anything in train branch for TripleO.
Use non-voting more for informational purpose, since old branches
jobs can be unstable.

Change-Id: I0026b3bdd785a32b7d701ed6ac146853c0cdd162
2021-05-11 12:16:37 +03:00
Artem Goncharov
944f9ca498 Switch project and project_info module to OpenStackModule
Continuing our journey on generalization of the modules switch the
project modules.

Change-Id: I29c689212c07e1e582cffcdd47496975ac0d327c
2021-05-11 09:11:50 +00:00
Sagi Shnaidman
ca6824bffe Configure only one tripleo job
Because we run only one job, no need to set content provider.
Change-Id: I85ad4281906a6d4aec4dceb4e6fc985e8c60f1a8
2021-05-11 01:04:29 +03:00
Sagi Shnaidman
a10be98638 Add TripleO job on collections used in TripleO
Redefine irrelevant files for jobs.

Change-Id: I83616ca370a449dcead99aed03fe4e54358e9e5a
2021-05-06 17:53:26 +03:00
Zuul
6787924f13 Merge "Fix the idempotent of compute_flavor module" 2021-05-04 09:25:49 +00:00
Zuul
d1d6b4d2dd Merge "setup.cfg: Replace dashes with underscores" 2021-04-29 13:46:33 +00:00
Zuul
06e76a1687 Merge "Remove CI jobs for rocky and stein branches from check" 2021-04-29 13:26:03 +00:00
Zuul
464d7767bb Merge "Migrating image module from AnsibleModule to OpenStackModule" 2021-04-29 12:09:05 +00:00
Sagi Shnaidman
718f3a6b3a Remove CI jobs for rocky and stein branches from check
We don't want to support full compatibility with rocky and stein
branches. Move CI jobs for them to experimental pipeline.
Change-Id: I738831bada5c4779869024c5660d9a7607a603c5
2021-04-29 12:57:12 +03:00
yangyawei
3320c662c8 setup.cfg: Replace dashes with underscores
Setuptools v54.1.0 introduces a warning that the use of dash-separated
options in 'setup.cfg' will not be supported in a future version [1].
Get ahead of the issue by replacing the dashes with underscores. Without
this, we see 'UserWarning' messages like the following on new enough
versions of setuptools:

  UserWarning: Usage of dash-separated 'description-file' will not be
  supported in future versions. Please use the underscore name
  'description_file' instead

[1] https://github.com/pypa/setuptools/commit/a2e9ae4cb

Change-Id: I01ed896fb685dc6e8873b26942fa1c85c897a25f
2021-04-29 17:38:54 +08:00
wuchunyang
77acba047b Fix the idempotent of compute_flavor module
if flavor's swap is not set (or 0),nova returns empty string [0]
rather than 0 when query flavor spec. this behavior will break
the idempotent of the ansible deployment. this ps changes the empty
string to 0 before compare them.
[0]: https://docs.openstack.org/api-ref/compute/?expanded=list-flavors-detail,list-flavors-with-details-detail#list-flavors-with-details

Change-Id: I041cbcc0432051d795e2c3f0e7ac7378e1970008
2021-04-27 18:12:29 +08:00
anbanerj
890401b605 Migrating image module from AnsibleModule to OpenStackModule
1. Added ImageModule class
2. Added deprecated_names
3. Updated types in param

Change-Id: I58beb5cab26106769d18e25cd3d23df68145e363
2021-04-22 10:32:46 +02:00
Sagi Shnaidman
8da4e852f0 Add wallaby job to CI
Add voting for train.
Change-Id: I5ecdc746056edf59d647b73c7fa7d316c092b38a
2021-04-20 04:05:12 +03:00
Sagi Shnaidman
f3e9c78c18 Bump to dev version
Change-Id: I8a10b36eef9a98fe1a4b43a7c6ce8986950154ad
2021-04-09 00:23:25 +03:00
Sagi Shnaidman
47382d52ed Release 1.4.0 version
Change-Id: I64652090e65de8450ca907a57e23e09e562c17da
2021-04-08 20:03:26 +03:00
Polina Gubina
0e2058988e Container module for management Swift containers
Change-Id: I13161b360addac2d2c1c507145b5be653d6dec17
2021-04-08 18:46:53 +03:00
Zuul
ab1a2a19d7 Merge "Prepare for Ansible 2.11 tests" 2021-04-08 10:49:56 +00:00
Sagi Shnaidman
17a1d72b1c Prepare for Ansible 2.11 tests
Change-Id: I3914db6e5c4f279f2aeae051fd6a1a4254f554c9
2021-04-08 00:19:24 +03:00
Zuul
58ec1030a4 Merge "Add execution environment metadata" 2021-04-07 19:26:45 +00:00
AlanCoding
da01746e53 Add execution environment metadata
Change-Id: Ic68fe6fd43aae12f944ad17f747f6bf37bf4d324
2021-04-07 14:41:19 +00:00
Sagi Shnaidman
c329f65b41 Fix issues with newest ansible-test 2.11
Change-Id: Ifdf253ca01b0e19b55867d8ead03eaceb5b2d73a
2021-04-07 14:47:00 +03:00
Sagi Shnaidman
18b03e1971 Fix CI for latest ansible-test with no_log
Add no_log for requires arguments, hide admin_password for server
actions.
Disable voting for stein, rocky, queens jobs as they are broken
atm in devstack part.
Change-Id: Ib408749bedb583b065f82237a223388a7d919640
2021-04-05 22:24:31 +03:00
Vladimir Ermakov
16a81fc221 security_group_rule: add support ipv6-icmp
Adds ipv6-icmp protocol to _ports_match check to be able to make that
rules for IPv6.

Story: 2008687
Task: 41989
Change-Id: Ib6313788132bb601d7d53ac709b7c822ee533a8b
2021-03-04 13:06:57 +03:00
Maxim Babushkin
50deae71f4 Add binding profile to port module
Neutron port is able to configure binding profile during creation.
Add support of the binding profile to module

Change-Id: I7a36fb05065cbd559cd7a00842070f97e7afbc13
2021-03-01 14:16:51 +02:00
Zuul
b1e5ca91cf Merge "add option to exclude legacy groups" 2021-02-22 13:31:48 +00:00
Shnaidman Sagi (Sergey)
185d0a5eca Revert "Mark 2.9 ansible-test sanity as non-voting"
This reverts commit 1d8605fbf7.

Reason for revert: fixed in Ansible: https://github.com/ansible/ansible/pull/73618

Change-Id: I6eca78cca86c57e166f45c2d5cbd79e8b5891857
2021-02-21 11:02:23 +00:00
Sagi Shnaidman
2b8aa2cb08 Add Octavia job for testing Load Balancer
Add basic test for LB.
Configure Octavia job which will run on LB changes only.
Change-Id: Ic76bb766f133c91a41893978ee864025dd659ab4
2021-02-20 17:57:20 +02:00
willtome
3c8fbc6b27 add option to exclude legacy groups
Change-Id: I73835b111b1bdfc0d8dd6409d516ad1cb84c658a
2021-02-18 12:03:09 +00:00
Sagi Shnaidman
d212be018b Bump dev version in galaxy.yml
Change-Id: Iac46e2290d5b10e39f4d480d69ff1284f535c2e9
2021-02-16 21:41:48 +02:00
Sagi Shnaidman
573e219e30 Release version 1.3.0 of Openstack Collection
Change-Id: I024e0ca9259a21956fea7f3cbd3e2c954b4dea39
2021-02-16 19:33:59 +02:00
Zuul
5c3750df2c Merge "ironic: stop putting meaningless values to properties" 2021-02-16 11:47:39 +00:00
Zuul
94e0e10e49 Merge "Allow description field to be set with os_server" 2021-02-16 10:43:53 +00:00
Zuul
db9a8d5a18 Merge "Guidelines: Fix links and formatting" 2021-02-16 09:41:03 +00:00
Zuul
7e20a8fc97 Merge "Migrating image_info module from AnsibleModule to OpenStackModule" 2021-02-16 00:43:51 +00:00
Zuul
c7969aa052 Merge "ironic: deprecate sub-options of driver_info" 2021-02-15 23:20:05 +00:00
Zuul
179a500903 Merge "Fix some typos in readme" 2021-02-15 22:23:25 +00:00
Sebastian Haderecker
ab3e136867 Guidelines: Fix links and formatting
Change-Id: I658ff486414100944b2f39d8068495cc7765fbe5
2021-02-15 20:49:37 +00:00
anbanerj
8d2391d873 Migrating image_info module from AnsibleModule to OpenStackModule
1. Added ImageInfoModule class
2. Added basic test to see if image_info reflects created image and deletion of image
3. Added deprecated_names
4. Added 'type'/'required' in argument_spec
5. Removed debug statements from test as we are checking already with image_info module

Change-Id: I6ab5fd5384392f9de0af01b1937a75de4f16d28d
2021-02-15 20:49:19 +00:00
Manuel Rodriguez
e1d62ff73a Allow description field to be set with os_server
Adds server description field support to os_server
when compute API version >= 2.19
https://review.opendev.org/c/openstack/openstacksdk/+/775513

Story: 2008395
Depends-On: dab55a7
Change-Id: I848c5e489ef9fe071362c79b2c14fb45724cb4f5
2021-02-15 14:30:59 -05:00
Sebastian Haderecker
c3261d9813 Fix some typos in readme
Change-Id: I6a6c93c3764d075a3dca5719b7fe561867064c07
2021-02-15 19:50:25 +01:00
Sagi Shnaidman
1d8605fbf7 Mark 2.9 ansible-test sanity as non-voting
Current way of running ansible-test with venv is failing because
of cryptography package issue[1]. Mark it non-voting until the
issue is resolved.

[1] https://github.com/pyca/cryptography/issues/5771

Change-Id: Ife1468c4c7140ed3bdaf1dad06a09c71b8e1dbd4
2021-02-15 15:53:56 +00:00
Dmitry Tantsur
0843990dee ironic: stop putting meaningless values to properties
None of the properties are required nowadays, putting made-up values
there brings more harm than good.

Change-Id: I35bda0ac2dc9c32acb94aaa4d28572af2cac85fa
2021-02-12 14:38:27 +01:00
Zuul
6f8b39bb16 Merge "Add modules for roles information" 2021-02-06 03:28:01 +00:00
Sagi Shnaidman
c39c8f9d74 Add modules for roles information
Add module that retrieves list of roles for a Openstack cloud.
Change-Id: Iabadd94f990c49ba078aa02e2d801c40985f85b8
2021-02-04 04:30:07 +02:00
Artem Goncharov
e4c7bd3df8 Add security_group_info module
Let's add a new missing module for getting info about security groups.
Add tests.

Change-Id: Ib032c8d14444cea1fcbfd98d252cc56b9f5f383e
2021-02-04 02:22:31 +02:00
Zuul
8a4974025f Merge "Add security_group_rule_info module" 2021-01-28 18:19:52 +00:00
tischrei
51a9731cef Add security_group_rule_info module
Let's add a new missing module for getting info about security group rules.

Change-Id: Iba2fe66c4bd19ab66f8e35c091ed4c0ea423efd1
2021-01-28 10:43:26 +00:00
Zuul
051b270d36 Merge "Fixed check for None in os_port" 2021-01-27 14:04:11 +00:00
Zuul
ca234d7e42 Merge "New keypair_info module" 2021-01-27 13:41:47 +00:00
Zuul
5967e1ad0a Merge "Fix setting custom property on os_project" 2021-01-27 12:26:10 +00:00
Irina Pereyaslavskaya
bca980c115 New keypair_info module
Change-Id: Idc3c50e9857b9bc87767cc93096fe7a8b24b298e
2021-01-25 13:57:17 +03:00
Zuul
a55b817968 Merge "Add stack_info module" 2021-01-22 11:30:06 +00:00
Lucas Galton
b7c22515b7 Fix setting custom property on os_project
When a new property is created on a project, verifies if the
key is in the dict before checking its value for changes.

Story: 2008530
Task: 41613
Change-Id: I5db452e0719b45932dda068e32f4876c098fea77
Signed-off-by: Lucas Galton <lucas@galton.fr>
2021-01-20 12:26:15 +01:00
Artem Goncharov
70c773fe6d Add stack_info module
We lost stack_info module during transition from github. Implement it
using newer interface and add tests. Change depends on SDK change adding
missing query filters.

Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/769484
Change-Id: Ie7e6d04ea298ba068f547a53643806b6bc84f873
2021-01-18 18:19:48 +00:00
Sagi Shnaidman
a3f809eb99 Remove protocols choice in security rules
Security group rule can support a lot of protocols now and their
integer representations in 0-255 range. Let's not limit for this
option anymore.

Change-Id: I0432e5d5d6d5f5ce935cf59a00f35153649c22dd
2021-01-15 20:58:54 +00:00
Zuul
049a2de725 Merge "Fix volume_info result for SDK < 0.19" 2021-01-15 16:46:15 +00:00
Jakob Meng
69947cd9fd Fix volume_info result for SDK < 0.19
With openstacksdk prior to version 0.19, module volume_info fails with:
  TypeError: Value of unknown type: <class
  'openstack.block_storage.v2.volume.Volume'> ...

The call to 'self.conn.block_storage.volumes()' returns an instance
of class 'openstack.block_storage.v2.volume.Volume'. This class
inherits from 'openstack.resource.Resource', which is a 'dict'
subclass since 0.19. For older sdk versions prior to 0.19 it was
not, hence we have to use the 'to_dict' function to convert each
'Volume' to 'dict' explicitly.

Ref.: 2f97394847

Task: 41571
Story: 2008136
Change-Id: I5b7adc399f19da08f02202af64a226c92bb9bf41
2021-01-13 14:17:58 +01:00
Zuul
c68b33f79f Merge "Added shelve and unshelve as new server actions" 2021-01-12 13:55:54 +00:00
Zuul
62f0da75bb Merge "Update recordset docu" 2021-01-12 12:13:29 +00:00
Jakob Meng
6e2bde4060 Added shelve and unshelve as new server actions
Task: 40737
Story: 2008056
Change-Id: I127ee59be74e9ebcf7f36b3fabdd6e41a5f7a3bb
2021-01-12 10:15:38 +01:00
Jakob Meng
e4a223d160 Fixed check for None in os_port
Fix bug introduced in commit cac93cb
cac93cbd1f

Task: 40928
Story: 2008173
Change-Id: I990a68d4e24c3c3953010e4053c73454e56f0d64
2021-01-11 13:32:50 +01:00
Dmitry Tantsur
6d4d8d4b0c ironic: deprecate sub-options of driver_info
This structure does not reflect the actual ironic API and is mostly
meaningless nowadays. Just let people populate driver_info directly.

Change-Id: I04d168dc86e8c0115b7183b14499fe1812af7343
2021-01-09 16:31:47 +01:00
Zuul
a4e6d1b67c Merge "Add support for new features" 2021-01-09 13:02:13 +00:00
Sebastian Haderecker
3aaf7ff03a Update recordset docu
Updating a recordset always requires recordset_type and records to be there.
Fixes: https://storyboard.openstack.org/#!/story/2008465

Signed-off-by: Sebastian Haderecker <sebastian.haderecker@gmail.com>
Change-Id: Ia50085337813fb3bd3e72cb70fa62072cce5b791
2021-01-08 23:49:51 +01:00
Tosin Farai
f6a5433503 Add support for new features
Story: 2008432
Task: 41385
Change-Id: I8449075b9a0b39bdc9de8fa94cf238e5e8554875
2021-01-05 01:00:08 +01:00
Sagi Shnaidman
92c10638a9 Add dev tag for collection install
Bump a tag ater release for collection install from git.
Change-Id: Ic9905360dcf3bc5ffc11394b56e3df73fa3d361a
2021-01-03 23:51:57 +02:00
Sagi Shnaidman
e3317db56d Release 1.2.1 version of Openstack Ansible modules
Change-Id: Ia775e7df0ceb8ce0eef3f6d11b957d223729de57
2021-01-03 17:04:29 +02:00
Sagi Shnaidman
870f82d97b Decrease MTU in networks tests
Not all environments support MTU 1350, let's decrease it to 1250.
Change-Id: I6c03c0a1492394eb9fb5de8b0815b459437895cb
2020-12-31 14:07:56 +02:00
Polina Gubina
87c305907e Enable update for recordset and add tests for dns and recordset module
Update for recordset wasn't working properly and there are no tests
for dns and recordset modules, minor fix in dns_zone

Change-Id: I7f78f6038dfb858e795b1954eae11cff47f697ad
2020-12-29 11:34:27 +00:00
Zuul
c532560d1b Merge "Migrating subnet module from AnsibleModule to OpenStackModule" 2020-12-21 14:21:11 +00:00
anbanerj
ea1f1df805 Migrating subnet module from AnsibleModule to OpenStackModule
1. Created class SubnetModule with run method
2. Changed argument_spec from openstack_full_argument_spec to dict
3. Moved "netid != subnet['network_id']:" check inside "if network:" loop
4. Moved the methods using "module" inside SubnetModule class

Change-Id: I8f19359e70f8565ebfb096d30ab75e727f748be6
2020-12-18 13:49:52 +01:00
Zuul
40a32c1e8b Merge "Аdd designate to install with devstack" 2020-12-17 19:23:00 +00:00
Zuul
5881f5423a Merge "Separate volume tests from servers tests" 2020-12-17 15:06:07 +00:00
Sagi Shnaidman
51eba6de02 Аdd designate to install with devstack
Allow DNS tests
Change-Id: I215ce23bbfe68437523e5ee608508dfcc028731a
2020-12-17 06:22:56 +00:00
Zuul
93faf4f1c3 Merge "Add network tests for versioned args" 2020-12-16 17:11:08 +00:00
Zuul
c03284abec Merge "Migrating network from AnsibleModule to OpenStackModule" 2020-12-16 16:59:29 +00:00
frenzy_friday
49c95804ba Add network tests for versioned args
1. Updated Create network tasks with mtu and port security enabled params which are supported for sdk version >= 0.18
2. Added task to assert that network creation with new params fail if sdk version is lower than 0.18

Change-Id: I7d65d8553e820344f76cf1092e0a373c8100b7c8
2020-12-16 08:52:05 +00:00
Sagi Shnaidman
c8a5be6b30 Separate volume tests from servers tests
Tag volume tests in servers as "object" so we can skip them when
volumes are not available.
Change-Id: I23488a64faa3a09493a84bf8eae239197e991d7e
2020-12-16 05:27:19 +02:00
Sagi Shnaidman
8255ec4c80 Run images tests
Change-Id: I972bd4d47b92e3a92876c62ab8fd3e8f67be4cd4
2020-12-16 05:22:40 +02:00
Zuul
36ce09a781 Merge "Migrating security_group from AnsibleModule to OpenStackModule" 2020-12-15 16:39:04 +00:00
frenzy_friday
0ac75add62 Migrating network from AnsibleModule to OpenStackModule
1. Created class NetworkModule with run method
2. Changed argument_spec from openstack_full_argument_spec to dict
3. Removed checking min_version for individual parameters and instead used check_versioned method for all together.
4. Since create_network method uses "mtu_size" as a parameter and not "mtu", changed the key "mtu" to "mtu_size" in argument spec and added alias as "mtu" to still support mtu keyword in playbook.
5. Changed "mtu" to "mtu_size" to match in the doc

Change-Id: Ic4ddedb43044434df0a18f8aacacd21149e6f0b0
2020-12-15 15:39:22 +01:00
Zuul
d004e0af05 Merge "Migrating dns_zone from AnsibleModule to OpenStackModule" 2020-12-15 13:13:23 +00:00
Zuul
b040392238 Merge "Migrating routers from AnsibleModule to OpenStackModule" 2020-12-15 12:47:39 +00:00
Kristian Kucerak
19f24568a2 Migrating dns_zone from AnsibleModule to OpenStackModule
Change-Id: Ib8e5a6afe0ce6a7a095ac489ceed8879926ba7f5
2020-12-15 06:56:00 +00:00
frenzy_friday
9783fbb972 Migrating server_volume from AnsibleModule to OpenStackModule
Change-Id: I55cc89b9d043952c9bec6dccf3857a8c7713a7bb
2020-12-15 06:50:34 +00:00
frenzy_friday
b87e474192 Migrating routers from AnsibleModule to OpenStackModule
Change-Id: I6a444c33f2260b79a4f8f75ed5fe73d64fc85c06
2020-12-15 06:50:19 +00:00
frenzy_friday
c1b8786160 Migrating security_group from AnsibleModule to OpenStackModule
Change-Id: I2d861826d0e85f11f4a9d2eefc5a8e63fd1eb72e
2020-12-15 06:49:59 +00:00
Sagi Shnaidman
981d268039 Fix branchful jobs for collections
Stable branch jobs were using master for deployment

Story: #2008445
Task: #41412

Story: #2008444
Task: #41411

Mark train non-voting, see https://review.opendev.org/766622
Change-Id: I8132ec7cfe3468daaa363efb76c5d0b81bdeab30
2020-12-14 17:44:41 +02:00
Zuul
af27a79312 Merge "Migrating volume from AnsibleModule to OpenStackModule" 2020-12-08 16:05:03 +00:00
Sagi Shnaidman
e504d807de Fix docs-args mismatch in modules
Change-Id: I51105f11565c5ff33b04add36259c8703af11240
2020-12-08 12:06:42 +02:00
Vladimir Hasko
faada98ed9 Migrating volume from AnsibleModule to OpenStackModule
A bit restructed structure so decision logic whether volume will be created or updated is now in run method

Change-Id: I83e03787b3cea65f07dc83764743702d59e8656d
2020-12-07 14:22:22 +00:00
Sagi Shnaidman
c914c42799 Improve "server" module with OpenstackModule class
Move all functions that requires OpenstackModule methods to
OpenstackModule class.

Change-Id: I530413cdb6df782556006ff4de78242679f3f5c5
2020-12-03 15:32:14 +02:00
anbanerj
d5c403cded Migrating subnets_info from AnsibleModule to OpenStackModule
Updated module, added "deprecated_names", Removed "ansible-deprecated-no-collection-name" for subnets_info for ansible 2.10, 2.11

Change-Id: I5590976964543188518200f2b31a1603eb30f39b
2020-12-02 13:27:10 +01:00
frenzy_friday
d36ac1f125 Migrating networks_info from AnsibleModule to OpenStackModule
Migrated networks_info module to OpenStackModule and updated playbook to test the module in CI jobs. Added deprecated_names tyo module.
Removed "ansible-deprecated-no-collection-name" exception for networks_info for ansible 2.10 and 2.11. Reverted 'False' to 'false' and updated filters (case sensitive) to check for 'False' instead

Change-Id: I85e19f0db8b4ee549137249477d0b7f5d82e9865
2020-12-01 22:35:03 +00:00
Zuul
15675ce23f Merge "Refactor loadbalancer module" 2020-11-30 20:20:54 +00:00
Zuul
8180fe8af8 Merge "Refactor TCP/UDP port check." 2020-11-30 20:10:59 +00:00
Zuul
88f03fa1df Merge "Add tests for volume_info module" 2020-11-27 00:01:18 +00:00
Zuul
565f7fd369 Merge "Fix subnets update and idempotency" 2020-11-26 19:56:28 +00:00
Sagi Shnaidman
47a0d625dc Add tests for volume_info module
Add tests for volume_info

Change-Id: I8f30eed2a9d5183d0d38a89a7d39e34f7e7c2212
2020-11-26 21:49:32 +02:00
Zuul
b09d8248f7 Merge "Fix volume_info arguments for SDK 0.19" 2020-11-26 18:06:32 +00:00
siavashsardari
bce3eea5c0 Refactor TCP/UDP port check.
Task: 41314
Story: 2008390
Change-Id: Ib479dbef68cede6189d25e75388d8cb1fc61f95f
2020-11-26 17:49:14 +02:00
Sagi Shnaidman
134a8e9d23 Fix subnets update and idempotency
Fix subnet idempotency for allocation pools, see the linked story.
Return updated subnet information.
Remove adding allocation pools that were introduced in
Ib8becf5e958f1bc8e5c9fd76f1722536bf1c9f1a
in order to add allocation pools, either add new variable or
recreate the subnet.

Task: 41307
Story: 2008384

Change-Id: Ibe808227de159c6975dc94ef8ad0ab03a9345e17
2020-11-26 18:29:40 +03:30
Sagi Shnaidman
9ed9b1d399 Fix Ansible devel jobs
Change-Id: I2ce5b1f8cbb673d70a0a2250862009dfeb399d0e
2020-11-24 22:40:09 +02:00
Sagi Shnaidman
80abd782da Fix volume_info arguments for SDK 0.19
all_projects is not supported before openstacksdk 0.19,
use min_ver for using it.

Task: 40865
Story: 2008136
Change-Id: I0f02a47c11122c5b07ca650a830044bca56c3610
2020-11-24 19:48:19 +02:00
Sagi Shnaidman
ee9a5c564e Add victoria stable branch job
Change-Id: I183c9915be6442018dea93b32a4a93bb6df7acae
2020-11-24 13:19:53 +02:00
Zuul
393b484e5a Merge "Move CI jobs to base on Ansible 2.10 release" 2020-11-24 11:06:22 +00:00
Sagi Shnaidman
6117f7062e Move CI jobs to base on Ansible 2.10 release
Change-Id: Ib1884a1a7b69044cf7d0ac9469c677593339eb5c
2020-11-23 21:50:57 +02:00
anbanerj
f89eea10b4 Added deprecated_names for router_info module
Change-Id: I15bc654f1567ebfa4319523be4a9a8f4124898aa
2020-11-23 18:59:20 +01:00
anbanerj
e1178fde34 Migrating routers_info from AnsibleModule to OpenStackModule
Change-Id: I0b87c5c3336849bd2e62da5dee04614f74714dbf
2020-11-19 12:27:27 +02:00
Dmitriy Rabotyagov
8b35c64fda Do not fail when endpoint state is absent
In case endpoint state is absent we shouldn't fail in case service does
not exist, since it means that we're ok, and endpoint is not present.

This might be pretty useful, when user tries to create and delete service
and endpoint with the same code ie [1]

[1] https://opendev.org/openstack/openstack-ansible-tests/src/branch/master/sync/tasks/service_setup.yml

Change-Id: If7ecd7b2e28c81ffe18539731edd4efa599c42ec
Closes-Bug: #1904029
2020-11-16 10:35:41 +02:00
Dmitry Tantsur
8b98452cbb Refactor ironic authentication into a new module_utils module
This change merely moves the code to one location. The next logical
step would be to make IronicModule inherit the common ansible module.

Change-Id: Iec0ca1e33de6ebc36d7664941eafe1d77203d8f2
2020-10-26 11:05:31 +00:00
Zuul
d081bb5378 Merge "OpenStackModule: Support defining a minimum version of the SDK" 2020-10-23 17:11:01 +00:00
Sagi Shnaidman
2ce1adad4a Add galaxy.yml to support install from git
For installing collection from git like:
"ansible-galaxy collection install git+https://..." the galaxy.yml
file is required to be in the collection.
Add galaxy.yml with next version and "-dev".
Fix links for docs and issues.

Change-Id: I74863977732ebea9cd63ccdd2e830a6671a9e955
2020-10-21 09:12:05 +00:00
Mark Chappell
8ca8df1a84 OpenStackModule: Support defining a minimum version of the SDK
While it's currently possible to set min_ver and max_ver for specific
parameter, there are times when the whole module needs to specify a
minimum version:

- When the object isn't supported at all prior to a version
- When major features are missing from the SDK prior to a version

Change-Id: I94bbff7c54621e8a4786ebc7eb030103255dcb17
2020-10-19 13:55:30 +02:00
Riccardo Pittau
058cb4ff3f Migrate bifrost jobs to focal
Change-Id: Ic52dee90bc6b5d5e0ee1bc7fcbfa273867b937e2
2020-10-19 10:43:00 +00:00
Sagi Shnaidman
1c6663999d Add changelog for 1.2.0
Change-Id: I63cff2945703d12d95726a43b33888e80e35b040
2020-10-13 17:00:37 +03:00
Jesper Schmitz Mouridsen
ab96eb6a11 Refactor loadbalancer module
* enable check_mode
 * enable allowed_cidrs on listener if octavia version is >= 2.12
 * Only send flavor_id if it is not None

Change-Id: I4fd36bf3ed347e020151721a6b56d1cac0a8fd23
2020-10-12 19:08:45 +02:00
Zuul
38e61994c7 Merge "Add volume_snapshot_info module" 2020-09-30 16:02:15 +00:00
Artem Goncharov
d416a27112 Add volume_snapshot_info module
Change-Id: I4edc34639f17adb97dd055fcdeec14ea92acb9bd
2020-09-30 13:40:54 +02:00
Zuul
631e1412a0 Merge "Add volume_backup_info module" 2020-09-30 09:52:35 +00:00
Zuul
4c31ea152e Merge "Make it possible to create a health monitor to a pool" 2020-09-30 07:54:37 +00:00
Artem Goncharov
a39470ac2b Add volume_backup_info module
Change-Id: I5ef76247a449b1b8653bb2bb91fccd5f3db57cf8
2020-09-30 07:38:29 +02:00
Artem Goncharov
39a8362d7a Add volume_backup module
Introduce volume_backup module to manage volume/snapshot backups.

Change-Id: Ibc4e87d47d8e38a0cf52e391dafdf025ab202982
2020-09-29 18:59:02 +02:00
Jesper Schmitz Mouridsen
05da83520e Make it possible to create a health monitor to a pool
Change-Id: I6119f5be02ace88253cba448f5a0699b39ea9ee1
2020-09-28 19:37:24 +02:00
Sagi Shnaidman
a6b52612de Fix linters for new ansible release
Limit ansible to <2.10 in 2.9 jobs,
run on ubuntu-bionic because it can provide python 3.6

Change-Id: I6d19842711f3af58449e056bee84a4c5614cd37e
2020-09-24 23:59:26 +03:00
Sagi Shnaidman
a67272d1f5 Add CI files config to bifrost jobs as well
Change-Id: Ife7bd55f44bf709319c6598c0f95201a1aac528f
2020-08-18 10:42:54 +00:00
Sagi Shnaidman
f448c78dd4 Changelog for Ansible 2.10 release
Story: #2007982
Task: #40608
Change-Id: I74219d8e7f9a8b13bbb17bc070671a1327fd5775
2020-08-17 16:04:54 +03:00
Sagi Shnaidman
33ce7ab9c7 Add volume_info module
Add module for retrieving information about volumes in a cloud.

Story: #2007817
Task: #40095
Change-Id: Ic7551c1737b08b967613e42923f5ea4ec0b606a4
2020-08-16 20:56:45 +03:00
Sagi Shnaidman
03fadf3b43 Fix non existing attribuites in SDK exception
SDK exception may not have extra_data, details or
response attributes. Print None in this case.

Change-Id: Ic4073c28a4e4afb8ca5d2b72c4ea8582da244af1
2020-08-11 14:17:36 +03:00
Zuul
86a5cc3b42 Merge "Do not require ironic_url if cloud or auth.endpoint is provided" 2020-07-28 18:06:27 +00:00
Dmitry Tantsur
8731fcc64b Do not require ironic_url if cloud or auth.endpoint is provided
The endpoint may be specified in clouds.yaml or via auth, do not
force ironic_url in either of these cases.

Finally, accept "none" as a valid no-auth plugin name.

Change-Id: I4d50b7c55727f022d79df85fb4a163fe3e5fca7b
2020-07-28 17:10:01 +02:00
Dmitry Tantsur
f6a7cf5343 Add non-voting bifrost jobs
Bifrost has fully switched to the collection, use its jobs to verify
changes. This adds two jobs: one with no-auth, one with keystone.

Depends-On: https://review.opendev.org/#/c/743167/
Change-Id: I3d46996edb4f8165a559ed70b908316e82a13353
2020-07-27 12:46:52 +02:00
Zuul
284d7871ce Merge "Add support for setting the Flavor when creating a load balancer" 2020-07-26 16:41:19 +00:00
Sagi Shnaidman
fcf6fae499 Add periodic jobs for collections
Add periodic pipeline jobs, add to it another queens jobs with
different ansible versions to increase the coverage.

Change-Id: Ie90547cb17e5c52558b6068e7128f90abffc2e25
2020-07-26 12:32:45 +00:00
Mark Chappell
88b86be33e Add support for setting the Flavor when creating a load balancer
Change-Id: I72c6b60225cacf598ddb9b7df142eced429b7226
2020-07-26 11:22:24 +00:00
Sagi Shnaidman
1f3417cdef Temporarly disable check-import
check-import has ansible as a dependency, which installs only
2.9 ansible version and it conflicts with higher ansible versions
Issue to check-import will be submitted to have ansible-test as
a dep.
Change-Id: Ide46a8a6b45677e82e57eb6a4c5dfe412d7b37fd
2020-07-26 11:49:18 +03:00
Zuul
8792b2b527 Merge "Add openstack logger and Ansible display utility" 2020-07-09 14:30:17 +00:00
Zuul
4a930cf0ec Merge "keypair: make use of OpenStackModule class" 2020-07-09 14:30:16 +00:00
Zuul
e1fe3f6067 Merge "security_group_rule: use OpenStackModule class" 2020-07-09 14:24:08 +00:00
Marc-Antoine Bourgeot
40ce8103f4 Add openstack logger and Ansible display utility
Story: 2007879

Change-Id: I76fc7df8202b4e00b54b5bafe7719e02b49e59ff
2020-07-07 22:21:47 +02:00
Baptiste Mille-Mathias
bbe1d84448 Add a link for issue report and feature request
Change-Id: I00511b314bbc8a6c03a2ee1e6c626147bfe8f49d
2020-07-04 11:31:30 +02:00
Gonéri Le Bouder
9600baec6e security_group_rule: use OpenStackModule class
Refactoring of security_group_rule to depend on the OpenStackModule
class.

See: I487e79fe18c0b9a75df7dacd224ab40ed7f4e1ab

Change-Id: Ide09bdd6a57324a0e1d2ec29c4c49db8dc1c3843
2020-07-02 19:23:15 +00:00
Gonéri Le Bouder
abebbe722c keypair: make use of OpenStackModule class
Convert the keypair module to use the OpenStackModule class.

See: I487e79fe18c0b9a75df7dacd224ab40ed7f4e1ab

Change-Id: I60cd5811f1926f53a7f88b19889fba9ca39c6184
2020-07-02 13:59:36 -04:00
Zuul
94e518e42c Merge "Update author lines" 2020-06-24 15:30:26 +00:00
Monty Taylor
a96d28dfbc Update author lines
We don't use github, so having @ mentions of specific humans is
not valuable. Also, we are a team and own the modules as a team,
so calling out individual authors is philosophically contrary.

We landed a patch upstream to special-case this author string.

Change-Id: I38b4e68f14bbba6e13e8a50e2b202874ab74e3bc
2020-06-23 21:50:43 +03:00
Artem Goncharov
32ef77d9fd Add more useful information from exception
When the module faces API exception we can give much more useful
information to the user. Let us do this for the modules inheriting from
the base class, since all modules should do this at some point in time

Change-Id: I5f1ef01765829900334aa2ecae5dab3ba96f1a49
2020-06-23 18:43:09 +00:00
Sagi Shnaidman
4b64ebe623 Fix typos in job definitions
Change-Id: I654751a879482b1996c863470a6cf68f254eefbb
2020-06-23 16:23:54 +03:00
Sagi Shnaidman
01c2499fb6 New CI jobs configuration
Change-Id: Ib6850184faf1bc0808502c098d610a5e2f41f47e
2020-06-23 12:27:04 +03:00
Sagi Shnaidman
5e3a91a7c6 Add OpenstackModule to os_server_action
Redesign the module for more OOP
Add tests for server_action
Change-Id: I054de32ee3ff34988db53fc87b1cb63b8e551ae3
2020-06-17 12:59:23 +00:00
Sagi Shnaidman
fc852da4bc Fixes for modules generation script
Change-Id: Iffbb8e9f9106860f3d896f65831d2b9283ad1e7b
2020-06-17 13:35:10 +03:00
Sagi Shnaidman
5717f05102 Move action_group to runtime
from https://github.com/openstack/ansible-collections-openstack/pull/2

Change-Id: I82c68c31bccd54d5c2624bf2081820c09791b466
2020-06-17 10:17:23 +00:00
Sagi Shnaidman
4d0df9f022 Fix ansible-test errors
Add tox to requirements
Use only 3.6 python
Set ansible-test 2.9 as a gate job

Change-Id: I40757e1efc3ee297b44cda6c35cdce4c64ebaa4f
2020-06-17 12:53:05 +03:00
Zuul
f8c768ae61 Merge "Don't pass tenant_id for remote group" 2020-06-13 16:34:06 +00:00
Sagi Shnaidman
4d1017d5d9 Add note about py3 in readme
Change-Id: I7ac15d84d54e9ebc1260b633326e19b612a83170
2020-06-11 14:24:03 +00:00
Sagi Shnaidman
c75ab0924a Fix ansible-devel sanity tests for deprecations
Change-Id: I02c3f2cb5a8bb4c891a8f0e36628925208251bf7
2020-06-11 12:55:43 +03:00
Sagi Shnaidman
dfa7983a78 Add notes to README about deps and versions
Change-Id: Ied2ac325af5aee174fc0d20d9aada67a859fa81b
2020-06-09 14:33:40 +00:00
Sagi Shnaidman
8e2e5966b7 Don't pass tenant_id for remote group
When security group is from different project, don't pass tenant
Fixes https://github.com/ansible/ansible/issues/69673
Change-Id: I230c41d1ace179390744287102fead5ddf420157
2020-06-07 18:12:30 +00:00
Sagi Shnaidman
c9da50e7e7 Add setup.py for install with pip
Make possible installation with pip.
Change-Id: I8eec015142c4f29eadff0dac2781782b76dea308
2020-06-04 14:23:23 +00:00
Sagi Shnaidman
f3610ad0e1 Redesign OpenstackModule class
don't inherit OpenstackModule class from AnsibleModule class to
prevent occasional overriding Ansible methods or vars and failing
module.

Change-Id: Ic34fff0c938eb87cc0d2c5e98fbafed64bf349f6
2020-06-04 13:49:48 +03:00
Sagi Shnaidman
7e4fbcf568 Fix ansible-tests for devel branch
Ignore for now deprecation warnings
(see https://github.com/ansible-collections/overview/issues/45#issuecomment-628262697)
Current there are bugs in ansible-test that prevent to run these
tests.

Change-Id: I9829bb23a45699e61d7b0af5ecc3e1a94bbbca85
2020-06-03 00:05:07 +03:00
Zuul
f89644973d Merge "Add template for generation of artibtrary module" 2020-05-28 19:55:17 +00:00
Zuul
b4f015ebd7 Merge "Remove unnecessary requirements file" 2020-05-25 18:12:16 +00:00
Sagi Shnaidman
f0da22da7e Remove unnecessary requirements file
for reference:
https://github.com/ansible-collections/overview/issues/43
Change-Id: I0136b4d173cb7e1d45a2b4535d8772c68f8d5783
2020-05-25 14:43:18 +03:00
Matt Parkinson
d206ea000a Minor spelling fixes in floating_ip documentation
Change-Id: Ib888b4890ff91a9bccaaa1e8b582a478243e47a3
2020-05-25 13:38:25 +10:00
Sagi Shnaidman
5667600420 Add template for generation of artibtrary module
One is for resource changing module, like server start or delete,
second one is for info collection about a specific resource.

Change-Id: I78b35075111731fff2fd50837fa4e6e0c61c55a0
2020-05-25 02:27:40 +03:00
Sagi Shnaidman
98ce765383 Exclude docs and text files form CI jobs
Change-Id: I9645d05a65d8608d7e53ae107eed1f53cca0b0e9
2020-05-24 20:44:10 +03:00
Sagi Shnaidman
ad7d6ea668 Fix broken server_info module and add tests
Fix server_info module. Add tests because it wasn't executed in
tests at all.

Change-Id: I50435f3a3103501bc0eccf8fdfced3179b991bb8
2020-05-21 20:56:13 +03:00
202 changed files with 17631 additions and 6438 deletions

1
.gitignore vendored
View File

@@ -1,7 +1,6 @@
.tox
build_artifact
ansible_collections
galaxy.yml
FILES.json
MANIFEST.json
importer_result.json

View File

@@ -1,239 +1,499 @@
# yamllint disable
---
# Keep parent jobs in sync between branches to avoid issues e.g. with job scheduling. Zuul CI will search in master
# branch first when collecting job variants during job freeze which can have unwanted side effects. For example, when
# parent job *-base has been changed in stable/1.0.0 branch, Zuul could still use *-base variants from master branch
# during job freeze on child jobs such as *-ussuri-ansible-2.11 etc.
#
# Do not share job definitions with the job.branches attribute across multiple branches. Do not define jobs which are
# specific to other branches, except for parent jobs which are shared across branches. For example, to not add a job
# which is specific for the stable/1.0.0 branch to the .zuul.yaml in master branch. In particular do not use the
# job.branches directive on a job which will be copied to multiple branches. When you have multiple copies of a job with
# the job.branches attribute, Zuul CI could pick any of the job definitions which might not be the one you expected.
- job:
name: ansible-collections-openstack-functional-devstack
name: ansible-collections-openstack-functional-devstack-base
parent: openstacksdk-functional-devstack
# Do not restrict branches in base jobs because else Zuul would not find a matching
# parent job variant during job freeze when child jobs are on other branches.
post-run: ci/playbooks/postlog.yaml
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk with latest ansible release
Run openstack collections functional tests against a devstack
# Do not set job.override-checkout or job.required-projects.override-checkout in base job because
# else Zuul will use this branch when matching variants for parent jobs during job freeze
required-projects:
- openstack/ansible-collections-openstack
- openstack/designate
# openstack/devstack is required through parent job openstacksdk-functional-devstack
# openstack/os-client-config is required through parent job openstacksdk-functional-devstack
# openstack/openstacksdk is required through parent job openstacksdk-functional-devstack
irrelevant-files: &ignore_files
- changelogs/.*
- galaxy.*
- COPYING
- docs/.*
- .*\.md
- .*\.rst
- tools/run-ansible-sanity.sh
- tests/sanity/.*
- .zuul.yaml
vars:
zuul_work_dir: src/opendev.org/openstack/ansible-collections-openstack
tox_envlist: ansible
tox_envlist: ansible_latest
tox_install_siblings: true
fetch_subunit: false
devstack_plugins:
designate: https://opendev.org/openstack/designate
devstack_services:
designate: true
neutron-dns: true
zuul_copy_output:
'{{ devstack_log_dir }}/test_output.log': 'logs'
extensions_to_txt:
log: true
- job:
name: ansible-collections-openstack-functional-devstack-magnum-base
parent: ansible-collections-openstack-functional-devstack-base
# Do not restrict branches in base jobs because else Zuul would not find a matching
# parent job variant during job freeze when child jobs are on other branches.
description: |
Run openstack collections functional tests against a devstack with Magnum plugin enabled
# Do not set job.override-checkout or job.required-projects.override-checkout in base job because
# else Zuul will use this branch when matching variants for parent jobs during job freeze
required-projects:
- openstack/magnum
- openstack/python-magnumclient
files:
- ^ci/roles/coe_cluster/.*$
- ^plugins/modules/coe_cluster.py
- ^plugins/modules/coe_cluster_template.py
timeout: 10800
vars:
devstack_localrc:
# NOTE: extend default glance limit from 1GB
GLANCE_LIMIT_IMAGE_SIZE_TOTAL: 5000
devstack_plugins:
magnum: https://opendev.org/openstack/magnum
devstack_services:
magnum-api: true
magnum-cond: true
# Disable swift and dependent c-bak service to support upload of .qcow2.xz image in the gate
s-account: false
s-container: false
s-object: false
s-proxy: false
c-bak: false
tox_extra_args: -vv --skip-missing-interpreters=false -- coe_cluster coe_cluster_template
- job:
name: ansible-collections-openstack-functional-devstack-magnum
parent: ansible-collections-openstack-functional-devstack-magnum-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
with Magnum plugin enabled, using master of openstacksdk and latest
ansible release. Run it only on coe_cluster{,_template} changes.
- job:
name: ansible-collections-openstack-functional-devstack-octavia-base
parent: ansible-collections-openstack-functional-devstack-base
# Do not restrict branches in base jobs because else Zuul would not find a matching
# parent job variant during job freeze when child jobs are on other branches.
description: |
Run openstack collections functional tests against a devstack with Octavia plugin enabled
# Do not set job.override-checkout or job.required-projects.override-checkout in base job because
# else Zuul will use this branch when matching variants for parent jobs during job freeze
required-projects:
- openstack/octavia
files:
- ^ci/roles/loadbalancer/.*$
- ^plugins/modules/lb_health_monitor.py
- ^plugins/modules/lb_listener.py
- ^plugins/modules/lb_member.py
- ^plugins/modules/lb_pool.py
- ^plugins/modules/loadbalancer.py
vars:
configure_swap_size: 8192
tox_install_siblings: false
devstack_plugins:
designate: https://opendev.org/openstack/designate
octavia: https://opendev.org/openstack/octavia
devstack_services:
designate: true
neutron-dns: true
octavia: true
o-api: true
o-cw: true
o-hk: true
o-hm: true
- job:
name: ansible-collections-openstack-functional-devstack-octavia
parent: ansible-collections-openstack-functional-devstack-octavia-base
branches: stable/1.0.0
description: |
Run openstack collections functional tests against a master devstack
with Octavia plugin enabled, using 0.*.* releases of openstacksdk
and latest ansible release. Run it only on Load Balancer changes.
required-projects:
- # Choose parent devstack job from master branch instead of non-existing stable/1.0.0 branch
name: openstack/devstack
override-checkout: master
- # Choose parent devstack job from master branch instead of non-existing stable/1.0.0 branch
name: openstack/openstacksdk
override-checkout: master
vars:
tox_constraints_file: '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/constraints-openstacksdk-0.x.x.txt'
- job:
name: ansible-collections-openstack-functional-devstack-releases
parent: ansible-collections-openstack-functional-devstack
parent: ansible-collections-openstack-functional-devstack-base
branches: stable/1.0.0
description: |
Run openstack collections functional tests against a master devstack
using releases of openstacksdk and latest ansible release
using 0.*.* releases of openstacksdk and latest ansible release
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- # Choose parent devstack job from master branch instead of non-existing stable/1.0.0 branch
name: openstack/devstack
override-checkout: master
- # Choose parent devstack job from master branch instead of non-existing stable/1.0.0 branch
name: openstack/openstacksdk
override-checkout: master
vars:
tox_constraints_file: '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/constraints-openstacksdk-0.x.x.txt'
tox_install_siblings: false
- job:
name: ansible-collections-openstack-functional-devstack-ansible-devel
parent: ansible-collections-openstack-functional-devstack
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk and devel branch of ansible
# non-voting because we can't prevent ansible devel from breaking us
voting: false
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
# Job with Ansible 2.9 for checking backward compatibility
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.9
parent: ansible-collections-openstack-functional-devstack-ansible-devel
parent: ansible-collections-openstack-functional-devstack-base
branches: stable/1.0.0
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk and stable 2.9 branch of ansible
voting: true
using 0.*.* releases of openstacksdk and stable 2.9 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- # Choose parent devstack job from stable/yoga branch instead of non-existing stable/1.0.0 branch
name: openstack/devstack
override-checkout: stable/yoga
- name: openstack/openstacksdk
# Yoga has the latest SDK release of the 0.*.* series atm
override-checkout: stable/yoga
vars:
tox_envlist: ansible_2_9
- job:
name: ansible-collections-openstack-functional-devstack-train-ansible-devel
parent: ansible-collections-openstack-functional-devstack
name: ansible-collections-openstack-functional-devstack-ansible-2.11
parent: ansible-collections-openstack-functional-devstack-base
branches: stable/1.0.0
description: |
Run openstack collections functional tests against a master devstack
using 0.*.* releases of openstacksdk and stable 2.12 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- # Choose parent devstack job from stable/yoga branch instead of non-existing stable/1.0.0 branch
name: openstack/devstack
override-checkout: stable/yoga
- name: openstack/openstacksdk
# Yoga has the latest SDK release of the 0.*.* series atm
override-checkout: stable/yoga
vars:
tox_envlist: ansible_2_11
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.12
parent: ansible-collections-openstack-functional-devstack-base
branches: stable/1.0.0
description: |
Run openstack collections functional tests against a master devstack
using 0.*.* releases of openstacksdk and stable 2.12 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.12
- # Choose parent devstack job from stable/yoga branch instead of non-existing stable/1.0.0 branch
name: openstack/devstack
override-checkout: stable/yoga
- name: openstack/openstacksdk
# Yoga has the latest SDK release of the 0.*.* series atm
override-checkout: stable/yoga
vars:
tox_envlist: ansible_2_12
# Stable branches tests
- job:
name: ansible-collections-openstack-functional-devstack-xena-ansible-2.12
# Do not inherit from any parent job which does not run for branch stable/1.0.0 because Zuul would dismiss this job
# when collecting parent job variants. For example, when job.branches is set to master in a parent job, then Zuul
# will not match that job when it collects job variants.
#
# Do not inherit from any parent job which sets job.required-projects.override-checkout on openstack/devstack
# because Zuul would use that git ref instead of stable branch defined below to checkout projects of parent devstack
# jobs when collecting variants for parent jobs.
parent: ansible-collections-openstack-functional-devstack-base
description: |
Run openstack collections functional tests against a xena devstack
using xena branch of openstacksdk and stable 2.12 branch of ansible
branches: stable/1.0.0
override-checkout: stable/xena
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.12
- # Choose parent devstack job from stable/1.0.0 branch instead of non-existing stable/xena branch
name: openstack/ansible-collections-openstack
override-checkout: stable/1.0.0
- # Choose parent devstack job from stable/xena branch
name: openstack/devstack
override-checkout: stable/xena
- name: openstack/designate
override-checkout: stable/xena
- name: openstack/openstacksdk
override-checkout: stable/xena
vars:
tox_envlist: ansible_2_12
- job:
name: ansible-collections-openstack-functional-devstack-wallaby-ansible-2.12
# Do not inherit from any parent job which does not run for branch stable/1.0.0 because Zuul would dismiss this job
# when collecting parent job variants. For example, when job.branches is set to master in a parent job, then Zuul
# will not match that job when it collects job variants.
#
# Do not inherit from any parent job which sets job.required-projects.override-checkout on openstack/devstack
# because Zuul would use that git ref instead of stable branch defined below to checkout projects of parent devstack
# jobs when collecting variants for parent jobs.
parent: ansible-collections-openstack-functional-devstack-base
description: |
Run openstack collections functional tests against a wallaby devstack
using wallaby branch of openstacksdk and stable 2.12 branch of ansible
branches: stable/1.0.0
override-checkout: stable/wallaby
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.12
- # Choose parent devstack job from stable/1.0.0 branch instead of non-existing stable/wallaby branch
name: openstack/ansible-collections-openstack
override-checkout: stable/1.0.0
- # Choose parent devstack job from stable/wallaby branch
name: openstack/devstack
override-checkout: stable/wallaby
- name: openstack/designate
override-checkout: stable/wallaby
- name: openstack/openstacksdk
override-checkout: stable/wallaby
vars:
tox_envlist: ansible_2_12
- job:
name: ansible-collections-openstack-functional-devstack-victoria-ansible-2.12
# Do not inherit from any parent job which does not run for branch stable/1.0.0 because Zuul would dismiss this job
# when collecting parent job variants. For example, when job.branches is set to master in a parent job, then Zuul
# will not match that job when it collects job variants.
#
# Do not inherit from any parent job which sets job.required-projects.override-checkout on openstack/devstack
# because Zuul would use that git ref instead of stable branch defined below to checkout projects of parent devstack
# jobs when collecting variants for parent jobs.
parent: ansible-collections-openstack-functional-devstack-base
description: |
Run openstack collections functional tests against a victoria devstack
using victoria branch of openstacksdk and stable 2.12 branch of ansible
branches: stable/1.0.0
override-checkout: stable/victoria
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.12
- # Choose parent devstack job from stable/1.0.0 branch instead of non-existing stable/victoria branch
name: openstack/ansible-collections-openstack
override-checkout: stable/1.0.0
- # Choose parent devstack job from stable/victoria branch
name: openstack/devstack
override-checkout: stable/victoria
- name: openstack/designate
override-checkout: stable/victoria
- name: openstack/openstacksdk
override-checkout: stable/victoria
vars:
tox_envlist: ansible_2_12
- job:
name: ansible-collections-openstack-functional-devstack-ussuri-ansible-2.11
# Do not inherit from any parent job which does not run for branch stable/1.0.0 because Zuul would dismiss this job
# when collecting parent job variants. For example, when job.branches is set to master in a parent job, then Zuul
# will not match that job when it collects job variants.
#
# Do not inherit from any parent job which sets job.required-projects.override-checkout on openstack/devstack
# because Zuul would use that git ref instead of stable branch defined below to checkout projects of parent devstack
# jobs when collecting variants for parent jobs.
parent: ansible-collections-openstack-functional-devstack-base
description: |
Run openstack collections functional tests against a ussuri devstack
using ussuri branch of openstacksdk and stable 2.11 branch of ansible
branches: stable/1.0.0
override-checkout: stable/ussuri
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- # Choose parent devstack job from stable/1.0.0 branch instead of non-existing stable/ussuri branch
name: openstack/ansible-collections-openstack
override-checkout: stable/1.0.0
- # Choose parent devstack job from stable/ussuri branch
name: openstack/devstack
override-checkout: stable/ussuri
- name: openstack/designate
override-checkout: stable/ussuri
- name: openstack/openstacksdk
override-checkout: stable/ussuri
vars:
tox_envlist: ansible_2_11
- job:
name: ansible-collections-openstack-functional-devstack-train-ansible-2.11
# Do not inherit from any parent job which does not run for branch stable/1.0.0 because Zuul would dismiss this job
# when collecting parent job variants. For example, when job.branches is set to master in a parent job, then Zuul
# will not match that job when it collects job variants.
#
# Do not inherit from any parent job which sets job.required-projects.override-checkout on openstack/devstack
# because Zuul would use that git ref instead of stable branch defined below to checkout projects of parent devstack
# jobs when collecting variants for parent jobs.
parent: ansible-collections-openstack-functional-devstack-base
description: |
Run openstack collections functional tests against a train devstack
using train brach of openstacksdk and devel branch of ansible
# non-voting because we can't prevent ansible devel from breaking us
voting: false
using train branch of openstacksdk and stable 2.11 branch of ansible
branches: stable/1.0.0
override-checkout: stable/train
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- # Choose parent devstack job from stable/1.0.0 branch instead of non-existing stable/train branch
name: openstack/ansible-collections-openstack
override-checkout: stable/1.0.0
- # Choose parent devstack job from stable/train branch
name: openstack/devstack
override-checkout: stable/train
- name: openstack/designate
override-checkout: train-eol
- name: openstack/openstacksdk
override-checkout: stable/train
vars:
tox_envlist: ansible_2_11
# Linters
- job:
name: openstack-tox-linters-ansible
parent: openstack-tox-linters
description: |
Run openstack collections linter tests using the devel branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
- name: openstack/openstacksdk
override-branch: train
- name: openstack/devstack
override-checkout: train
- job:
name: ansible-collections-openstack-functional-devstack-train-ansible-2.9
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a train devstack
using train brach of openstacksdk and stable 2.9 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- name: openstack/openstacksdk
override-branch: train
- name: openstack/devstack
override-checkout: train
- job:
name: ansible-collections-openstack-functional-devstack-stein-ansible-devel
parent: ansible-collections-openstack-functional-devstack
description: |
Run openstack collections functional tests against a stein devstack
using stein brach of openstacksdk and devel branch of ansible
# non-voting because we can't prevent ansible devel from breaking us
voting: false
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
- name: openstack/openstacksdk
override-branch: stein
- name: openstack/devstack
override-checkout: stein
- job:
name: ansible-collections-openstack-functional-devstack-stein-ansible-2.9
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a stein devstack
using stein brach of openstacksdk and stable 2.9 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- name: openstack/openstacksdk
override-branch: stein
- name: openstack/devstack
override-checkout: stein
- job:
name: ansible-collections-openstack-functional-devstack-rocky-ansible-devel
parent: ansible-collections-openstack-functional-devstack
description: |
Run openstack collections functional tests against a rocky devstack
using rocky brach of openstacksdk and devel branch of ansible
# non-voting because we can't prevent ansible devel from breaking us
voting: false
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
- name: openstack/openstacksdk
override-branch: rocky
- name: openstack/devstack
override-checkout: rocky
- job:
name: ansible-collections-openstack-functional-devstack-rocky-ansible-2.9
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a rocky devstack
using rocky brach of openstacksdk and stable 2.9 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- name: openstack/openstacksdk
override-branch: rocky
- name: openstack/devstack
override-checkout: rocky
- job:
name: ansible-collections-openstack-functional-devstack-queens-ansible-2.9
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a queens devstack
using master brach of openstacksdk and stable 2.9 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- name: openstack/openstacksdk
override-branch: master
- name: openstack/devstack
override-checkout: queens
vars:
# override tox_constraints_file from parent job
tox_constraints_file: '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/constraints-none.txt'
tox_envlist: linters_latest
tox_install_siblings: true
- job:
name: openstack-tox-linters-ansible-devel
parent: openstack-tox-linters
parent: openstack-tox-linters-ansible
nodeset: ubuntu-jammy
description: |
Run openstack collections linter tests using the devel branch of ansible
# non-voting because we can't prevent ansible devel from breaking us
voting: false
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
vars:
python_version: '3.10'
bindep_profile: test py310
- job:
name: openstack-tox-linters-ansible-2.9
parent: openstack-tox-linters
name: openstack-tox-linters-ansible-2.12
parent: openstack-tox-linters-ansible
nodeset: ubuntu-focal
description: |
Run openstack collections linter tests using the 2.9 branch of ansible
voting: true
Run openstack collections linter tests using the 2.12 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
override-checkout: stable-2.12
vars:
ensure_tox_version: '<4'
tox_envlist: linters_2_12
python_version: 3.8
bindep_profile: test py38
# Cross-checks with other projects
- job:
name: bifrost-collections-src
parent: bifrost-integration-tinyipa-ubuntu-focal
override-checkout: stable/yoga
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- openstack/ansible-collections-openstack
- # always use existing branch when collecting parent job variants, refer to git blame for rationale.
name: openstack/bifrost
# Yoga has the latest SDK release of the 0.*.* series atm
override-checkout: stable/yoga
- job:
name: bifrost-keystone-collections-src
parent: bifrost-integration-tinyipa-keystone-ubuntu-focal
override-checkout: stable/yoga
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- openstack/ansible-collections-openstack
- # always use existing branch when collecting parent job variants, refer to git blame for rationale.
name: openstack/bifrost
# Yoga has the latest SDK release of the 0.*.* series atm
override-checkout: stable/yoga
- job:
name: ansible-collections-openstack-release
parent: base
run: ci/publish/publish_collection.yml
- project:
check:
jobs:
- tox-pep8
- openstack-tox-linters-ansible-devel
- openstack-tox-linters-ansible-2.9
- ansible-collections-openstack-functional-devstack:
dependencies: &deps_unit_lint
- tox-pep8
- openstack-tox-linters-ansible-2.9
irrelevant-files: &ignore_files
- changelogs/.*
- COPYING
- docs/.*
- README.md
- tools/run-ansible-sanity.sh
- tests/sanity/.*
- ansible-collections-openstack-functional-devstack-releases:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-ansible-devel:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-train-ansible-devel:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-train-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-stein-ansible-devel:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-stein-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-rocky-ansible-devel:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-rocky-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-queens-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
dependencies:
- tox-pep8
gate:
jobs:
- tox-pep8
- openstack-tox-linters
- ansible-collections-openstack-functional-devstack
- ansible-collections-openstack-functional-devstack-releases
periodic:
jobs:
- openstack-tox-linters-ansible-devel
- openstack-tox-linters-ansible-2.12
- ansible-collections-openstack-functional-devstack-releases
- ansible-collections-openstack-functional-devstack-ansible-2.9
- ansible-collections-openstack-functional-devstack-train-ansible-2.9
- ansible-collections-openstack-functional-devstack-stein-ansible-2.9
- ansible-collections-openstack-functional-devstack-rocky-ansible-2.9
- ansible-collections-openstack-functional-devstack-queens-ansible-2.9
- ansible-collections-openstack-functional-devstack-ansible-2.12
- ansible-collections-openstack-functional-devstack-ansible-devel
- ansible-collections-openstack-functional-devstack-xena-ansible-2.12
- ansible-collections-openstack-functional-devstack-wallaby-ansible-2.12
- ansible-collections-openstack-functional-devstack-victoria-ansible-2.12
- ansible-collections-openstack-functional-devstack-train-ansible-2.11
- bifrost-collections-src
- bifrost-keystone-collections-src
- ansible-collections-openstack-functional-devstack-magnum
- ansible-collections-openstack-functional-devstack-octavia
experimental:
jobs:
- ansible-collections-openstack-functional-devstack-ansible-2.11
- ansible-collections-openstack-functional-devstack-victoria-ansible-2.12
- ansible-collections-openstack-functional-devstack-ussuri-ansible-2.11
tag:
jobs:
- ansible-collections-openstack-release

534
CHANGELOG.rst Normal file
View File

@@ -0,0 +1,534 @@
=============================================
Openstack Cloud Ansilbe modules Release Notes
=============================================
.. contents:: Topics
v1.10.0
=======
Release Summary
---------------
Enable logging of openstacksdk activities and warn users about incompatible openstacksdk releases when using inventory plugin
Bugfixes
--------
- Add SDK logging option for openstack ansible collections
- Don't use deprecated distutils from python 3.10
- Ensure openstacksdk compatibility in inventory plugin
- Lowered maximum OpenStack SDK version to 0.98.999 in inventory plugin
Known Issues
------------
- For compatibility with OpenStack SDK >= 0.99.0 use Ansible OpenStack collection 2.0.0 or later which is currently under development.
- Release series 1.x.x of this collection is compatible to OpenStack SDK prior to 0.99.0 only.
v1.9.1
======
Release Summary
---------------
Bugfix in keypair module
Bugfixes
--------
- Do not remove trailing spaces when reading public key in keypair module
Known Issues
------------
- For compatibility with OpenStack SDK >= 0.99.0 use Ansible OpenStack collection 2.0.0 or later which is currently under development.
- Release series 1.x.x of this collection is compatible to OpenStack SDK prior to 0.99.0 only.
v1.9.0
======
Release Summary
---------------
This release will enforce openstacksdk<0.99.0, has a dozen modules refactored and several bugs fixed.
Bugfixes
--------
- Added support for specifying a maximum version of the OpenStack SDK
- Constrain filters in compute_service_info to SDK >= 0.53.0
- Drop username from return values of identity_user_info
- Fix logic in routers_info
- Fixed return value disable{d,s}_reason in compute_service_info module
- Fixed return values in compute_service_info module again
- Follow up to bump of minimum required OpenStack SDK release to SDK 0.36.0 (Train)
- Lowered maximum OpenStack SDK version to 0.98.999
- Move dns zone info to use proxy layer
- Refactored catalog_service module
- Refactored endpoint module
- Refactored host_aggregate module
- Refactored identity_domain_info module
- Refactored identity_group_info module
- Refactored identity_role module
- Refactored identity_role_info module
- Refactored identity_user module
- Refactored identity_user_info module
- Refactored image_info module
- Refactored keypair_info module
- Refactored recordset module
- Refactored role_assignment module
- Set owner in image module
- Support description in sg-rule creation
- Warn users about us breaking backward compatibility
Known Issues
------------
- For compatibility with OpenStack SDK >= 0.99.0 use Ansible OpenStack collection 2.0.0 or later which is currently under development.
- Release series 1.x.x of this collection is compatible to OpenStack SDK prior to 0.99.0 only.
v1.8.0
======
Release Summary
---------------
Subnet pool module and bugfixes
Bugfixes
--------
- Add 'all_projects' to server_action module
- Add subnet pool module
- Bumped minimum required OpenStack SDK release to SDK 0.36.0 (Train)
- Changed compute_flavor_info module to use OpenStack SDK's proxy layer
- Dropped deprecated return values in floating_ip_info and assert remaining fields
- Fix ansible-lint issues for the newest version
- Fix assertion after stack deletion
- Handle aggregate host list set to None
- Reenabled check-import.sh which tests imports to Ansible Galaxy
- Remove old, unsupported parameters from documentation in image_info module
- Router - Remove unneeded 'filter' parameter
- Updated return value docs of compute_service_info module
New Modules
-----------
- openstack.cloud.subnet_pool - Create or Delete subnet pools from OpenStack.
v1.7.2
======
Release Summary
---------------
Bugfixes
Bugfixes
--------
- Fix collection guidelines
v1.7.1
======
Release Summary
---------------
Bugfixes
Minor Changes
-------------
- lb_member - Add monitor_[address,port] parameter
Bugfixes
--------
- openstack_inventory - Fix documentation
- quota - Fix description of volumes_types parameter
v1.7.0
======
Release Summary
---------------
New modules for Ironic and bugfixes
Minor Changes
-------------
- openstack_inventory - Adds use_name variable
- port - Add dns_[name,domain] to the port module
- project - Remove project properties tests and support
Bugfixes
--------
- identity_user_info - Fix identity user lookup with a domain
- keystone_domain - Move identity domain to use proxy layer
New Modules
-----------
- openstack.cloud.baremetal_node_info - Retrieve information about Bare Metal nodes from OpenStack an object.
- openstack.cloud.baremetal_port - Create, Update, Remove ironic ports from OpenStack
- openstack.cloud.baremetal_port_info - Retrieve information about Bare Metal ports from OpenStack an object.
v1.6.0
======
Release Summary
---------------
New modules for RBAC and Nova services
Minor Changes
-------------
- quota - Adds metadata_items parameter
New Modules
-----------
- openstack.cloud.compute_service_info - Retrieve information about one or more OpenStack compute services
- openstack.cloud.neutron_rbac_policies_info - Fetch Neutron policies.
- openstack.cloud.neutron_rbac_policy - Create or delete a Neutron policy to apply a RBAC rule against an object.
v1.5.3
======
Release Summary
---------------
Bugfixes
Bugfixes
--------
- Don't require allowed_address_pairs for port
- server_volume - check specified server is found
v1.5.2
======
Release Summary
---------------
Bugfixes
Minor Changes
-------------
- Add documentation links to README.md
- Don't run functional jobs on galaxy.yml change
- Move CI to use Ansible 2.12 version as main
Bugfixes
--------
- Add client and member listener timeouts for persistence (Ex. SSH)
- Added missing warn() used in cloud.openstack.quota
- Fix issue with same host and group names
- Flavor properties are not deleted on changes and id will stay
v1.5.1
======
Release Summary
---------------
Bugfixes for networking modules
Minor Changes
-------------
- Changed minversion in tox to 3.18.0
- Update IRC server in README
Bugfixes
--------
- Add mandatory requires_ansible version to metadata
- Add protocol listener octavia
- Add support check mode for all info modules
- Allow to attach multiple floating ips to a server
- Only add or remove router interfaces when needed
- Wait for pool to be active and online
v1.5.0
======
Release Summary
---------------
New modules for DNS and FIPs and bugfixes.
Minor Changes
-------------
- Add bindep.txt for ansible-builder
- Add check_mode attribute to OpenstackModule
- Migrating image module from AnsibleModule to OpenStackModule
- Switch KeystoneFederationProtocolInfo module to OpenStackModule
- Switch ProjectAccess module to OpenStackModule
- Switch Quota module to OpenStackModule
- Switch Recordset module to OpenStackModule
- Switch ServerGroup module to OpenStackModule
- Switch ServerMetadata module to OpenStackModule
- Switch Snapshot module to OpenStackModule
- Switch Stack module to OpenStackModule
- Switch auth module to OpenStackModule
- Switch catalog_service module to OpenStackModule
- Switch coe_cluster module to OpenStackModule
- Switch coe_cluster_template module to OpenStackModule
- Switch endpoint module to OpenStackModule
- Switch federation_idp module to OpenStackModule
- Switch federation_idp_info module to OpenStackModule
- Switch federation_mapping module to OpenStackModule
- Switch federation_mapping_info module to OpenStackModule
- Switch federation_protocol module to OpenStackModule
- Switch flavor module to OpenStackModule
- Switch flavor_info module to OpenStackModule
- Switch floating_ip module to OpenStackModule
- Switch group_assignment module to OpenStackModule
- Switch hostaggregate module to OpenStackModule
- Switch identity_domain module to OpenStackModule
- Switch identity_domain_info module to OpenStackModule
- Switch identity_group module to OpenStackModule
- Switch identity_group_info module to OpenStackModule
- Switch identity_role module to OpenStackModule
- Switch identity_user module to OpenStackModule
- Switch lb_listener module to OpenStackModule
- Switch lb_member module to OpenStackModule
- Switch lb_pool module to OpenStackModule
- Switch object module to OpenStackModule
- Switch port module to OpenStackModule
- Switch port_info module to OpenStackModule
- Switch project and project_info module to OpenStackModule
- Switch role_assignment module to OpenStackModule
- Switch user_info module to OpenStackModule
- image - Add support to setting image tags
Bugfixes
--------
- Update checks for validate_certs in openstack_cloud_from_module
- compute_flavor - Fix the idempotent of compute_flavor module
- host_aggregate - Fix host_aggregate to tolerate aggregate.hosts being None
- inventory/openstack - Fix inventory plugin on Ansible 2.11
- port - fix update on empty list of allowed address pairs
- setup.cfg Replace dashes with underscores
- subnet - Only apply necessary changes to subnets
- volume - Fail if referenced source image for a new volume does not exist
New Modules
-----------
- openstack.cloud.address_scope - Create or delete address scopes from OpenStack
- openstack.cloud.dns_zone_info - Getting information about dns zones
- openstack.cloud.floating_ip_info - Get information about floating ips
v1.4.0
======
Release Summary
---------------
New object_container module and bugfixes.
Bugfixes
--------
- Add Octavia job for testing Load Balancer
- Add binding profile to port module
- Add execution environment metadata
- Fix CI for latest ansible-test with no_log
- Fix issues with newest ansible-test 2.11
- Prepare for Ansible 2.11 tests
- add option to exclude legacy groups
- security_group_rule add support ipv6-icmp
New Modules
-----------
- openstack.cloud.object_container - Manage Swift container
v1.3.0
======
Release Summary
---------------
New modules and bugfixes.
Minor Changes
-------------
- Fix some typos in readme
- Guidelines Fix links and formatting
- baremetal_node - Add support for new features
- baremetal_node - ironic deprecate sub-options of driver_info
- baremetal_node - ironic stop putting meaningless values to properties
- image_info - Migrating image_info module from AnsibleModule to OpenStackModule
- recordset - Update recordset docu
- server - Allow description field to be set with os_server
- server_action - Added shelve and unshelve as new server actions
Bugfixes
--------
- port - Fixed check for None in os_port
- project - Fix setting custom property on os_project
- security_group_rule - Remove protocols choice in security rules
- volume_info - Fix volume_info result for SDK < 0.19
New Modules
-----------
- openstack.cloud.identity_role_info - Retrieve information about Openstack Identity roles.
- openstack.cloud.keypair_info - Retrieve information about Openstack key pairs.
- openstack.cloud.security_group_info - Retrieve information about Openstack Security Groups.
- openstack.cloud.security_group_rule_info - Retrieve information about Openstack Security Group rules.
- openstack.cloud.stack_info - Retrieve information about Openstack Heat stacks.
v1.2.1
======
Release Summary
---------------
Porting modules to new OpenstackModule class and fixes.
Minor Changes
-------------
- dns_zone - Migrating dns_zone from AnsibleModule to OpenStackModule
- dns_zone, recordset - Enable update for recordset and add tests for dns and recordset module
- endpoint - Do not fail when endpoint state is absent
- ironic - Refactor ironic authentication into a new module_utils module
- loadbalancer - Refactor loadbalancer module
- network - Migrating network from AnsibleModule to OpenStackModule
- networks_info - Migrating networks_info from AnsibleModule to OpenStackModule
- openstack - Add galaxy.yml to support install from git
- openstack - Fix docs-args mismatch in modules
- openstack - OpenStackModule Support defining a minimum version of the SDK
- router - Migrating routers from AnsibleModule to OpenStackModule
- routers_info - Added deprecated_names for router_info module
- routers_info - Migrating routers_info from AnsibleModule to OpenStackModule
- security_group.py - Migrating security_group from AnsibleModule to OpenStackModule
- security_group_rule - Refactor TCP/UDP port check
- server.py - Improve "server" module with OpenstackModule class
- server_volume - Migrating server_volume from AnsibleModule to OpenStackModule
- subnet - Fix subnets update and idempotency
- subnet - Migrating subnet module from AnsibleModule to OpenStackModule
- subnets_info - Migrating subnets_info from AnsibleModule to OpenStackModule
- volume.py - Migrating volume from AnsibleModule to OpenStackModule
- volume_info - Fix volume_info arguments for SDK 0.19
v1.2.0
======
Release Summary
---------------
New volume backup modules.
Minor Changes
-------------
- lb_health_monitor - Make it possible to create a health monitor to a pool
New Modules
-----------
- openstack.cloud.volume_backup module - Add/Delete Openstack volumes backup.
- openstack.cloud.volume_backup_info module - Retrieve information about Openstack volume backups.
- openstack.cloud.volume_snapshot_info module - Retrieve information about Openstack volume snapshots.
v1.1.0
======
Release Summary
---------------
Starting redesign modules and bugfixes.
Minor Changes
-------------
- A basic module subclass was introduced and a few modules moved to inherit from it.
- Add more useful information from exception
- Added pip installation option for collection.
- Added template for generation of artibtrary module.
- baremetal modules - Do not require ironic_url if cloud or auth.endpoint is provided
- inventory_openstack - Add openstack logger and Ansible display utility
- loadbalancer - Add support for setting the Flavor when creating a load balancer
Bugfixes
--------
- Fix non existing attribuites in SDK exception
- security_group_rule - Don't pass tenant_id for remote group
New Modules
-----------
- openstack.cloud.volume_info - Retrieve information about Openstack volumes.
v1.0.1
======
Release Summary
---------------
Bugfix for server_info
Bugfixes
--------
- server_info - Fix broken server_info module and add tests
v1.0.0
======
Release Summary
---------------
Initial release of collection.
Minor Changes
-------------
- Renaming all modules and removing "os" prefix from names.
- baremetal_node_action - Support json type for the ironic_node config_drive parameter
- config - Update os_client_config to use openstacksdk
- host_aggregate - Add support for not 'purging' missing hosts
- project - Add properties for os_project
- server_action - pass imageRef to rebuild
- subnet - Updated allocation pool checks
Bugfixes
--------
- baremetal_node - Correct parameter name
- coe_cluster - Retrive id/uuid correctly
- federation_mapping - Fixup some minor nits found in followup reviews
- inventory_openstack - Fix constructed compose
- network - Bump minimum openstacksdk version when using os_network/dns_domain
- role_assignment - Fix os_user_role for groups in multidomain context
- role_assignment - Fix os_user_role issue to grant a role in a domain
New Modules
-----------
- openstack.cloud.federation_idp - Add support for Keystone Identity Providers
- openstack.cloud.federation_idp_info - Add support for fetching the information about federation IDPs
- openstack.cloud.federation_mapping - Add support for Keystone mappings
- openstack.cloud.federation_mapping_info - Add support for fetching the information about Keystone mappings
- openstack.cloud.keystone_federation_protocol - Add support for Keystone federation Protocols
- openstack.cloud.keystone_federation_protocol_info - Add support for getting information about Keystone federation Protocols
- openstack.cloud.routers_info - Retrieve information about one or more OpenStack routers.

View File

@@ -1,40 +0,0 @@
.. _contributing:
=============================================
Contributing to ansible-collections-openstack
=============================================
If you're interested in contributing to the ansible-collections-openstack project,
the following will help get you started.
Developer Workflow
------------------
OpenStack uses OpenDev for it's development, and patches are submitted to
`OpenDev Gerrit`_. Please read `DeveloperWorkflow`_ before sending your
first patch for review.
Pull requests submitted through GitHub will be ignored.
.. seealso::
* https://wiki.openstack.org/wiki/How_To_Contribute
* https://wiki.openstack.org/wiki/CLA
.. _OpenDev Gerrit: https://review.opendev.org/
.. _DeveloperWorkflow: https://docs.openstack.org/infra/manual/developers.html#development-workflow
Project Hosting Details
-----------------------
Bug tracker
https://storyboard.openstack.org/#!/project/openstack/ansible-collections-openstack
Mailing list (prefix subjects with ``[ansible]`` for faster responses)
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-discuss
Code Hosting
https://opendev.org/openstack/ansible-collections-openstack
Code Review
https://review.opendev.org/#/q/status:open+project:openstack/ansible-collections-openstack,n,z

140
README.md
View File

@@ -1,34 +1,75 @@
[![OpenDev Zuul Builds - Ansible Collection OpenStack](https://zuul-ci.org/gated.svg)](http://zuul.opendev.org/t/openstack/builds?project=openstack%2Fansible-collections-openstack#)
[![OpenDev Zuul Builds - Ansible OpenStack Collection](https://zuul-ci.org/gated.svg)](
http://zuul.opendev.org/t/openstack/builds?project=openstack%2Fansible-collections-openstack)
# Ansible Collection: openstack.cloud
# Ansible OpenStack Collection
Ansible OpenStack collection aka `openstack.cloud` provides Ansible modules and Ansible plugins for managing OpenStack
clouds. It is supported and maintained by the OpenStack community.
This repo hosts the `openstack.cloud` Ansible Collection.
## Branches and Non Backward Compatibility ⚠️
The collection includes the Openstack modules and plugins supported by Openstack community to help the management of Openstack infrastructure.
Our codebase has been split into two separate release series, `2.x.x` and `1.x.x`:
## Installation and Usage
* `2.x.x` releases of Ansible OpenStack collection are compatible with [OpenStack SDK][openstacksdk] `1.x.x` and its
release candidates `0.99.0` and later *only* (OpenStack Zed and later). Our `master` branch tracks our `2.x.x`
releases.
* `1.x.x` releases of Ansible OpenStack collection are compatible with [OpenStack SDK][openstacksdk] `0.x.x` prior to
`0.99.0` *only* (OpenStack Yoga and earlier). Our `stable/1.0.0` branch tracks our `1.x.x` releases.
* `2.x.x` releases of Ansible OpenStack collection are not backward compatible to `1.x.x` releases ⚠️
### Installing the Collection from Ansible Galaxy
For rationale and details please read our [branching docs](docs/branching.md). Both branches will be developed in
parallel for the time being. Patches from `master` will be backported to `stable/1.0.0` on a best effort basis but
expect new features to be introduced in our `master` branch only. Contributions are welcome for both branches!
Before using the Openstack Cloud collection, you need to install the collection with the `ansible-galaxy` CLI:
[openstacksdk]: https://opendev.org/openstack/openstacksdk
`ansible-galaxy collection install openstack.cloud`
## Installation
You can also include it in a `requirements.yml` file and install it via `ansible-galaxy collection install -r requirements.yml` using the format:
For using this collection, first you have to install both Python packages `ansible` and `openstacksdk` on your Ansible
controller:
```sh
pip install "ansible>=2.9" "openstacksdk>=0.36,<0.99.0"
```
[OpenStack SDK][openstacksdk] has to be available on the Ansible host running the OpenStack modules. Depending on the
Ansible playbook and roles you use, this host is not necessarily the Ansible controller. Sometimes Ansible might invoke
a non-standard Python interpreter on the target Ansible host. Using Python 3.6 is required for modules in this
collection.
Always use the last stable version of [OpenStack SDK][openstacksdk] if possible, also when running against older
OpenStack deployments. OpenStack SDK is backward compatible to older OpenStack deployments, so its safe to run last
version of the SDK against older OpenStack clouds. The installed version of the OpenStack SDK does not have to match
your OpenStack cloud, but it has to match the release series of this collection which you are using. For notes about
our release series and branches please read the introduction above.
Before using this collection, you have to install it with `ansible-galaxy`:
```sh
ansible-galaxy collection install openstack.cloud
```
You can also include it in a `requirements.yml` file:
```yaml
collections:
- name: openstack.cloud
```
### Playbooks
And then install it with:
To use a module from Openstack Cloud collection, please reference the full namespace, collection name, and modules name that you want to use:
```sh
ansible-galaxy collection install -r requirements.yml
```
## Usage
To use a module from the OpenStack Cloud collection, please reference the full namespace, collection name, and module
name that you want to use:
```yaml
---
- name: Using Openstack Cloud collection
- name: Using OpenStack Cloud collection
hosts: localhost
tasks:
- openstack.cloud.server:
@@ -42,11 +83,11 @@ To use a module from Openstack Cloud collection, please reference the full names
volume_size: 75
```
Or you can add full namepsace and collecton name in the `collections` element:
Or you can add the full namespace and collection name in the `collections` element:
```yaml
---
- name: Using Openstack Cloud collection
- name: Using the Ansible OpenStack Collection
hosts: localhost
collections:
- openstack.cloud
@@ -59,41 +100,64 @@ Or you can add full namepsace and collecton name in the `collections` element:
device: /dev/vdb
```
[Ansible module defaults][ansible-module-defaults] are supported as well:
```yaml
---
- module_defaults:
group/openstack.cloud.openstack:
cloud: devstack-admin
#
#
# Listing modules individually is required for
# backward compatibility with Ansible 2.9 only
openstack.cloud.compute_flavor_info:
cloud: devstack-admin
openstack.cloud.server_info:
cloud: devstack-admin
block:
- name: List compute flavors
openstack.cloud.compute_flavor_info:
- name: List servers
openstack.cloud.server_info:
```
[ansible-module-defaults]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_module_defaults.html
## Documentation
See collection docs at Ansible's main page:
* [openstack.cloud collection docs (version released in Ansible package)](
https://docs.ansible.com/ansible/latest/collections/openstack/cloud/index.html)
* [openstack.cloud collection docs (devel version)](
https://docs.ansible.com/ansible/devel/collections/openstack/cloud/index.html)
## Contributing
For information on contributing, please see [CONTRIBUTING](https://opendev.org/openstack/ansible-collections-openstack/src/branch/master/CONTRIBUTING.rst)
Thank you for your interest in our Ansible OpenStack collection ☺️
There are many ways in which you can participate in the project, for example:
- Submit bugs and feature requests, and help us verify them
- Submit and review source code changes in [Openstack Gerrit](https://review.opendev.org/#/q/project:openstack/ansible-collections-openstack)
- Add new modules for Openstack Cloud
- [Report and verify bugs and help with solving issues](
https://storyboard.openstack.org/#!/project/openstack/ansible-collections-openstack).
- [Submit and review patches](
https://review.opendev.org/#/q/project:openstack/ansible-collections-openstack).
- Follow OpenStack's [How To Contribute](https://wiki.openstack.org/wiki/How_To_Contribute) guide.
We work with [OpenDev Gerrit](https://review.opendev.org/), pull requests submitted through GitHub will be ignored.
## Testing and Development
If you want to develop new content for this collection or improve what is already here, the easiest way to work on the collection is to clone it into one of the configured [`COLLECTIONS_PATHS`](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#collections-paths), and work on it there.
### Testing with `ansible-test`
We use `ansible-test` for sanity:
```bash
tox -e linters
```
## More Information
TBD
Please read our [Contributions and Development Guide](docs/contributing.md) (⚠️) and our [Review Guide](
docs/reviewing.md) (⚠️) before sending your first patch. Pull requests submitted through GitHub will be ignored.
## Communication
We have a dedicated Interest Group for Openstack Ansible modules.
You can find other people interested in this in `#openstack-ansible-sig` on Freenode IRC.
We have a Special Interest Group for the Ansible OpenStack collection. Join us in `#openstack-ansible-sig` on
[OFTC IRC](https://www.oftc.net/) and ping Artem Goncharov <artem.goncharov@gmail.com> (gtema), Jakob Meng
<mail@jakobmeng.de> (jm1) or Sagi Shnaidman <sshnaidm@redhat.com> (sshnaidm) 🍪
## License
GNU General Public License v3.0 or later
See [LICENCE](https://opendev.org/openstack/ansible-collections-openstack/src/branch/master/COPYING) to see the full text.
See [LICENCE](COPYING) to see the full text.

7
bindep.txt Normal file
View File

@@ -0,0 +1,7 @@
# This is a cross-platform list tracking distribution packages needed by tests;
# see https://docs.openstack.org/infra/bindep/ for additional information.
gcc [compile platform:centos-8 platform:rhel-8]
python38-cryptography [platform:centos-8 platform:rhel-8]
python38-devel [compile platform:centos-8 platform:rhel-8]
python38-requests [platform:centos-8 platform:rhel-8]

406
changelogs/changelog.yaml Normal file
View File

@@ -0,0 +1,406 @@
ancestor: null
releases:
1.0.0:
changes:
bugfixes:
- baremetal_node - Correct parameter name
- coe_cluster - Retrive id/uuid correctly
- federation_mapping - Fixup some minor nits found in followup reviews
- inventory_openstack - Fix constructed compose
- network - Bump minimum openstacksdk version when using os_network/dns_domain
- role_assignment - Fix os_user_role for groups in multidomain context
- role_assignment - Fix os_user_role issue to grant a role in a domain
minor_changes:
- Renaming all modules and removing "os" prefix from names.
- baremetal_node_action - Support json type for the ironic_node config_drive
parameter
- config - Update os_client_config to use openstacksdk
- host_aggregate - Add support for not 'purging' missing hosts
- project - Add properties for os_project
- server_action - pass imageRef to rebuild
- subnet - Updated allocation pool checks
release_summary: Initial release of collection.
modules:
- description: Add support for Keystone Identity Providers
name: federation_idp
namespace: ''
- description: Add support for fetching the information about federation IDPs
name: federation_idp_info
namespace: ''
- description: Add support for Keystone mappings
name: federation_mapping
namespace: ''
- description: Add support for fetching the information about Keystone mappings
name: federation_mapping_info
namespace: ''
- description: Add support for Keystone federation Protocols
name: keystone_federation_protocol
namespace: ''
- description: Add support for getting information about Keystone federation Protocols
name: keystone_federation_protocol_info
namespace: ''
- description: Retrieve information about one or more OpenStack routers.
name: routers_info
namespace: ''
release_date: '2020-05-19'
1.0.1:
changes:
bugfixes:
- server_info - Fix broken server_info module and add tests
release_summary: Bugfix for server_info
release_date: '2020-05-22'
1.1.0:
changes:
bugfixes:
- Fix non existing attribuites in SDK exception
- security_group_rule - Don't pass tenant_id for remote group
minor_changes:
- A basic module subclass was introduced and a few modules moved to inherit
from it.
- Add more useful information from exception
- Added pip installation option for collection.
- Added template for generation of artibtrary module.
- baremetal modules - Do not require ironic_url if cloud or auth.endpoint is
provided
- inventory_openstack - Add openstack logger and Ansible display utility
- loadbalancer - Add support for setting the Flavor when creating a load balancer
release_summary: Starting redesign modules and bugfixes.
modules:
- description: Retrieve information about Openstack volumes.
name: volume_info
namespace: ''
release_date: '2020-08-17'
1.10.0:
changes:
bugfixes:
- Add SDK logging option for openstack ansible collections
- Don't use deprecated distutils from python 3.10
- Ensure openstacksdk compatibility in inventory plugin
- Lowered maximum OpenStack SDK version to 0.98.999 in inventory plugin
known_issues:
- For compatibility with OpenStack SDK >= 0.99.0 use Ansible OpenStack collection
2.0.0 or later which is currently under development.
- Release series 1.x.x of this collection is compatible to OpenStack SDK prior
to 0.99.0 only.
release_summary: Enable logging of openstacksdk activities and warn users about
incompatible openstacksdk releases when using inventory plugin
release_date: '2022-10-04'
1.2.0:
changes:
minor_changes:
- lb_health_monitor - Make it possible to create a health monitor to a pool
release_summary: New volume backup modules.
modules:
- description: Add/Delete Openstack volumes backup.
name: volume_backup module
namespace: ''
- description: Retrieve information about Openstack volume backups.
name: volume_backup_info module
namespace: ''
- description: Retrieve information about Openstack volume snapshots.
name: volume_snapshot_info module
namespace: ''
release_date: '2020-10-13'
1.2.1:
changes:
minor_changes:
- dns_zone - Migrating dns_zone from AnsibleModule to OpenStackModule
- dns_zone, recordset - Enable update for recordset and add tests for dns and
recordset module
- endpoint - Do not fail when endpoint state is absent
- ironic - Refactor ironic authentication into a new module_utils module
- loadbalancer - Refactor loadbalancer module
- network - Migrating network from AnsibleModule to OpenStackModule
- networks_info - Migrating networks_info from AnsibleModule to OpenStackModule
- openstack - Add galaxy.yml to support install from git
- openstack - Fix docs-args mismatch in modules
- openstack - OpenStackModule Support defining a minimum version of the SDK
- router - Migrating routers from AnsibleModule to OpenStackModule
- routers_info - Added deprecated_names for router_info module
- routers_info - Migrating routers_info from AnsibleModule to OpenStackModule
- security_group.py - Migrating security_group from AnsibleModule to OpenStackModule
- security_group_rule - Refactor TCP/UDP port check
- server.py - Improve "server" module with OpenstackModule class
- server_volume - Migrating server_volume from AnsibleModule to OpenStackModule
- subnet - Fix subnets update and idempotency
- subnet - Migrating subnet module from AnsibleModule to OpenStackModule
- subnets_info - Migrating subnets_info from AnsibleModule to OpenStackModule
- volume.py - Migrating volume from AnsibleModule to OpenStackModule
- volume_info - Fix volume_info arguments for SDK 0.19
release_summary: Porting modules to new OpenstackModule class and fixes.
release_date: '2021-01-03'
1.3.0:
changes:
bugfixes:
- port - Fixed check for None in os_port
- project - Fix setting custom property on os_project
- security_group_rule - Remove protocols choice in security rules
- volume_info - Fix volume_info result for SDK < 0.19
minor_changes:
- Fix some typos in readme
- Guidelines Fix links and formatting
- baremetal_node - Add support for new features
- baremetal_node - ironic deprecate sub-options of driver_info
- baremetal_node - ironic stop putting meaningless values to properties
- image_info - Migrating image_info module from AnsibleModule to OpenStackModule
- recordset - Update recordset docu
- server - Allow description field to be set with os_server
- server_action - Added shelve and unshelve as new server actions
release_summary: New modules and bugfixes.
modules:
- description: Retrieve information about Openstack Identity roles.
name: identity_role_info
namespace: ''
- description: Retrieve information about Openstack key pairs.
name: keypair_info
namespace: ''
- description: Retrieve information about Openstack Security Groups.
name: security_group_info
namespace: ''
- description: Retrieve information about Openstack Security Group rules.
name: security_group_rule_info
namespace: ''
- description: Retrieve information about Openstack Heat stacks.
name: stack_info
namespace: ''
release_date: '2021-02-16'
1.4.0:
changes:
bugfixes:
- Add Octavia job for testing Load Balancer
- Add binding profile to port module
- Add execution environment metadata
- Fix CI for latest ansible-test with no_log
- Fix issues with newest ansible-test 2.11
- Prepare for Ansible 2.11 tests
- add option to exclude legacy groups
- security_group_rule add support ipv6-icmp
release_summary: New object_container module and bugfixes.
modules:
- description: Manage Swift container
name: object_container
namespace: ''
release_date: '2021-04-08'
1.5.0:
changes:
bugfixes:
- Update checks for validate_certs in openstack_cloud_from_module
- compute_flavor - Fix the idempotent of compute_flavor module
- host_aggregate - Fix host_aggregate to tolerate aggregate.hosts being None
- inventory/openstack - Fix inventory plugin on Ansible 2.11
- port - fix update on empty list of allowed address pairs
- setup.cfg Replace dashes with underscores
- subnet - Only apply necessary changes to subnets
- volume - Fail if referenced source image for a new volume does not exist
minor_changes:
- Add bindep.txt for ansible-builder
- Add check_mode attribute to OpenstackModule
- Migrating image module from AnsibleModule to OpenStackModule
- Switch KeystoneFederationProtocolInfo module to OpenStackModule
- Switch ProjectAccess module to OpenStackModule
- Switch Quota module to OpenStackModule
- Switch Recordset module to OpenStackModule
- Switch ServerGroup module to OpenStackModule
- Switch ServerMetadata module to OpenStackModule
- Switch Snapshot module to OpenStackModule
- Switch Stack module to OpenStackModule
- Switch auth module to OpenStackModule
- Switch catalog_service module to OpenStackModule
- Switch coe_cluster module to OpenStackModule
- Switch coe_cluster_template module to OpenStackModule
- Switch endpoint module to OpenStackModule
- Switch federation_idp module to OpenStackModule
- Switch federation_idp_info module to OpenStackModule
- Switch federation_mapping module to OpenStackModule
- Switch federation_mapping_info module to OpenStackModule
- Switch federation_protocol module to OpenStackModule
- Switch flavor module to OpenStackModule
- Switch flavor_info module to OpenStackModule
- Switch floating_ip module to OpenStackModule
- Switch group_assignment module to OpenStackModule
- Switch hostaggregate module to OpenStackModule
- Switch identity_domain module to OpenStackModule
- Switch identity_domain_info module to OpenStackModule
- Switch identity_group module to OpenStackModule
- Switch identity_group_info module to OpenStackModule
- Switch identity_role module to OpenStackModule
- Switch identity_user module to OpenStackModule
- Switch lb_listener module to OpenStackModule
- Switch lb_member module to OpenStackModule
- Switch lb_pool module to OpenStackModule
- Switch object module to OpenStackModule
- Switch port module to OpenStackModule
- Switch port_info module to OpenStackModule
- Switch project and project_info module to OpenStackModule
- Switch role_assignment module to OpenStackModule
- Switch user_info module to OpenStackModule
- image - Add support to setting image tags
release_summary: New modules for DNS and FIPs and bugfixes.
modules:
- description: Create or delete address scopes from OpenStack
name: address_scope
namespace: ''
- description: Getting information about dns zones
name: dns_zone_info
namespace: ''
- description: Get information about floating ips
name: floating_ip_info
namespace: ''
release_date: '2021-06-23'
1.5.1:
changes:
bugfixes:
- Add mandatory requires_ansible version to metadata
- Add protocol listener octavia
- Add support check mode for all info modules
- Allow to attach multiple floating ips to a server
- Only add or remove router interfaces when needed
- Wait for pool to be active and online
minor_changes:
- Changed minversion in tox to 3.18.0
- Update IRC server in README
release_summary: Bugfixes for networking modules
release_date: '2021-09-02'
1.5.2:
changes:
bugfixes:
- Add client and member listener timeouts for persistence (Ex. SSH)
- Added missing warn() used in cloud.openstack.quota
- Fix issue with same host and group names
- Flavor properties are not deleted on changes and id will stay
minor_changes:
- Add documentation links to README.md
- Don't run functional jobs on galaxy.yml change
- Move CI to use Ansible 2.12 version as main
release_summary: Bugfixes
release_date: '2021-11-09'
1.5.3:
changes:
bugfixes:
- Don't require allowed_address_pairs for port
- server_volume - check specified server is found
release_summary: Bugfixes
release_date: '2021-11-11'
1.6.0:
changes:
minor_changes:
- quota - Adds metadata_items parameter
release_summary: New modules for RBAC and Nova services
modules:
- description: Retrieve information about one or more OpenStack compute services
name: compute_service_info
namespace: ''
- description: Fetch Neutron policies.
name: neutron_rbac_policies_info
namespace: ''
- description: Create or delete a Neutron policy to apply a RBAC rule against
an object.
name: neutron_rbac_policy
namespace: ''
release_date: '2022-01-13'
1.7.0:
changes:
bugfixes:
- identity_user_info - Fix identity user lookup with a domain
- keystone_domain - Move identity domain to use proxy layer
minor_changes:
- openstack_inventory - Adds use_name variable
- port - Add dns_[name,domain] to the port module
- project - Remove project properties tests and support
release_summary: New modules for Ironic and bugfixes
modules:
- description: Retrieve information about Bare Metal nodes from OpenStack an object.
name: baremetal_node_info
namespace: ''
- description: Create, Update, Remove ironic ports from OpenStack
name: baremetal_port
namespace: ''
- description: Retrieve information about Bare Metal ports from OpenStack an object.
name: baremetal_port_info
namespace: ''
release_date: '2022-02-15'
1.7.1:
changes:
bugfixes:
- openstack_inventory - Fix documentation
- quota - Fix description of volumes_types parameter
minor_changes:
- lb_member - Add monitor_[address,port] parameter
release_summary: Bugfixes
release_date: '2022-03-08'
1.7.2:
changes:
bugfixes:
- Fix collection guidelines
release_summary: Bugfixes
release_date: '2022-03-10'
1.8.0:
changes:
bugfixes:
- Add 'all_projects' to server_action module
- Add subnet pool module
- Bumped minimum required OpenStack SDK release to SDK 0.36.0 (Train)
- Changed compute_flavor_info module to use OpenStack SDK's proxy layer
- Dropped deprecated return values in floating_ip_info and assert remaining
fields
- Fix ansible-lint issues for the newest version
- Fix assertion after stack deletion
- Handle aggregate host list set to None
- Reenabled check-import.sh which tests imports to Ansible Galaxy
- Remove old, unsupported parameters from documentation in image_info module
- Router - Remove unneeded 'filter' parameter
- Updated return value docs of compute_service_info module
release_summary: Subnet pool module and bugfixes
modules:
- description: Create or Delete subnet pools from OpenStack.
name: subnet_pool
namespace: ''
release_date: '2022-04-08'
1.9.0:
changes:
bugfixes:
- Added support for specifying a maximum version of the OpenStack SDK
- Constrain filters in compute_service_info to SDK >= 0.53.0
- Drop username from return values of identity_user_info
- Fix logic in routers_info
- Fixed return value disable{d,s}_reason in compute_service_info module
- Fixed return values in compute_service_info module again
- Follow up to bump of minimum required OpenStack SDK release to SDK 0.36.0
(Train)
- Lowered maximum OpenStack SDK version to 0.98.999
- Move dns zone info to use proxy layer
- Refactored catalog_service module
- Refactored endpoint module
- Refactored host_aggregate module
- Refactored identity_domain_info module
- Refactored identity_group_info module
- Refactored identity_role module
- Refactored identity_role_info module
- Refactored identity_user module
- Refactored identity_user_info module
- Refactored image_info module
- Refactored keypair_info module
- Refactored recordset module
- Refactored role_assignment module
- Set owner in image module
- Support description in sg-rule creation
- Warn users about us breaking backward compatibility
known_issues:
- For compatibility with OpenStack SDK >= 0.99.0 use Ansible OpenStack collection
2.0.0 or later which is currently under development.
- Release series 1.x.x of this collection is compatible to OpenStack SDK prior
to 0.99.0 only.
release_summary: This release will enforce openstacksdk<0.99.0, has a dozen
modules refactored and several bugs fixed.
release_date: '2022-08-25'
1.9.1:
changes:
bugfixes:
- Do not remove trailing spaces when reading public key in keypair module
known_issues:
- For compatibility with OpenStack SDK >= 0.99.0 use Ansible OpenStack collection
2.0.0 or later which is currently under development.
- Release series 1.x.x of this collection is compatible to OpenStack SDK prior
to 0.99.0 only.
release_summary: Bugfix in keypair module
release_date: '2022-09-08'

31
changelogs/config.yaml Normal file
View File

@@ -0,0 +1,31 @@
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
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: Openstack Cloud Ansilbe modules
trivial_section_name: trivial
use_fqcn: true

View File

@@ -1,3 +0,0 @@
bugfixes:
- Bump the minimum openstacksdk version to 0.18.0 when os_network
uses the port_security_enabled or mtu arguments.

View File

@@ -1,3 +0,0 @@
bugfixes:
- Bump the minimum openstacksdk version to 0.29.0 when os_network
uses the dns_domain argument.

View File

@@ -1,2 +0,0 @@
bugfixes:
- os_coe_cluster: Retrieve the correct id/uuid depending on whether it is a create/get request.

View File

@@ -1,2 +0,0 @@
minor_changes:
- Moved Openstack inventory script from Ansible community.general to openstack collection.

View File

@@ -0,0 +1,8 @@
- hosts: all
tasks:
- zuul_return:
data:
zuul:
artifacts:
- name: Test log
url: controller/logs/test_output_log.txt

View File

@@ -0,0 +1,84 @@
---
- hosts: all
vars:
collection_path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
build_collection_path: /tmp/collection_built/
ansible_galaxy_path: "~/.local/bin/ansible-galaxy"
tasks:
- name: Include role for pip
include_role:
name: ensure-pip
- name: Install ansible
pip:
name: ansible-core<2.12
- name: Discover tag version
set_fact:
version_tag: "{{ zuul.tag|default('no_version', true) }}"
- name: Fail if no tag version found
fail:
msg: "No tag was found in Zuul vars!"
when: version_tag == 'no_version'
- name: Create a directory for collection
file:
state: "{{ item }}"
path: "{{ build_collection_path }}"
loop:
- absent
- directory
- name: Set galaxy.yml for right version from tag
lineinfile:
path: '{{ collection_path }}/galaxy.yml'
regexp: '^version:.*'
line: 'version: {{ version_tag }}'
- name: Build collection
command: "{{ ansible_galaxy_path }} collection build --output-path {{ build_collection_path }} --force"
args:
chdir: "{{ collection_path }}"
- name: Publish content to Ansible Galaxy
block:
- name: Create ansible.cfg configuration file tempfile
tempfile:
state: file
suffix: .cfg
register: _ansiblecfg_tmp
- name: Create ansible.cfg configuration file
copy:
dest: "{{ _ansiblecfg_tmp.path }}"
mode: 0600
content: |
[galaxy]
server_list = release_galaxy
[galaxy_server.release_galaxy]
url = {{ ansible_galaxy_info.url }}
token = {{ ansible_galaxy_info.token }}
- name: Get content of galaxy.yml
slurp:
src: "{{ collection_path }}/galaxy.yml"
register: galaxy_vars
- name: Parse yaml into variable
set_fact:
galaxy_yaml: "{{ galaxy_vars['content'] | b64decode | from_yaml }}"
- name: Publish collection to Ansible Galaxy / Automation Hub
environment:
ANSIBLE_CONFIG: "{{ _ansiblecfg_tmp.path }}"
shell: >-
{{ ansible_galaxy_path }} collection publish -vvv
{{ build_collection_path }}/{{ galaxy_yaml.namespace }}-{{ galaxy_yaml.name }}-{{ version_tag }}.tar.gz
always:
- name: Shred ansible-galaxy credentials
command: "shred {{ _ansiblecfg_tmp.path }}"

5
ci/requirements.yml Normal file
View File

@@ -0,0 +1,5 @@
---
collections:
- ansible.posix
- ansible.utils
- community.general

View File

@@ -0,0 +1 @@
address_scope_name: "adrdess_scope"

View File

@@ -0,0 +1,40 @@
---
- name: Create address_scope
openstack.cloud.address_scope:
cloud: "{{ cloud }}"
name: "{{ address_scope_name }}"
shared: False
ip_version: "4"
register: create_address_scope
- name: Verify address scope
assert:
that:
- create_address_scope is successful
- create_address_scope is changed
- create_address_scope.address_scope.name == address_scope_name
- create_address_scope.address_scope.is_shared == False
- create_address_scope.address_scope.ip_version == 4
- name: Update address scope
openstack.cloud.address_scope:
cloud: "{{ cloud }}"
name: "{{ address_scope_name }}"
shared: True
ip_version: "4"
register: update_address_scope
- name: Verify updated IPv4 address scope
assert:
that:
- update_address_scope is successful
- update_address_scope is changed
- update_address_scope.address_scope.name == address_scope_name
- update_address_scope.address_scope.is_shared == True
- update_address_scope.address_scope.ip_version == 4
- name: Delete created address scope
openstack.cloud.address_scope:
cloud: "{{ cloud }}"
name: "{{ address_scope_name }}"
state: absent

View File

@@ -0,0 +1,94 @@
---
- name: Delete service test
openstack.cloud.catalog_service:
cloud: "{{ cloud }}"
service_type: test
name: test
state: absent
register: service_delete
- name: Assert changed is set to false
assert:
that:
- not service_delete.changed
- name: Create a service for test
openstack.cloud.catalog_service:
cloud: "{{ cloud }}"
name: "test_service"
state: present
service_type: test_type
description: "Test service"
register: service_test
- name: Verify returned values
assert:
that:
- item in service_test.service
loop:
- description
- id
- enabled
- name
- service_type
- type
- name: Check if the service test was created successfully
openstack.cloud.catalog_service:
cloud: "{{ cloud }}"
service_type: test
name: test
register: service_created
- name: Verify returned values
assert:
that:
- item in service_created.service
loop:
- description
- id
- enabled
- name
- type
- service_type
- name: Update service test
openstack.cloud.catalog_service:
cloud: "{{ cloud }}"
service_type: test
description: "A new description"
is_enabled: False
name: test
register: service_test
- name: Check if description and enabled were updated
assert:
that:
- service_test.service.description == "A new description"
- not (service_test.service.enabled|bool)
- name: Delete service test
openstack.cloud.catalog_service:
cloud: "{{ cloud }}"
service_type: test
name: test
state: absent
register: service_deleted
- name: Verify if service was deleted
assert:
that:
- service_deleted.changed
- name: Delete service test again
openstack.cloud.catalog_service:
cloud: "{{ cloud }}"
service_type: test
name: test
state: absent
register: service_deleted
- name: Assert changed is set to false
assert:
that:
- not service_deleted.changed

View File

@@ -0,0 +1,18 @@
expected_fields:
# Magnum might return more fields according to its documentation [0] but
# openstacksdk normalizes coe cluster resources, moving most fields from
# top level into a 'properties' field [1].
# [0] https://docs.openstack.org/api-ref/container-infrastructure-management/#create-new-cluster
# [1] https://opendev.org/openstack/openstacksdk/src/commit/d57c1fcab3b6cbe806cbae735fefa4983b200ab2/openstack/cloud/_normalize.py#L484
- cluster_template_id
- create_timeout
- id
- keypair
- location
- master_count
- name
- node_count
- properties
- stack_id
- status
- uuid

View File

@@ -0,0 +1,181 @@
---
- name: Create keypair
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: ansible_keypair
state: present
register: keypair
- name: List all images
openstack.cloud.image_info:
cloud: "{{ cloud }}"
register: images
- name: Identify Fedora CoreOS image id
set_fact:
image_id: "{{ images.images|community.general.json_query(query)|first }}"
vars:
query: "[?starts_with(name, 'fedora-coreos')].id"
- name: Create external network
openstack.cloud.network:
cloud: "{{ cloud }}"
external: true
name: ansible_external_network
state: present
register: external_network
- name: Create external subnet
openstack.cloud.subnet:
cidr: 10.6.6.0/24
cloud: "{{ cloud }}"
name: ansible_external_subnet
network_name: ansible_external_network
state: present
- name: Create internal network
openstack.cloud.network:
cloud: "{{ cloud }}"
state: present
name: ansible_internal_network
external: false
- name: Create internal subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: present
network_name: ansible_internal_network
name: ansible_internal_subnet
cidr: 10.7.7.0/24
- name: Create router
openstack.cloud.router:
cloud: "{{ cloud }}"
external_fixed_ips:
- subnet: ansible_external_subnet
ip: 10.6.6.10
interfaces:
- net: ansible_internal_network
subnet: ansible_internal_subnet
portip: 10.7.7.1
name: ansible_router
network: ansible_external_network
state: present
- name: Create Kubernetes cluster template
openstack.cloud.coe_cluster_template:
cloud: "{{ cloud }}"
coe: kubernetes
external_network_id: '{{ external_network.network.id }}'
fixed_network: ansible_internal_network
fixed_subnet: ansible_internal_subnet
floating_ip_enabled: true
image_id: '{{ image_id }}'
keypair_id: '{{ keypair.keypair.id }}'
name: k8s
state: present
register: coe_cluster_template
- name: Create Kubernetes cluster
openstack.cloud.coe_cluster:
cloud: "{{ cloud }}"
cluster_template_id: "{{ coe_cluster_template.cluster_template.uuid }}"
keypair: ansible_keypair
name: k8s
state: present
# cluster creation takes longer than max tenant timeout of 10800
wait: false
register: coe_cluster
- name: Assert return values of coe_cluster module
assert:
that:
# openstack.cloud.coe_cluster will only return 'id' on cluster creation when wait is false
- "['id']|difference(coe_cluster.cluster.keys())|length == 0"
- name: Pause for 1 minutes to allow Magnum to create the Kubernetes cluster
ansible.builtin.pause:
minutes: 1
- name: Create Kubernetes cluster again
openstack.cloud.coe_cluster:
cloud: "{{ cloud }}"
cluster_template_id: "{{ coe_cluster_template.cluster_template.uuid }}"
keypair: ansible_keypair
name: k8s
state: present
# cluster creation takes longer than max tenant timeout of 10800
wait: false
register: coe_cluster
- name: Assert return values of coe_cluster module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(coe_cluster.cluster.keys())|length == 0
- name: Delete Kubernetes cluster
openstack.cloud.coe_cluster:
cloud: "{{ cloud }}"
name: k8s
state: absent
register: coe_cluster
- name: Assert return values of coe_cluster module
assert:
that:
- coe_cluster is changed
- name: Delete Kubernetes cluster again
openstack.cloud.coe_cluster:
cloud: "{{ cloud }}"
name: k8s
state: absent
register: coe_cluster
- name: Assert return values of coe_cluster module
assert:
that:
- coe_cluster is not changed
- name: Delete Kubernetes cluster template
openstack.cloud.coe_cluster_template:
cloud: "{{ cloud }}"
name: k8s
state: absent
- name: Delete router
openstack.cloud.router:
cloud: "{{ cloud }}"
name: ansible_router
state: absent
- name: Delete internal subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: absent
name: ansible_internal_subnet
- name: Delete internal network
openstack.cloud.network:
cloud: "{{ cloud }}"
state: absent
name: ansible_internal_network
- name: Delete external subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
name: ansible_external_subnet
state: absent
- name: Delete external network
openstack.cloud.network:
cloud: "{{ cloud }}"
name: ansible_external_network
state: absent
- name: Delete keypair
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: ansible_keypair
state: absent

View File

@@ -0,0 +1,40 @@
expected_fields:
# Magnum might return more fields according to its documentation [0] but
# openstacksdk normalizes coe cluster template resources, moving most
# fields from top level into a 'properties' field [1].
# [0] https://docs.openstack.org/api-ref/container-infrastructure-management/#create-new-cluster
# [1] https://opendev.org/openstack/openstacksdk/src/commit/d57c1fcab3b6cbe806cbae735fefa4983b200ab2/openstack/cloud/_normalize.py#L522
- apiserver_port
- cluster_distro
- coe
- created_at
- dns_nameserver
- docker_volume_size
- external_network_id
- fixed_network
- fixed_subnet
- flavor_id
- floating_ip_enabled
- http_proxy
- https_proxy
- id
- image_id
- insecure_registry
- is_public
- is_registry_enabled
- is_tls_disabled
- keypair_id
- labels
- location
- master_flavor_id
- name
- network_driver
- no_proxy
- properties
- public
- registry_enabled
- server_type
- tls_disabled
- updated_at
- uuid
- volume_driver

View File

@@ -0,0 +1,81 @@
---
- name: Create keypair
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: ansible_keypair
state: present
register: keypair
- name: List all images
openstack.cloud.image_info:
cloud: "{{ cloud }}"
register: images
- name: Identify Fedora CoreOS image id
set_fact:
image_id: "{{ images.images|community.general.json_query(query)|first }}"
vars:
query: "[?starts_with(name, 'fedora-coreos')].id"
- name: Create Kubernetes cluster template
openstack.cloud.coe_cluster_template:
cloud: "{{ cloud }}"
coe: kubernetes
floating_ip_enabled: false
image_id: '{{ image_id }}'
keypair_id: '{{ keypair.keypair.id }}'
name: k8s
state: present
register: coe_cluster_template
- name: Assert return values of coe_cluster_template module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(coe_cluster_template.cluster_template.keys())|length == 0
- name: Create Kubernetes cluster template again
openstack.cloud.coe_cluster_template:
cloud: "{{ cloud }}"
coe: kubernetes
floating_ip_enabled: false
image_id: '{{ image_id }}'
keypair_id: '{{ keypair.keypair.id }}'
name: k8s
state: present
register: coe_cluster_template
- name: Assert return values of coe_cluster_template module
assert:
that:
- coe_cluster_template is not changed
- name: Delete Kubernetes cluster template
openstack.cloud.coe_cluster_template:
cloud: "{{ cloud }}"
name: k8s
state: absent
register: coe_cluster_template
- name: Assert return values of coe_cluster_template module
assert:
that:
- coe_cluster_template is changed
- name: Delete Kubernetes cluster template again
openstack.cloud.coe_cluster_template:
cloud: "{{ cloud }}"
name: k8s
state: absent
register: coe_cluster_template
- name: Assert return values of coe_cluster_template module
assert:
that:
- coe_cluster_template is not changed
- name: Delete keypair
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: ansible_keypair
state: absent

View File

@@ -0,0 +1,33 @@
---
- name: List flavors
openstack.cloud.compute_flavor_info:
cloud: "{{ cloud }}"
- name: List flavors with filter
openstack.cloud.compute_flavor_info:
cloud: "{{ cloud }}"
name: "m1.tiny"
register: flavor
- name: Check output of list flavors with filter
assert:
that:
- flavor.openstack_flavors | length == 1
- name: Assert fields on SDK 0.*
when: sdk_version is version(1.0, '<')
assert:
that:
- '["name", "description", "disk", "is_public", "ram",
"vcpus", "swap", "ephemeral", "is_disabled", "rxtx_factor", "id",
"extra_specs"] | difference(flavor.openstack_flavors.0.keys())
| length == 0'
- name: Assert fields on SDK 1.*
when: sdk_version is version(1.0, '>=')
assert:
that:
- '["name", "original_name", "description", "disk", "is_public", "ram",
"vcpus", "swap", "ephemeral", "is_disabled", "rxtx_factor", "id",
"extra_specs"] | difference(flavor.openstack_flavors.0.keys())
| length == 0'

View File

@@ -0,0 +1,4 @@
dns_zone_name: test.dns.zone.
recordset_name: testrecordset.test.dns.zone.
records: ['10.0.0.0']
updated_records: ['10.1.1.1']

View File

@@ -0,0 +1,32 @@
---
- name: Create dns zone
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: "{{ dns_zone_name }}"
zone_type: "primary"
email: test@example.net
register: dns_zone
- debug: var=dns_zone
- name: Update dns zone
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: "{{ dns_zone.zone.name }}"
description: "New descirption"
register: updated_dns_zone
- debug: var=updated_dns_zone
- name: Delete dns zone
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: "{{ updated_dns_zone.zone.name }}"
state: absent
register: deleted_dns_zone
- name: Verify dns zone
assert:
that:
- deleted_dns_zone is successful
- deleted_dns_zone is changed

View File

@@ -0,0 +1,49 @@
---
- name: Set random prefix
set_fact:
prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}"
- name: Create dns zone
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: "{{ (prefix + '.test.zone.') }}"
email: test@example.net
- name: Getting info about dns zones
openstack.cloud.dns_zone_info:
cloud: "{{ cloud }}"
register: zones
- name: assert result
assert:
that:
- zones is success
- zones is not changed
- zones | length > 0
- name: Getting info about created zone
openstack.cloud.dns_zone_info:
cloud: "{{ cloud }}"
name: "{{ (prefix + '.test.zone.') }}"
register: zone
- name: assert result
assert:
that:
- zone is success
- zone is not changed
- zone.zones | length == 1
- name: Assert keys exist
assert:
that:
- '["action", "attributes", "created_at", "description", "email",
"links", "masters", "name", "pool_id", "project_id", "serial",
"status", "ttl", "type", "updated_at", "id"] |
difference(zone.zones.0.keys()) | length == 0'
- name: Drop created dns zone
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: "{{ (prefix + '.test.zone.') }}"
state: absent

View File

@@ -0,0 +1,65 @@
---
- name: Create a service for compute
openstack.cloud.endpoint:
cloud: "{{ cloud }}"
service: nova
endpoint_interface: internal
url: http://controller:9292
region: RegionOne
state: present
register: endpoint_test
- name: Ensure service was created
assert:
that:
- endpoint_test.endpoint.id is defined
- name: Ensure service have the proper endpoint
assert:
that:
- endpoint_test.endpoint.url == "http://controller:9292"
- name: Create service for compute again
openstack.cloud.endpoint:
cloud: "{{ cloud }}"
service: nova
endpoint_interface: internal
url: http://controller:9292
region: RegionOne
state: present
register: endpoint_again
- name: Ensure changed is false
assert:
that:
- not endpoint_again.changed
- name: Update endpoint url
openstack.cloud.endpoint:
cloud: "{{ cloud }}"
service: nova
endpoint_interface: internal
url: http://controller:9393
region: RegionOne
state: present
register: endpoint_updated
- name: Ensure endpoint was updated
assert:
that:
- endpoint_updated.endpoint.url == "http://controller:9393"
- name: Delete endpoint
openstack.cloud.endpoint:
cloud: "{{ cloud }}"
service: nova
endpoint_interface: internal
url: http://controller:9393
region: RegionOne
state: absent
register: endpoint_deleted
- name: Ensure endpoint was deleted
assert:
that:
- endpoint_deleted.changed

View File

@@ -0,0 +1,477 @@
---
# Prepare environment
- name: List all images
openstack.cloud.image_info:
cloud: "{{ cloud }}"
register: images
- name: Identify CirrOS image name
set_fact:
image_name: "{{ images.openstack_images|community.general.json_query(query)|first }}"
vars:
query: "[?starts_with(name, 'cirros')].name"
- name: Gather information about public network
openstack.cloud.networks_info:
cloud: "{{ cloud }}"
name: public
register: public_network
- name: Assert that public network exists
assert:
that: public_network.openstack_networks|length == 1
- name: Create external network
openstack.cloud.network:
cloud: "{{ cloud }}"
state: present
name: ansible_external
external: true
- name: Create external subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: present
network_name: ansible_external
name: ansible_external_subnet
cidr: 10.6.6.0/24
- name: Create external port 1
openstack.cloud.port:
cloud: "{{ cloud }}"
state: present
name: ansible_external_port1
network: ansible_external
fixed_ips:
- ip_address: 10.6.6.50
- name: Create external port 2
openstack.cloud.port:
cloud: "{{ cloud }}"
state: present
name: ansible_external_port2
network: ansible_external
fixed_ips:
- ip_address: 10.6.6.51
- name: Create internal network
openstack.cloud.network:
cloud: "{{ cloud }}"
state: present
name: ansible_internal
external: false
- name: Create internal subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: present
network_name: ansible_internal
name: ansible_internal_subnet
cidr: 10.7.7.0/24
- name: Create internal port 1
openstack.cloud.port:
cloud: "{{ cloud }}"
state: present
name: ansible_internal_port1
network: ansible_internal
fixed_ips:
- ip_address: 10.7.7.100
- name: Create internal port 2
openstack.cloud.port:
cloud: "{{ cloud }}"
state: present
name: ansible_internal_port2
network: ansible_internal
fixed_ips:
- ip_address: 10.7.7.101
- name: Create internal port 3
openstack.cloud.port:
cloud: "{{ cloud }}"
state: present
name: ansible_internal_port3
network: ansible_internal
fixed_ips:
- ip_address: 10.7.7.102
- name: Create router 1
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: ansible_router1
network: ansible_external
external_fixed_ips:
- subnet: ansible_external_subnet
ip: 10.6.6.10
interfaces:
- net: ansible_internal
subnet: ansible_internal_subnet
portip: 10.7.7.1
# Router 2 is required for the simplest, first test that assigns a new floating IP to server
# from first available external network or nova pool which is DevStack's public network
- name: Create router 2
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: ansible_router2
network: public
interfaces:
- net: ansible_internal
subnet: ansible_internal_subnet
portip: 10.7.7.10
- name: Get all floating ips
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
register: fips
- name: Check if public network has any floating ips
set_fact:
public_network_had_fips: "{{ fips.floating_ips|
selectattr('floating_network_id', '==', public_network.openstack_networks.0.id)|
list|length > 0 }}"
# TODO: Replace with appropriate Ansible module once available
- name: Create a floating ip on public network (required for simplest, first floating ip test)
command: openstack --os-cloud={{ cloud }} floating ip create public
when: not public_network_had_fips
# TODO: Replace with appropriate Ansible module once available
- name: Create floating ip 1 on external network
command: >
openstack --os-cloud={{ cloud }} floating ip create
--subnet ansible_external_subnet
--floating-ip-address 10.6.6.150
ansible_external
when: fips.floating_ips|length == 0 or
"10.6.6.150" not in fips.floating_ips|map(attribute="floating_ip_address")|list
- name: Create server with one nic
openstack.cloud.server:
cloud: "{{ cloud }}"
state: present
name: ansible_server1
image: "{{ image_name }}"
flavor: m1.tiny
nics:
# one nic only else simple, first floating ip test does not work
- port-name: ansible_internal_port1
auto_ip: false
wait: true
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: ansible_server1
register: info
- name: Assert one internal port and no floating ips on server 1
# If this assertion fails because server has an public ipv4 address (public_v4) then make sure
# that no floating ip on public network is associated with "10.7.7.100" before running this role
assert:
that:
- info.openstack_servers|length == 1
- info.openstack_servers.0.public_v4|length == 0
- info.openstack_servers.0.public_v6|length == 0
- info.openstack_servers.0.addresses.ansible_internal|length == 1
- info.openstack_servers.0.addresses.ansible_internal|map(attribute="addr")|sort|list == ["10.7.7.100"]
- name: Create server with two nics
openstack.cloud.server:
cloud: "{{ cloud }}"
state: present
name: ansible_server2
image: "{{ image_name }}"
flavor: m1.tiny
nics:
- port-name: ansible_internal_port2
- port-name: ansible_internal_port3
auto_ip: false
wait: true
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: ansible_server2
register: info
- name: Assert two internal ports and no floating ips on server 2
assert:
that:
- info.openstack_servers|length == 1
- info.openstack_servers.0.public_v4|length == 0
- info.openstack_servers.0.public_v6|length == 0
- info.openstack_servers.0.addresses.ansible_internal|length == 2
- info.openstack_servers.0.addresses.ansible_internal|map(attribute="addr")|sort|list ==
["10.7.7.101", "10.7.7.102"]
# Tests
- name: Assign new floating IP to server from first available external network or nova pool
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: present
server: ansible_server1
wait: true
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: ansible_server1
register: info
- name: Assert one internal port and one floating ip on server 1
assert:
that:
- info.openstack_servers.0.addresses.ansible_internal|length == 2
- info.openstack_servers.0.addresses.ansible_internal|map(attribute="OS-EXT-IPS:type")|sort|list ==
["fixed", "floating"]
- name: Detach floating IP from server
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: absent
server: ansible_server1
network: public
floating_ip_address: "{{ (info.openstack_servers.0.addresses.ansible_internal|
selectattr('OS-EXT-IPS:type', '==', 'floating')|map(attribute='addr')|list)[0] }}"
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: ansible_server1
register: info
# When detaching a floating ip from an instance there might be a delay until openstack.cloud.server_info
# does not list it any more in info.openstack_servers.0.addresses.ansible_internal, so retry if necessary.
retries: 10
delay: 3
until: info.openstack_servers.0.addresses.ansible_internal|length == 1
- name: Assert one internal port on server 1
assert:
that:
- info.openstack_servers.0.addresses.ansible_internal|length == 1
- info.openstack_servers.0.addresses.ansible_internal|map(attribute="addr")|list == ["10.7.7.100"]
- name: Assign floating IP to server
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: present
reuse: yes
server: ansible_server2
network: public
fixed_address: 10.7.7.101
wait: true
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: ansible_server2
register: info
- name: Assert two internal ports and one floating ip on server 2
assert:
that:
- info.openstack_servers.0.addresses.ansible_internal|length == 3
- info.openstack_servers.0.addresses.ansible_internal|map(attribute="OS-EXT-IPS:type")|sort|list ==
["fixed", "fixed", "floating"]
- name: Assign a second, specific floating IP to server
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: present
reuse: yes
server: ansible_server2
network: ansible_external
fixed_address: 10.7.7.102
floating_ip_address: "10.6.6.150"
# We cannot wait for second floating ip to be attached because OpenStackSDK checks only for first floating ip
# Ref.: https://github.com/openstack/openstacksdk/blob/e0372b72af8c5f471fc17e53434d7a814ca958bd/openstack/cloud/_floating_ip.py#L733
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: ansible_server2
register: info
# retry because we cannot wait for second floating ip
retries: 10
delay: 3
until: info.openstack_servers.0.addresses.ansible_internal|length == 4
- name: Assert two internal ports and two floating ips on server 2
assert:
that:
- info.openstack_servers.0.addresses.ansible_internal|length == 4
- ("10.6.6.150" in info.openstack_servers.0.addresses.ansible_internal|map(attribute="addr")|sort|list)
- name: Detach second floating IP from server
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: absent
server: ansible_server2
network: ansible_external
floating_ip_address: "10.6.6.150"
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: ansible_server2
register: info
# When detaching a floating ip from an instance there might be a delay until openstack.cloud.server_info
# does not list it any more in info.openstack_servers.0.addresses.ansible_internal, so retry if necessary.
retries: 10
delay: 3
until: info.openstack_servers.0.addresses.ansible_internal|length == 3
- name: Assert two internal ports and one floating ip on server 2
assert:
that:
- info.openstack_servers.0.addresses.ansible_internal|length == 3
- name: Detach remaining floating IP from server
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: absent
server: ansible_server2
network: public
floating_ip_address: "{{ (info.openstack_servers.0.addresses.ansible_internal|
selectattr('OS-EXT-IPS:type', '==', 'floating')|map(attribute='addr')|list)[0] }}"
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: ansible_server2
register: info
# When detaching a floating ip from an instance there might be a delay until openstack.cloud.server_info
# does not list it any more in info.openstack_servers.0.addresses.ansible_internal, so retry if necessary.
retries: 10
delay: 3
until: info.openstack_servers.0.addresses.ansible_internal|length == 2
- name: Assert two internal ports on server 2
assert:
that:
- info.openstack_servers.0.addresses.ansible_internal|length == 2
- info.openstack_servers.0.addresses.ansible_internal|map(attribute="addr")|list == ["10.7.7.101", "10.7.7.102"]
# Clean environment
- name: Delete server with two nics
openstack.cloud.server:
cloud: "{{ cloud }}"
state: absent
name: ansible_server2
wait: true
- name: Delete server with one nic
openstack.cloud.server:
cloud: "{{ cloud }}"
state: absent
name: ansible_server1
wait: true
- name: Get all floating ips
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
register: fips
# TODO: Replace with appropriate Ansible module once available
- name: Delete floating ip on public network if we created it
when: not public_network_had_fips
command: >
openstack --os-cloud={{ cloud }} floating ip delete
{{ fips.floating_ips|selectattr('floating_network_id', '==', public_network.openstack_networks.0.id)|
map(attribute="floating_ip_address")|list|join(' ') }}
# TODO: Replace with appropriate Ansible module once available
- name: Delete floating ip 1
command: openstack --os-cloud={{ cloud }} floating ip delete 10.6.6.150
when: fips.floating_ips|length > 0 and "10.6.6.150" in fips.floating_ips|map(attribute="floating_ip_address")|list
- name: Get remaining floating ips on external network
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
floating_network: ansible_external
register: fips
# TODO: Replace with appropriate Ansible module once available
# The first, simple floating ip test might have allocated a floating ip on the external network.
# This floating ip must be removed before external network can be deleted.
- name: Delete remaining floating ips on external network
when: fips.floating_ips|length > 0
command: >
openstack --os-cloud={{ cloud }} floating ip delete
{{ fips.floating_ips|map(attribute="floating_ip_address")|list|join(' ') }}
# Remove routers after floating ips have been detached and disassociated else removal fails with
# Error detaching interface from router ***: Client Error for url: ***,
# Router interface for subnet *** on router *** cannot be deleted,
# as it is required by one or more floating IPs.
- name: Delete router 2
openstack.cloud.router:
cloud: "{{ cloud }}"
state: absent
name: ansible_router2
- name: Delete router 1
openstack.cloud.router:
cloud: "{{ cloud }}"
state: absent
name: ansible_router1
- name: Delete internal port 3
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: ansible_internal_port3
- name: Delete internal port 2
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: ansible_internal_port2
- name: Delete internal port 1
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: ansible_internal_port1
- name: Delete internal subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: absent
name: ansible_internal_subnet
- name: Delete internal network
openstack.cloud.network:
cloud: "{{ cloud }}"
state: absent
name: ansible_internal
- name: Delete external port 2
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: ansible_external_port2
- name: Delete external port 1
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: ansible_external_port1
- name: Delete external subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: absent
name: ansible_external_subnet
- name: Delete external network
openstack.cloud.network:
cloud: "{{ cloud }}"
state: absent
name: ansible_external

View File

@@ -0,0 +1,21 @@
---
- name: Getting info about allocated ips
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
register: fips
- name: assert result
assert:
that:
- fips is success
- fips is not changed
- name: assert fields
when: fips.floating_ips|length > 0
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- '["created_at", "description", "dns_domain", "dns_name", "fixed_ip_address", "floating_ip_address",
"floating_network_id", "id", "name", "port_details", "port_id", "project_id", "qos_policy_id",
"revision_number", "router_id", "status", "subnet_id", "tags", "updated_at"]|
difference(fips.floating_ips.0.keys())|length == 0'

View File

@@ -0,0 +1,10 @@
# Parameter deleted has been renamed to is_deleted in openstacksdk 0.52.0,
# hence we cannot test with this list here.
# Ref.: https://github.com/openstack/openstacksdk/commit/b60915aab3ee0348f3e3cc8aa548f94d2a68b7eb
expected_fields:
- availability_zone
- hosts
- id
- location
- metadata
- name

View File

@@ -0,0 +1,99 @@
---
- name: ensure aggregate doesn't exist before tests
openstack.cloud.host_aggregate:
cloud: "{{ cloud }}"
state: absent
name: test_aggregate
register: aggregate
- block:
- name: create aggregate
openstack.cloud.host_aggregate:
cloud: "{{ cloud }}"
state: present
name: test_aggregate
hosts:
- "{{ ansible_hostname }}"
register: aggregate
- name: assert aggregate is changed
assert:
that: aggregate is changed
- name: assert aggregate fields
assert:
that: item in aggregate.aggregate
loop: "{{ expected_fields }}"
- block:
- name: recreate aggregate
openstack.cloud.host_aggregate:
cloud: "{{ cloud }}"
state: present
name: test_aggregate
hosts:
- "{{ ansible_hostname }}"
register: aggregate
- name: assert aggregate is not changed
assert:
that: aggregate is not changed
- name: assert aggregate fields
assert:
that: item in aggregate.aggregate
loop: "{{ expected_fields }}"
- block:
- name: update aggregate
openstack.cloud.host_aggregate:
cloud: "{{ cloud }}"
state: present
name: test_aggregate
metadata:
ssd: "true"
hosts:
- "{{ ansible_hostname }}"
register: aggregate
- name: assert aggregate is changed
assert:
that: aggregate is changed
- name: assert aggregate fields
assert:
that: item in aggregate.aggregate
loop: "{{ expected_fields }}"
- block:
- name: purge hosts
openstack.cloud.host_aggregate:
cloud: "{{ cloud }}"
state: present
name: test_aggregate
hosts: []
purge_hosts: true
register: aggregate
- name: assert hosts were purged
assert:
that:
- aggregate is changed
- aggregate.aggregate.hosts | length == 0
- name: assert aggregate fields
assert:
that: item in aggregate.aggregate
loop: "{{ expected_fields }}"
- block:
- name: delete aggregate
openstack.cloud.host_aggregate:
cloud: "{{ cloud }}"
state: absent
name: test_aggregate
register: aggregate
- name: assert aggregate is changed
assert:
that: aggregate is changed

View File

@@ -0,0 +1,8 @@
domain_name: domain_info_test_domain
unexistent_domain_name: domain_info_unexistent_domain
disabled_domain_name: test_domain_disabled
domain_info_fields:
- description
- id
- enabled
- name

View File

@@ -0,0 +1,72 @@
---
- block:
- name: Ensure domain does not exist
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: absent
name: "{{ unexistent_domain_name }}"
- name: Get unexistent domain
openstack.cloud.identity_domain_info:
cloud: "{{ cloud }}"
name: "{{ unexistent_domain_name }}"
register: domain_info
- name: Assert no results returned
assert:
that: not domain_info.openstack_domains
- block:
- name: Ensure domain exists
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: present
name: "{{ domain_name }}"
description: "test description"
register: domain
- name: Get domain
openstack.cloud.identity_domain_info:
cloud: "{{ cloud }}"
name: "{{ domain_name }}"
register: domain_info
- name: Assert one result exists
assert:
that: domain_info.openstack_domains | length == 1
- name: Assert fields are present
assert:
that: item in domain_info.openstack_domains[0]
loop: "{{ domain_info_fields }}"
- name: Assert returned value
assert:
that:
- domain_info.openstack_domains[0].description == domain.domain.description
- block:
- name: Get all domains
openstack.cloud.identity_domain_info:
cloud: "{{ cloud }}"
register: domain_info
- block:
- name: Ensure disabled domain exists
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: present
name: "{{ disabled_domain_name }}"
enabled: false
description: "test description"
register: domain
- name: Get filtered domains
openstack.cloud.identity_domain_info:
cloud: "{{ cloud }}"
filters:
enabled: true
register: domain_info
- name: Assert at least one result
assert:
that: domain_info.openstack_domains | length >= 1
- name: Assert returned value
assert:
that: item.enabled == true
loop: "{{ domain_info.openstack_domains }}"

View File

@@ -0,0 +1,74 @@
---
- name: List group by domain_id
openstack.cloud.identity_group_info:
cloud: "{{ cloud }}"
domain: default
register: group_domain
- name: Assert groups were returned
assert:
that:
- group_domain.openstack_groups | length > 0
- group_domain.openstack_groups[0].domain_id == 'default'
- group_domain.openstack_groups[0].id is defined
- group_domain.openstack_groups[0].description is defined
- group_domain.openstack_groups[0].name is defined
- name: List group by domain_id and group
openstack.cloud.identity_group_info:
cloud: "{{ cloud }}"
domain: default
name: admins
register: groups_info
- name: Assert groups by domain_id and grouph returned
assert:
that:
- groups_info.openstack_groups | length > 0
- groups_info.openstack_groups[0].domain_id == 'default'
- groups_info.openstack_groups[0].id is defined
- groups_info.openstack_groups[0].description is defined
- groups_info.openstack_groups[0].name is defined
- name: List group by filter
openstack.cloud.identity_group_info:
cloud: "{{ cloud }}"
domain: default
filters:
name: admins
register: groups_filter
- name: Assert group by filter returned
assert:
that:
- groups_filter.openstack_groups | length > 0
- groups_filter.openstack_groups[0].domain_id == 'default'
- groups_filter.openstack_groups[0].id is defined
- groups_filter.openstack_groups[0].description is defined
- groups_filter.openstack_groups[0].name is defined
- name: Verify returned values of group info
assert:
that:
- item in groups_info.openstack_groups[0]
loop:
- description
- domain_id
- id
- name
- name: List group by group name
openstack.cloud.identity_group_info:
cloud: "{{ cloud }}"
name: admins
register: groups_name
- name: Assert group by name returned
assert:
that:
- groups_name.openstack_groups | length > 0
- groups_name.openstack_groups[0].domain_id == 'default'
- groups_name.openstack_groups[0].id is defined
- groups_name.openstack_groups[0].description is defined
- groups_name.openstack_groups[0].name is defined
- groups_name.openstack_groups[0].name == 'admins'

View File

@@ -0,0 +1,5 @@
role_name: ansible_keystone_role
expected_fields:
- domain_id
- id
- name

View File

@@ -0,0 +1,83 @@
---
- name: Cleanup before tests
block:
- openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: absent
name: "{{ role_name }}"
- block:
- name: Delete unexistent role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: absent
name: "{{ role_name }}"
register: role
- name: Assert role didn't change
assert:
that: role is not changed
- block:
- name: Create keystone role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: present
name: "{{ role_name }}"
register: role
- name: Try to get role
openstack.cloud.identity_role_info:
cloud: "{{ cloud }}"
name: "{{ role_name }}"
register: roles
- name: Assert role found
assert:
that:
- roles.openstack_roles | length == 1
- name: Assert role changed
assert:
that: role is changed
- name: Assert return fields
assert:
that: item in role['role']
loop: "{{ expected_fields }}"
- name: Assert return value
assert:
that: role['role']['name'] == role_name
- name: Assert retrieved values
assert:
that: roles.openstack_roles[0].name == role_name
- block:
- name: Create existing keystone role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: present
name: "{{ role_name }}"
register: role
- name: Assert role not changed
assert:
that: role is not changed
- name: Assert return fields
assert:
that: item in role['role']
loop: "{{ expected_fields }}"
- block:
- name: Delete keystone role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: absent
name: "{{ role_name }}"
register: role
- name: Assert role changed
assert:
that: role is changed
- name: Try to get role
openstack.cloud.identity_role_info:
cloud: "{{ cloud }}"
name: "{{ role_name }}"
register: roles
- name: Assert no role found
assert:
that:
- roles.openstack_roles | length == 0

View File

@@ -0,0 +1,62 @@
- name: Ensure role does not exist before tests
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: absent
name: test_role
- name: Get unexistent role
openstack.cloud.identity_role_info:
cloud: "{{ cloud }}"
name: test_role
register: roleinfo
- debug:
var: roleinfo
- name: Assert that no results were returned
assert:
that: not roleinfo.openstack_roles
- name: Create keystone role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: present
name: test_role
- name: Create second role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: present
name: test_role2
- name: Get role by name
openstack.cloud.identity_role_info:
cloud: "{{ cloud }}"
name: test_role
register: roleinfo
- debug:
var: roleinfo
- name: Assert that only one result was returned
assert:
that: roleinfo.openstack_roles | length == 1
- name: Assert that roleinfo has fields
assert:
that: item in roleinfo.openstack_roles[0]
loop:
- domain_id
- id
- name
- name: Post-test cleanup
block:
- name: Clean up roles
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: absent
name: "{{ item }}"
loop:
- test_role
- test_role2

View File

@@ -0,0 +1,9 @@
os_identity_user_fields:
- default_project_id
- description
- domain_id
- email
- enabled
- id
- name
- username

View File

@@ -0,0 +1,197 @@
---
- name: setup
block:
- name: Delete user before running tests
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: absent
name: "{{ item }}"
loop:
- ansible_user
- ansible_user2
register: user
- block:
- name: Delete unexistent user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: absent
name: ansible_user
register: user
- name: Ensure user was not changed
assert:
that: user is not changed
- block:
- name: Create a user without a password
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
email: ansible.user@nowhere.net
domain: default
default_project: demo
register: user
- name: Ensure user was changed
assert:
that: user is changed
- name: Ensure user has fields
assert:
that: item in user['user']
loop: "{{ os_identity_user_fields }}"
- name: Fail when update_password is always but no password specified
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
update_password: always
email: ansible.user@nowhere.net
domain: default
default_project: demo
register: user
ignore_errors: yes
- assert:
that: user.msg == "update_password is always but a password value is missing"
- name: Delete user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: absent
name: ansible_user
- block:
- name: Create user with a password
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
password: secret
email: ansible.user@nowhere.net
update_password: on_create
domain: default
default_project: demo
register: user
- name: Assert user has fields
assert:
that: item in user['user']
loop: "{{ os_identity_user_fields }}"
- block:
- name: Create identical user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
password: secret
email: ansible.user@nowhere.net
update_password: on_create
domain: default
default_project: demo
register: user
- name: Assert user was not changed
assert:
that: user is not changed
- name: Assert user has fields
assert:
that: item in user['user']
loop: "{{ os_identity_user_fields }}"
- block:
- name: Update user with password
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
password: secret2
email: updated.ansible.user@nowhere.net
register: user
- name: Ensure user was changed
assert:
that: user is changed
- name: Ensure user has fields
assert:
that: item in user['user']
loop: "{{ os_identity_user_fields }}"
- name: Update user without password and update_password set to always
block:
- openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
update_password: always
email: updated.ansible.user@nowhere.net
register: user
ignore_errors: yes
- assert:
that: user.msg == "update_password is always but a password value is missing"
- block:
- name: Ensure user with update_password set to on_create
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
update_password: on_create
password: secret3
email: updated.ansible.user@nowhere.net
register: user
- name: Ensure user was not changed
assert:
that: user is not changed
- block:
- name: Ensure user with update_password set to always
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
update_password: always
password: secret3
email: updated.ansible.user@nowhere.net
register: user
- name: Ensure user was changed
assert:
that: user is changed
- block:
- name: Create user without a password
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user2
password: secret
email: ansible.user2@nowhere.net
update_password: on_create
domain: default
default_project: demo
register: user
- name: Assert user has fields
assert:
that: item in user['user']
loop: "{{ os_identity_user_fields }}"
- block:
- name: Delete user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: absent
name: ansible_user
- name: Ensure user was changed
assert:
that: user is changed

View File

@@ -0,0 +1,9 @@
os_expected_user_info_fields:
- default_project_id
- description
- domain_id
- email
- enabled
- id
- name
- username

View File

@@ -0,0 +1,72 @@
- name: Ensure user does not exist before tests
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: absent
name: ansible_user
- block:
- name: Get unexistent user
openstack.cloud.identity_user_info:
cloud: "{{ cloud }}"
name: ansible_user
register: userinfo
- name: Ensure nothing was returned
assert:
that: not userinfo.openstack_users
- block:
- name: Create user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
password: secret
email: ansible.user@nowhere.net
domain: default
default_project: demo
register: user
- name: Create second user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user2
password: secret
email: ansible.user2@nowhere.net
domain: default
default_project: demo
register: user
- name: Get first user info
openstack.cloud.identity_user_info:
cloud: "{{ cloud }}"
name: ansible_user
register: userinfo
- name: Assert only one result exists
assert:
that:
- userinfo.openstack_users | length == 1
- name: Assert userinfo has fields
assert:
that:
- item in userinfo.openstack_users[0]
loop: "{{ os_expected_user_info_fields }}"
- block:
- name: Get all users
openstack.cloud.identity_user_info:
cloud: "{{ cloud }}"
register: userinfo
- name: Assert results were returned
assert:
that:
- userinfo.openstack_users | length > 0
- name: Post-test cleanup
block:
- name: Ensure users do not exist
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: absent
name: "{{ item }}"
loop:
- ansible_user
- ansible_user2

View File

@@ -1 +0,0 @@
image_name: ansible_image

View File

@@ -10,24 +10,37 @@
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
name: ansible_image
filename: "{{ tmp_file.stdout }}"
disk_format: raw
tags:
- test
- ansible
register: image
- debug: var=image
- name: Get details of created image
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: ansible_image
register: image_info_result
- name: Verify image info
assert:
that:
- image_info_result.openstack_images[0].name == "ansible_image"
- image_info_result.openstack_images[0].tags | sort == ['test', 'ansible'] | sort
- name: Delete raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
name: ansible_image
- name: Create raw image (complex)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
name: ansible_image
filename: "{{ tmp_file.stdout }}"
disk_format: raw
is_public: True
@@ -40,13 +53,100 @@
distro: ubuntu
register: image
- debug: var=image
- name: Delete raw image (complex)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
name: ansible_image
- name: Try to get details of deleted image
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: ansible_image
register: deleted_image_info_result
- name: Verify image is deleted
assert:
that:
- not deleted_image_info_result.openstack_images
- name: Create owner project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: image_owner_project
description: Project owning test image
domain_id: default
enabled: True
register: owner_project
- name: Create raw image (owner by project name)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: ansible_image
filename: "{{ tmp_file.stdout }}"
disk_format: raw
tags:
- test
- ansible
project: image_owner_project
register: image
- name: Get details of created image (owner by project name)
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: ansible_image
register: image_info_result
- name: Verify image owner (owner by project name)
assert:
that:
- image_info_result.openstack_images[0].owner == owner_project.project.id
- name: Delete raw image (owner by project name)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: ansible_image
- name: Create raw image (owner by project name and domain name)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: ansible_image
filename: "{{ tmp_file.stdout }}"
disk_format: raw
tags:
- test
- ansible
project: image_owner_project
project_domain: default
register: image
- name: Get details of created image (owner by project name and domain name)
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: ansible_image
register: image_info_result
- name: Verify image owner (owner by project name and domain name)
assert:
that:
- image_info_result.openstack_images[0].owner == owner_project.project.id
- name: Delete raw image (owner by project name and domain name)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: ansible_image
- name: Delete owner project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: absent
name: image_owner_project
domain_id: default
- name: Delete test image file
file:

View File

@@ -0,0 +1,23 @@
expected_fields:
- checksum
- container_format
- created_at
- direct_url
- disk_format
- file
- id
- locations
- metadata
- min_disk
- min_ram
- name
- os_hidden
- owner
- properties
- schema
- size
- status
- tags
- updated_at
- virtual_size
- visibility

View File

@@ -0,0 +1,11 @@
---
- name: List all images # This will list at least the default cirros image of devstack
openstack.cloud.image_info:
cloud: "{{ cloud }}"
register: image_list_result
- name: Assert fields
assert:
that:
- item in image_list_result.openstack_images.0.keys()
loop: "{{ expected_fields }}"

View File

@@ -1 +1,11 @@
keypair_name: shade_keypair
expected_fields:
- created_at
- fingerprint
- id
- is_deleted
- name
- private_key
- public_key
- type
- user_id

View File

@@ -1,62 +1,156 @@
---
- name: Create keypair (non-existing)
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: present
register:
keypair
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: present
register: keypair
- name: Get list of all keypairs
openstack.cloud.keypair_info:
cloud: "{{ cloud }}"
register: keypairs_all
- name: Get list of keypairs with filter
openstack.cloud.keypair_info:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
register: keypairs
- name: Ensure that list of keypairs contains single element
assert:
that:
- keypairs['openstack_keypairs']|length == 1
- name: Assert fields
assert:
that:
- item in keypairs.openstack_keypairs.0.keys()
loop: "{{ expected_fields }}"
# This assert verifies that Ansible is capable serializing data returned by SDK
- name: Ensure private key is returned
- name: Ensure public key is returned
assert:
that:
- keypair.key.public_key is defined and keypair.key.public_key
- name: Create another keypair
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}-2"
state: present
- name: Delete keypair (non-existing)
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: absent
cloud: "{{ cloud }}"
name: "non-existing"
state: absent
- name: Delete keypair
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: absent
- name: Get list of keypairs
openstack.cloud.keypair_info:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
register: keypairs
- name: Ensure that list of keypairs is empty
assert:
that:
- keypairs['openstack_keypairs']|length == 0
- name: Delete another keypair
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}-2"
state: absent
- name: Generate test key file
user:
name: "{{ ansible_env.USER }}"
generate_ssh_key: yes
ssh_key_file: .ssh/shade_id_rsa
name: "{{ ansible_env.USER }}"
generate_ssh_key: yes
ssh_key_file: .ssh/shade_id_rsa
- name: Create keypair (file)
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: present
public_key_file: "{{ ansible_env.HOME }}/.ssh/shade_id_rsa.pub"
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: present
public_key_file: "{{ ansible_env.HOME }}/.ssh/shade_id_rsa.pub"
- name: Get list of keypairs
openstack.cloud.keypair_info:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
register: keypairs
- name: Ensure that list of keypairs contains single element
assert:
that:
- keypairs['openstack_keypairs']|length == 1
- name: Delete keypair (file)
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: absent
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: absent
- name: Get list of keypairs
openstack.cloud.keypair_info:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
register: keypairs
- name: Ensure that list of keypairs is empty
assert:
that:
- keypairs['openstack_keypairs']|length == 0
- name: Create keypair (key)
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: present
public_key: "{{ lookup('file', '~/.ssh/shade_id_rsa.pub') }}"
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: present
public_key: "{{ lookup('file', '~/.ssh/shade_id_rsa.pub') }}"
- name: Get list of keypairs
openstack.cloud.keypair_info:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
register: keypairs
- name: Ensure that list of keypairs contains single element
assert:
that:
- keypairs['openstack_keypairs']|length == 1
- name: Delete keypair (key)
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: absent
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: absent
- name: Get list of keypairs
openstack.cloud.keypair_info:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
register: keypairs
- name: Ensure that list of keypairs is empty
assert:
that:
- keypairs['openstack_keypairs']|length == 0
- name: Delete test key pub file
file:
name: "{{ ansible_env.HOME }}/.ssh/shade_id_rsa.pub"
state: absent
name: "{{ ansible_env.HOME }}/.ssh/shade_id_rsa.pub"
state: absent
- name: Delete test key pvt file
file:
name: "{{ ansible_env.HOME }}/.ssh/shade_id_rsa"
state: absent
name: "{{ ansible_env.HOME }}/.ssh/shade_id_rsa"
state: absent

View File

@@ -1,19 +1,36 @@
---
- name: Create keystone domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: present
name: "{{ domain_name }}"
description: "test description"
cloud: "{{ cloud }}"
state: present
name: "{{ domain_name }}"
description: "test description"
register: os_domain
- name: Test output
assert:
that:
- "'domain' in os_domain"
- os_domain.domain.name == domain_name
- >-
('enabled' in os_domain.domain.keys() and os_domain.domain['enabled']|bool) or
('is_enabled' in os_domain.domain and os_domain.domain['is_enabled']|bool)
- os_domain.domain.description == "test description"
- name: Update keystone domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
name: "{{ domain_name }}"
description: "updated description"
cloud: "{{ cloud }}"
name: "{{ domain_name }}"
description: "updated description"
register: os_domain_updated
- name: Test output
assert:
that:
- os_domain_updated.domain.description == "updated description"
- name: Delete keystone domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: absent
name: "{{ domain_name }}"
cloud: "{{ cloud }}"
state: absent
name: "{{ domain_name }}"

View File

@@ -1 +0,0 @@
role_name: ansible_keystone_role

View File

@@ -1,12 +0,0 @@
---
- name: Create keystone role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: present
name: "{{ role_name }}"
- name: Delete keystone role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: absent
name: "{{ role_name }}"

View File

@@ -0,0 +1,3 @@
network_name: network_lb
subnet_name: subnet_lb
lb_name: test_lb

View File

@@ -0,0 +1,70 @@
---
- name: Download Amphora tarball
get_url:
url: "https://tarballs.openstack.org/octavia/test-images/test-only-amphora-x64-haproxy-ubuntu-bionic.qcow2"
dest: /tmp/test-only-amphora-x64-haproxy-ubuntu-bionic.qcow2
- name: Upload Amphora image for Octavia to test load balancers
openstack.cloud.image:
cloud: "{{ cloud }}"
container_format: bare
disk_format: qcow2
filename: /tmp/test-only-amphora-x64-haproxy-ubuntu-bionic.qcow2
is_public: false
name: test-only-amphora-x64-haproxy-ubuntu-bionic
owner: service
properties:
hw_architecture: x86_64
hw_rng_model: virtio
state: present
tags:
- amphora
- name: Create network {{ network_name }} for LB
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
state: present
- name: Create subnet {{ subnet_name }} on network {{ network_name }} for LB
openstack.cloud.subnet:
cloud: "{{ cloud }}"
network_name: "{{ network_name }}"
name: "{{ subnet_name }}"
state: present
enable_dhcp: true
dns_nameservers:
- 8.8.8.7
- 8.8.8.8
cidr: 192.168.0.0/24
gateway_ip: 192.168.0.1
allocation_pool_start: 192.168.0.2
allocation_pool_end: 192.168.0.254
- name: Create loadbalancer - generic
openstack.cloud.loadbalancer:
cloud: "{{ cloud }}"
state: present
name: "{{ lb_name }}"
vip_subnet: "{{ subnet_name }}"
timeout: 450
- name: Delete loadbalancer
openstack.cloud.loadbalancer:
cloud: "{{ cloud }}"
state: absent
name: "{{ lb_name }}"
timeout: 150
- name: Delete subnet {{ subnet_name }} on network {{ network_name }}
openstack.cloud.subnet:
cloud: "{{ cloud }}"
network_name: "{{ network_name }}"
name: "{{ subnet_name }}"
state: absent
- name: Delete network {{ network_name }} of LB
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
state: absent

View File

@@ -0,0 +1 @@
sdk_log_file_path: "{{ playbook_dir }}/sdk.log"

View File

@@ -0,0 +1,20 @@
---
- name: Trigger flavor listing
openstack.cloud.compute_flavor_info:
cloud: "{{ cloud }}"
sdk_log_path: "{{ sdk_log_file_path }}"
sdk_log_level: "DEBUG"
- name: Check log file presence
ansible.builtin.stat:
path: "{{ sdk_log_file_path }}"
register: sdk_log_file
- name: Assert
ansible.builtin.assert:
that:
- "sdk_log_file.stat.exists"
- name: Debug log file content
ansible.builtin.debug:
msg: "{{ lookup('ansible.builtin.file', sdk_log_file_path) }}"

View File

@@ -1,3 +1,7 @@
network_name: shade_network
network_name_newparams: newparams_network
network_shared: false
network_external: false
dns_domain: example.opendev.org
mtu: 1250
port_security_enabled: false

View File

@@ -1,5 +1,5 @@
---
- name: Create network
- name: Create network - generic
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
@@ -7,8 +7,71 @@
shared: "{{ network_shared }}"
external: "{{ network_external }}"
- name: Delete network
openstack.cloud.network:
- name: Gather networks info - generic
openstack.cloud.networks_info:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
filters:
shared: "{{ network_shared|string|capitalize }}"
register: result
- name: Verify networks info - generic
assert:
that:
- result.openstack_networks.0.name == network_name
- (result.openstack_networks.0.shared|lower) == (network_shared|lower)
- result.openstack_networks[0]['router:external'] == {{ network_external }}
- name: Create network - with new SDK params
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name_newparams }}"
state: present
shared: "{{ network_shared }}"
external: "{{ network_external }}"
mtu: "{{ mtu }}"
port_security_enabled: "{{ port_security_enabled }}"
register: result_create_nw_with_new_params
ignore_errors: yes
- name: Check errors below min sdk version - with new SDK params
assert:
that:
- result_create_nw_with_new_params.failed
- '"the installed version of the openstacksdk library MUST be >=0.18.0." in result_create_nw_with_new_params.msg'
when: sdk_version is version('0.18', '<')
- name: Gather networks info - with new SDK params
openstack.cloud.networks_info:
cloud: "{{ cloud }}"
name: "{{ network_name_newparams }}"
register: result_newparams
when: sdk_version is version('0.18', '>=')
- name: Verify networks info - with new SDK params
assert:
that:
- result_newparams.openstack_networks.0.name == network_name_newparams
- result_newparams.openstack_networks.0.mtu == mtu
- result_newparams.openstack_networks.0.port_security_enabled == port_security_enabled
when: sdk_version is version('0.18', '>=')
- name: Delete network - generic and with new SDK params
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ item }}"
state: absent
with_items:
- "{{ network_name }}"
- "{{ network_name_newparams }}"
- name: Gather networks info - deleted
openstack.cloud.networks_info:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
register: result_nonet
- name: Verify networks info - deleted
assert:
that:
- result_nonet.openstack_networks == []

View File

@@ -0,0 +1,85 @@
---
# General run of tests
# - Prepare projects/network objects
# - Create rbac object
# - Get rbac object info
# - Verify RBAC object match
# - Delete rbac object
# - Get rbac object info
# - Verify RBAC object deleted
- name: Create source project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: source_project
description: Source project for network RBAC test
domain_id: default
enabled: True
register: source_project
- name: Create network - generic
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
state: present
project: "{{ source_project.project.id }}"
shared: false
external: "{{ network_external }}"
register: network
- name: Create target project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: Target project for network RBAC test
domain_id: default
enabled: True
register: target_project
- name: Create a new network RBAC policy
openstack.cloud.neutron_rbac_policy:
cloud: "{{ cloud }}"
object_id: "{{ network.network.id }}"
object_type: 'network'
action: 'access_as_shared'
target_project_id: "{{ target_project.project.id }}"
project_id: "{{ source_project.project.id }}"
register: rbac_policy
- name: Get all rbac policies for {{ source_project.project.name }} - after creation
openstack.cloud.neutron_rbac_policies_info:
cloud: "{{ cloud }}"
project_id: "{{ source_project.project.id }}"
register: rbac_policies
- name: Capture all existing policy IDs
set_fact:
rbac_policy_ids: "{{ rbac_policies.policies | map(attribute='id') | list }}"
- name: Verify policy exists - after creation
assert:
that:
- rbac_policy.policy.id in rbac_policy_ids
- name: Delete RBAC policy
openstack.cloud.neutron_rbac_policy:
cloud: "{{ cloud }}"
policy_id: "{{ rbac_policy.policy.id }}"
state: absent
- name: Get all rbac policies for {{ source_project.project.name }} - after deletion
openstack.cloud.neutron_rbac_policies_info:
cloud: "{{ cloud }}"
project_id: "{{ source_project.project.id }}"
register: rbac_policies_remaining
- name: Capture all remaining policy IDs
set_fact:
remaining_rbac_policy_ids: "{{ rbac_policies_remaining.policies | map(attribute='id') | list }}"
- name: Verify policy does not exist - after deletion
assert:
that:
- not rbac_policy.policy.id in remaining_rbac_policy_ids

View File

@@ -0,0 +1,33 @@
---
- name: Get nova compute services info
openstack.cloud.compute_service_info:
cloud: "{{ cloud }}"
register: result
failed_when: "result.openstack_compute_services | length <= 0"
- name: Assert fields on OpenStack SDK before 0.53
when: sdk_version is version(0.53, '<')
assert:
that:
- '["availability_zone", "binary", "disables_reason",
"host", "name", "state", "status", "id"] |
difference(result.openstack_compute_services.0.keys()) | length == 0'
- name: Assert fields on OpenStack SDK 0.53 and later
when: sdk_version is version(0.53, '>=')
assert:
that:
- '["availability_zone", "binary", "disabled_reason", "is_forced_down",
"host", "name", "state", "status", "updated_at", "id"] |
difference(result.openstack_compute_services.0.keys()) | length == 0'
- name: Filter compute services. Supported since OpenStack SDK 0.53.0 (Wallaby).
when: sdk_version is version(0.53, '>=')
block:
- name: Get nova compute services info
openstack.cloud.compute_service_info:
cloud: "{{ cloud }}"
binary: "nova-compute"
register: result
failed_when: "result.openstack_compute_services | length <= 0"

View File

@@ -0,0 +1 @@
container_name: "test-container"

View File

@@ -0,0 +1,60 @@
---
- module_defaults:
openstack.cloud.object_container:
cloud: "{{ cloud }}"
block:
- name: Create an empty container
openstack.cloud.object_container:
container: "{{ container_name }}"
register: container
- name: Verify container was created
assert:
that:
- container is success
- container is changed
- container.container.name == container_name
- name: Set metadata for a container
openstack.cloud.object_container:
container: "{{ container_name }}"
metadata: "Cache-Control='no-cache'"
register: set_meta
- name: Verify container metadata was set
assert:
that:
- set_meta is success
- set_meta is changed
- name: Delete some keys from container metadata
openstack.cloud.object_container:
container: "{{ container_name }}"
keys:
- Cache-Control
register: delete_meta
- name: Verify some keys from container metadata was deleted
assert:
that:
- delete_meta is success
- delete_meta is changed
- name: Delete container
openstack.cloud.object_container:
container: "{{ container_name }}"
state: absent
register: deleted
- name: Verify container was deleted
assert:
that:
- deleted is success
- deleted is changed
always:
- name: Delete container
openstack.cloud.object_container:
container: "{{ container_name }}"
state: absent
ignore_errors: yes

View File

@@ -0,0 +1,2 @@
---
stack_name: "test-stack"

View File

@@ -0,0 +1,11 @@
#
# Minimal HOT template defining a single compute server.
#
heat_template_version: 2013-05-23
description: >
Minimal HOT template for stack
parameters:
resources:
outputs:

View File

@@ -0,0 +1,44 @@
---
- name: Create minimal stack
openstack.cloud.stack:
cloud: "{{ cloud }}"
# template is searched related to playbook location or as absolute path
template: "roles/orchestration/files/hello-world.yaml"
name: "{{ stack_name }}"
- name: List stacks
openstack.cloud.stack_info:
cloud: "{{ cloud }}"
register: stacks
- assert:
that:
- stacks['stacks']|length > 0
- name: Get Single stack
openstack.cloud.stack_info:
cloud: "{{ cloud }}"
name: "{{ stack_name }}"
register: test_stack
- assert:
that:
- test_stack is defined
- test_stack['stacks'][0]['name'] == stack_name
- name: Delete stack
openstack.cloud.stack:
cloud: "{{ cloud }}"
name: "{{ stack_name }}"
state: absent
- name: Get Single stack
openstack.cloud.stack_info:
cloud: "{{ cloud }}"
name: "{{ stack_name }}"
register: stacks
- assert:
that:
- stacks is defined
- (stacks['stacks']|length == 0) or (stacks['stacks'][0]['status'] == 'DELETE_COMPLETE')

View File

@@ -4,3 +4,6 @@ subnet_name: ansible_port_subnet
port_name: ansible_port
secgroup_name: ansible_port_secgroup
no_security_groups: True
binding_profile:
"pci_slot": "0000:03:11.1"
"physical_network": "provider"

View File

@@ -60,6 +60,26 @@
state: absent
name: "{{ port_name }}"
- name: Create port (with dns_name, dns_domain)
openstack.cloud.port:
cloud: "{{ cloud }}"
state: present
name: "{{ port_name }}"
network: "{{ network_name }}"
fixed_ips:
- ip_address: 10.5.5.69
dns_name: "dns-port-name"
dns_domain: "example.com."
register: port
- debug: var=port
- name: Delete port (with dns name,domain)
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: "{{ port_name }}"
- name: Create port (with allowed_address_pairs and extra_dhcp_opts)
openstack.cloud.port:
cloud: "{{ cloud }}"

View File

@@ -1,2 +0,0 @@
dummy_value: 'test-value'
dummy_value_updated: 'test-value-updated'

View File

@@ -1,142 +0,0 @@
---
- name: 'Create project with properties - CHECK_MODE'
check_mode: yes
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: dummy description
domain_id: default
enabled: True
properties:
dummy_key: '{{ dummy_value }}'
register: create_project_cm
- assert:
that:
- create_project_cm is successful
- create_project_cm is changed
- name: 'Create project with properties'
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: dummy description
domain_id: default
enabled: True
properties:
dummy_key: '{{ dummy_value }}'
register: create_project
- assert:
that:
- create_project is successful
- create_project is changed
- '"project" in create_project'
- '"dummy_key" in create_project["project"]'
- create_project["project"].dummy_key == dummy_value
- name: 'Create project with properties (retry - no change) - CHECK_MODE'
check_mode: yes
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: dummy description
domain_id: default
enabled: True
properties:
dummy_key: '{{ dummy_value }}'
register: create_project_retry_cm
- assert:
that:
- create_project_retry_cm is successful
- create_project_retry_cm is not changed
- name: 'Create project with properties (retry - no change)'
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: dummy description
domain_id: default
enabled: True
properties:
dummy_key: '{{ dummy_value }}'
register: create_project_retry
- assert:
that:
- create_project_retry is successful
- create_project_retry is not changed
- '"project" in create_project_retry'
- '"dummy_key" in create_project_retry["project"]'
- create_project_retry["project"].dummy_key == dummy_value
- name: 'Update project with properties - CHECK_MODE'
check_mode: yes
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: new description
properties:
dummy_key: '{{ dummy_value_updated }}'
register: updated_project_cm
- assert:
that:
- updated_project_cm is successful
- updated_project_cm is changed
- name: 'Update project with properties'
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: new description
properties:
dummy_key: '{{ dummy_value_updated }}'
register: updated_project
- assert:
that:
- updated_project is successful
- updated_project is changed
- '"project" in updated_project'
- '"dummy_key" in updated_project["project"]'
- updated_project["project"].dummy_key == dummy_value_updated
- name: 'Update project with properties (retry - no change) - CHECK_MODE'
check_mode: yes
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: new description
properties:
dummy_key: '{{ dummy_value_updated }}'
register: updated_project_retry_cm
- assert:
that:
- updated_project_retry_cm is successful
- updated_project_retry_cm is not changed
- name: 'Update project with properties (retry - no change)'
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: new description
properties:
dummy_key: '{{ dummy_value_updated }}'
register: updated_project_retry
- assert:
that:
- updated_project_retry is successful
- updated_project_retry is not changed
- '"project" in updated_project_retry'
- '"dummy_key" in updated_project_retry["project"]'
- updated_project_retry["project"].dummy_key == dummy_value_updated
- name: Delete project with properties
openstack.cloud.project:
cloud: "{{ cloud }}"
state: absent
name: ansible_project

View File

@@ -0,0 +1,19 @@
dns_zone_name: test.dns.zone.
recordset_name: testrecordset.test.dns.zone.
records: ['10.0.0.0']
updated_records: ['10.1.1.1']
recordset_fields:
- action
- created_at
- description
- id
- links
- name
- project_id
- records
- status
- ttl
- type
- zone_id
- zone_name

View File

@@ -0,0 +1,112 @@
- name: Ensure DNS zone not present before tests
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: "{{ dns_zone_name }}"
zone_type: "primary"
email: test@example.net
state: absent
- name: Ensure dns zone
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: "{{ dns_zone_name }}"
zone_type: "primary"
email: test@example.net
register: dns_zone
- name: Create a recordset
openstack.cloud.recordset:
cloud: "{{ cloud }}"
zone: "{{ dns_zone.zone.name }}"
name: "{{ recordset_name }}"
recordset_type: "a"
records: "{{ records }}"
register: recordset
- name: Verify recordset info
assert:
that:
- recordset is changed
- recordset["recordset"].name == recordset_name
- recordset["recordset"].zone_name == dns_zone.zone.name
- recordset["recordset"].records == records
- name: Assert recordset fields
assert:
that: item in recordset.recordset
loop: "{{ recordset_fields }}"
- name: Create identical recordset
openstack.cloud.recordset:
cloud: "{{ cloud }}"
zone: "{{ dns_zone.zone.name }}"
name: "{{ recordset_name }}"
recordset_type: "a"
records: "{{ records }}"
register: recordset
- name: Assert recordset not changed
assert:
that:
- recordset is not changed
- name: Assert recordset fields
assert:
that: item in recordset.recordset
loop: "{{ recordset_fields }}"
- name: Update a recordset
openstack.cloud.recordset:
cloud: "{{ cloud }}"
zone: "{{ dns_zone.zone.name }}"
name: "{{ recordset_name }}"
recordset_type: "a"
records: "{{ updated_records }}"
description: "new test recordset"
register: recordset
- name: Verify recordset info
assert:
that:
- recordset is changed
- recordset["recordset"].zone_name == dns_zone.zone.name
- recordset["recordset"].name == recordset_name
- recordset["recordset"].records == updated_records
- name: Assert recordset fields
assert:
that: item in recordset.recordset
loop: "{{ recordset_fields }}"
- name: Delete recordset
openstack.cloud.recordset:
cloud: "{{ cloud }}"
zone: "{{ dns_zone.zone.name }}"
name: "{{ recordset.recordset.name }}"
state: absent
register: deleted_recordset
- name: Verify recordset deletion
assert:
that:
- deleted_recordset is successful
- deleted_recordset is changed
- name: Delete unexistent recordset
openstack.cloud.recordset:
cloud: "{{ cloud }}"
zone: "{{ dns_zone.zone.name }}"
name: "{{ recordset.recordset.name }}"
state: absent
register: deleted_recordset
- name: Verify recordset deletion
assert:
that:
- deleted_recordset is not changed
- name: Delete dns zone
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: "{{ dns_zone.zone.name }}"
state: absent

View File

@@ -0,0 +1,47 @@
---
- name: Create project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: dummy description
domain_id: default
enabled: True
register: project
- name: Grant an admin role on the user admin in the project ansible_project
openstack.cloud.role_assignment:
cloud: "{{ cloud }}"
domain: default
project: ansible_project
role: admin
user: admin
- name: Grant an admin role on the user admin in the project ansible_project again
openstack.cloud.role_assignment:
cloud: "{{ cloud }}"
domain: default
project: ansible_project
role: admin
user: admin
register: grant_again
- name: Ensure grant again doesn't change anything
assert:
that:
- not grant_again.changed
- name: Revoke the admin role on the user admin in the project ansible_project
openstack.cloud.role_assignment:
cloud: "{{ cloud }}"
domain: default
project: ansible_project
role: admin
state: absent
user: admin
- name: Delete project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: absent
name: ansible_project

View File

@@ -15,6 +15,30 @@
name: shade_subnet1
cidr: 10.7.7.0/24
- name: Create subnet2
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: present
network_name: "{{ network_name }}"
name: shade_subnet2
cidr: 10.8.8.0/24
- name: Create subnet3
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: present
network_name: "{{ network_name }}"
name: shade_subnet3
cidr: 10.9.9.0/24
- name: Create subnet4
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: present
network_name: "{{ network_name }}"
name: shade_subnet4
cidr: 10.10.10.0/24
- name: Create router
openstack.cloud.router:
cloud: "{{ cloud }}"
@@ -29,6 +53,19 @@
interfaces:
- shade_subnet1
- name: Update router (add interface) again
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: "{{ router_name }}"
interfaces:
- shade_subnet1
register: result
- name: Assert idempotent module
assert:
that: result is not changed
- name: Gather routers info
openstack.cloud.routers_info:
cloud: "{{ cloud }}"
@@ -43,6 +80,93 @@
- "result.openstack_routers.0.name == router_name"
- (result.openstack_routers.0.interfaces_info|length) == 1
- name: Update router (change interfaces)
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: "{{ router_name }}"
interfaces:
- net: '{{ network_name }}'
subnet: shade_subnet2
portip: 10.8.8.1
- net: '{{ network_name }}'
subnet: shade_subnet3
- shade_subnet4
- name: Update router (change interfaces) again
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: "{{ router_name }}"
interfaces:
- net: '{{ network_name }}'
subnet: shade_subnet2
portip: 10.8.8.1
- net: '{{ network_name }}'
subnet: shade_subnet3
- shade_subnet4
register: result
- name: Assert idempotent module
assert:
that: result is not changed
- name: Gather routers info
openstack.cloud.routers_info:
cloud: "{{ cloud }}"
name: "{{ router_name }}"
filters:
admin_state_up: true
register: result
- name: Verify routers info
assert:
that:
- "result.openstack_routers.0.name == router_name"
- (result.openstack_routers.0.interfaces_info|length) == 3
- result.openstack_routers.0.interfaces_info|map(attribute='ip_address')|sort|list ==
['10.10.10.1', '10.8.8.1', '10.9.9.1']
- name: Update router (remove interface)
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: "{{ router_name }}"
interfaces:
- net: '{{ network_name }}'
subnet: shade_subnet1
portip: 10.7.7.1
- name: Update router (remove interface) again
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: "{{ router_name }}"
interfaces:
- net: '{{ network_name }}'
subnet: shade_subnet1
portip: 10.7.7.1
register: result
- name: Assert idempotent module
assert:
that: result is not changed
- name: Gather routers info
openstack.cloud.routers_info:
cloud: "{{ cloud }}"
name: "{{ router_name }}"
filters:
admin_state_up: true
register: result
- name: Verify routers info
assert:
that:
- "result.openstack_routers.0.name == router_name"
- (result.openstack_routers.0.interfaces_info|length) == 1
- result.openstack_routers.0.interfaces_info.0.ip_address == '10.7.7.1'
# Admin operation
- name: Create external network
openstack.cloud.network:
@@ -53,12 +177,12 @@
when:
- network_external
- name: Create subnet2
- name: Create subnet5
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: present
network_name: "{{ external_network_name }}"
name: shade_subnet2
name: shade_subnet5
cidr: 10.6.6.0/24
when:
- network_external
@@ -88,6 +212,142 @@
- "result.openstack_routers.0.name == router_name"
- (result.openstack_routers.0.interfaces_info|length) == 1
- name: Update router (change external fixed ips)
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: "{{ router_name }}"
interfaces:
- shade_subnet1
network: "{{ external_network_name }}"
external_fixed_ips:
- subnet: shade_subnet5
ip: 10.6.6.100
when:
- network_external
- name: Gather routers info
openstack.cloud.routers_info:
cloud: "{{ cloud }}"
name: "{{ router_name }}"
filters:
admin_state_up: true
register: result
- name: Verify routers info
assert:
that:
- "result.openstack_routers.0.name == router_name"
- (result.openstack_routers.0.external_gateway_info.external_fixed_ips|length) == 1
- result.openstack_routers.0.external_gateway_info.external_fixed_ips.0.ip_address == "10.6.6.100"
when:
- network_external
- name: Update router (add external fixed ips)
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: "{{ router_name }}"
interfaces:
- shade_subnet1
network: "{{ external_network_name }}"
external_fixed_ips:
- subnet: shade_subnet5
ip: 10.6.6.100
- subnet: shade_subnet5
ip: 10.6.6.101
when:
- network_external
- name: Update router (add external fixed ips) again
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: "{{ router_name }}"
interfaces:
- shade_subnet1
network: "{{ external_network_name }}"
external_fixed_ips:
- subnet: shade_subnet5
ip: 10.6.6.100
- subnet: shade_subnet5
ip: 10.6.6.101
when:
- network_external
register: result
- name: Assert idempotent module
assert:
that: result is not changed
- name: Gather routers info
openstack.cloud.routers_info:
cloud: "{{ cloud }}"
name: "{{ router_name }}"
filters:
admin_state_up: true
register: result
- name: Verify routers info
assert:
that:
- "result.openstack_routers.0.name == router_name"
- (result.openstack_routers.0.external_gateway_info.external_fixed_ips|length) == 2
- result.openstack_routers.0.external_gateway_info.external_fixed_ips|map(attribute='ip_address')|sort|list ==
["10.6.6.100", "10.6.6.101"]
when:
- network_external
- name: Update router (remove external fixed ips)
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: "{{ router_name }}"
interfaces:
- shade_subnet1
network: "{{ external_network_name }}"
external_fixed_ips:
- subnet: shade_subnet5
ip: 10.6.6.101
when:
- network_external
- name: Update router (remove external fixed ips) again
openstack.cloud.router:
cloud: "{{ cloud }}"
state: present
name: "{{ router_name }}"
interfaces:
- shade_subnet1
network: "{{ external_network_name }}"
external_fixed_ips:
- subnet: shade_subnet5
ip: 10.6.6.101
when:
- network_external
register: result
- name: Assert idempotent module
assert:
that: result is not changed
- name: Gather routers info
openstack.cloud.routers_info:
cloud: "{{ cloud }}"
name: "{{ router_name }}"
filters:
admin_state_up: true
register: result
- name: Verify routers info
assert:
that:
- "result.openstack_routers.0.name == router_name"
- (result.openstack_routers.0.external_gateway_info.external_fixed_ips|length) == 1
- result.openstack_routers.0.external_gateway_info.external_fixed_ips.0.ip_address == "10.6.6.101"
when:
- network_external
- name: Delete router
openstack.cloud.router:
cloud: "{{ cloud }}"
@@ -105,6 +365,24 @@
cloud: "{{ cloud }}"
state: absent
name: shade_subnet2
- name: Delete subnet3
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: absent
name: shade_subnet3
- name: Delete subnet4
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: absent
name: shade_subnet4
- name: Delete subnet5
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: absent
name: shade_subnet5
when:
- network_external

View File

@@ -32,6 +32,26 @@
protocol: tcp
remote_ip_prefix: 0.0.0.0/0
- name: Create TCP rule again with port range (1, 65535)
openstack.cloud.security_group_rule:
cloud: "{{ cloud }}"
security_group: "{{ secgroup_name }}"
state: present
protocol: tcp
port_range_min: 1
port_range_max: 65535
remote_ip_prefix: 0.0.0.0/0
- name: Create TCP rule again with port range (-1, -1)
openstack.cloud.security_group_rule:
cloud: "{{ cloud }}"
security_group: "{{ secgroup_name }}"
state: present
protocol: tcp
port_range_min: -1
port_range_max: -1
remote_ip_prefix: 0.0.0.0/0
- name: Create empty UDP rule
openstack.cloud.security_group_rule:
cloud: "{{ cloud }}"
@@ -40,6 +60,26 @@
protocol: udp
remote_ip_prefix: 0.0.0.0/0
- name: Create UDP rule again with port range (1, 65535)
openstack.cloud.security_group_rule:
cloud: "{{ cloud }}"
security_group: "{{ secgroup_name }}"
state: present
protocol: udp
port_range_min: 1
port_range_max: 65535
remote_ip_prefix: 0.0.0.0/0
- name: Create UDP rule again with port range (-1, -1)
openstack.cloud.security_group_rule:
cloud: "{{ cloud }}"
security_group: "{{ secgroup_name }}"
state: present
protocol: udp
port_range_min: -1
port_range_max: -1
remote_ip_prefix: 0.0.0.0/0
- name: Create HTTP rule
openstack.cloud.security_group_rule:
cloud: "{{ cloud }}"
@@ -61,6 +101,71 @@
remote_ip_prefix: 0.0.0.0/0
direction: egress
- name: List all available rules of all security groups in a project
openstack.cloud.security_group_rule_info:
cloud: "{{ cloud }}"
when: sdk_version is version("0.32", '>=')
register: test_sec_rules
- name: Check - List all available rules of all security groups in a project
assert:
that:
- test_sec_rules.security_group_rules | length > 0
when: sdk_version is version("0.32", '>=')
- name: List all available rules of a specific security group
openstack.cloud.security_group_rule_info:
cloud: "{{ cloud }}"
security_group: "{{ secgroup_name }}"
register: test_sec_rule1
- name: Check - List all available rules of a specific security group
assert:
that:
- test_sec_rule1.security_group_rules | length > 0
- name: List all available rules with filters
openstack.cloud.security_group_rule_info:
cloud: "{{ cloud }}"
security_group: "{{ secgroup_name }}"
protocol: tcp
port_range_min: 80
port_range_max: 80
remote_ip_prefix: 0.0.0.0/0
when: sdk_version is version("0.32", '>=')
register: test_sec_rule
- name: Check - List all available rules with filters
assert:
that:
- test_sec_rule.security_group_rules | length == 1
when: sdk_version is version("0.32", '>=')
- name: List all security groups of a project
openstack.cloud.security_group_info:
cloud: "{{ cloud }}"
register: test_sec_groups
- name: Check - List all security groups of a project
assert:
that:
- test_sec_groups.security_groups | length > 0
- name: Filter security group by name
openstack.cloud.security_group_info:
cloud: "{{ cloud }}"
name: "{{ secgroup_name }}"
register: test_sec_group
- name: Check - List all security groups of a project
assert:
that:
- test_sec_group.security_groups | length == 1
- test_sec_group.security_groups[0]['name'] == secgroup_name
# This fails on Stein only
when: sdk_version is version("0.36.5", '>=')
- name: Delete empty ICMP rule
openstack.cloud.security_group_rule:
cloud: "{{ cloud }}"

View File

@@ -1,5 +1,8 @@
server_network: private
server_name: ansible_server
flavor: m1.tiny
server_alt_network: private_alt
server_alt_subnet: subnet_alt
server_alt_name: ansible_server_alt
flavor_name: m1.tiny
floating_ip_pool_name: public
boot_volume_size: 5

View File

@@ -1,11 +1,22 @@
---
- name: List all images
openstack.cloud.image_info:
cloud: "{{ cloud }}"
register: images
- name: Identify CirrOS image name
set_fact:
image_name: "{{ images.openstack_images|community.general.json_query(query)|first }}"
vars:
query: "[?starts_with(name, 'cirros')].name"
- name: Create server with meta as CSV
openstack.cloud.server:
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_network }}"
auto_floating_ip: false
meta: "key1=value1,key2=value2"
@@ -14,6 +25,16 @@
- debug: var=server
- name: Get info about all servers
openstack.cloud.server_info:
cloud: "{{ cloud }}"
register: info
- name: Check info about servers
assert:
that:
info.openstack_servers|length > 0
- name: Delete server with meta as CSV
openstack.cloud.server:
cloud: "{{ cloud }}"
@@ -21,13 +42,23 @@
name: "{{ server_name }}"
wait: true
- name: Get info about all servers
openstack.cloud.server_info:
cloud: "{{ cloud }}"
register: info
- name: Check info about no servers
assert:
that:
info.openstack_servers|length == 0
- name: Create server with meta as dict
openstack.cloud.server:
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
auto_floating_ip: false
network: "{{ server_network }}"
meta:
@@ -38,6 +69,17 @@
- debug: var=server
- name: Get info about one server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info
- name: Check info about server name
assert:
that:
info.openstack_servers[0].name == server_name
- name: Delete server with meta as dict
openstack.cloud.server:
cloud: "{{ cloud }}"
@@ -50,8 +92,8 @@
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_network }}"
floating_ip_pools:
- "{{ floating_ip_pool_name }}"
@@ -60,6 +102,18 @@
- debug: var=server
- name: Get detailed info about one server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
detailed: true
register: info
- name: Check info about server image name
assert:
that:
info.openstack_servers[0].image.name == image_name
- name: Delete server (FIP from pool/network)
openstack.cloud.server:
cloud: "{{ cloud }}"
@@ -72,8 +126,8 @@
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_network }}"
auto_floating_ip: false
boot_from_volume: true
@@ -90,3 +144,49 @@
state: absent
name: "{{ server_name }}"
wait: true
- name: Create a minimal server
openstack.cloud.server:
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_network }}"
auto_floating_ip: false
wait: true
register: server
- debug: var=server
- name: Get info about servers in all projects
openstack.cloud.server_info:
cloud: "{{ cloud }}"
all_projects: true
register: info
- name: Check info about servers in all projects
assert:
that:
info.openstack_servers|length > 0
- name: Get info about one server in all projects
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
all_projects: true
register: info
- name: Check info about one server in all projects
assert:
that:
info.openstack_servers|length > 0
- name: Delete minimal server
openstack.cloud.server:
cloud: "{{ cloud }}"
state: absent
name: "{{ server_name }}"
wait: true
- include_tasks: server_actions.yml

View File

@@ -0,0 +1,612 @@
- name: Create server
openstack.cloud.server:
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_network }}"
auto_floating_ip: false
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info1
- name: Ensure status for server is ACTIVE
assert:
that:
- info1.openstack_servers.0.status == 'ACTIVE'
- name: Stop server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: stop
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info2
- name: Ensure status for server is SHUTOFF
assert:
that:
- info2.openstack_servers.0.status == 'SHUTOFF'
- server is changed
- name: Stop server again
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: stop
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info3
- name: Ensure status for server is SHUTOFF
assert:
that:
- info3.openstack_servers.0.status == 'SHUTOFF'
- server is not changed
- name: Start server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: start
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info4
- name: Ensure status for server is ACTIVE
assert:
that:
- info4.openstack_servers.0.status == 'ACTIVE'
- server is changed
- name: Start server again
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: start
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info5
- name: Ensure status for server is ACTIVE
assert:
that:
- info5.openstack_servers.0.status == 'ACTIVE'
- server is not changed
- name: Pause server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: pause
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info6
- name: Ensure status for server is PAUSED
assert:
that:
- info6.openstack_servers.0.status == 'PAUSED'
- server is changed
- name: Pause server again
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: pause
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info7
- name: Ensure status for server is PAUSED
assert:
that:
- info7.openstack_servers.0.status == 'PAUSED'
- server is not changed
- name: Unpause server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: unpause
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info8
- name: Ensure status for server is ACTIVE
assert:
that:
- info8.openstack_servers.0.status == 'ACTIVE'
- server is changed
- name: Unpause server again
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: unpause
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info9
- name: Ensure status for server is ACTIVE
assert:
that:
- info9.openstack_servers.0.status == 'ACTIVE'
- server is not changed
- name: Lock server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: lock
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info10
- name: Ensure status for server is ACTIVE
assert:
that:
- info10.openstack_servers.0.status == 'ACTIVE'
# not in all versions 'locked' is supported
- >-
(info10.openstack_server[0]['locked'] is defined and
info10.openstack_server[0]['locked']|bool) or
(info10.openstack_server[0]['locked'] is not defined)
- server is changed
- name: Lock server again
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: lock
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info11
- name: Ensure status for server is ACTIVE
assert:
that:
- info11.openstack_servers.0.status == 'ACTIVE'
# not in all versions 'locked' is supported
- >-
(info11.openstack_server[0]['locked'] is defined and
info11.openstack_server[0]['locked']|bool) or
(info11.openstack_server[0]['locked'] is not defined)
- server is changed # no support for lock idempotency
- name: Unock server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: unlock
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info12
- name: Ensure status for server is ACTIVE
assert:
that:
- info12.openstack_servers.0.status == 'ACTIVE'
# not in all versions 'locked' is supported
- >-
(info12.openstack_server[0]['locked'] is defined and
not info12.openstack_server[0]['locked']|bool) or
(info12.openstack_server[0]['locked'] is not defined)
- server is changed
- name: Unlock server again
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: unlock
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info13
- name: Ensure status for server is ACTIVE
assert:
that:
- info13.openstack_servers.0.status == 'ACTIVE'
- server is changed # no support for unlock idempotency
# not in all versions 'locked' is supported
- >-
(info13.openstack_server[0]['locked'] is defined and
not info13.openstack_server[0]['locked']|bool) or
(info13.openstack_server[0]['locked'] is not defined)
- name: Suspend server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: suspend
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info14
- name: Ensure status for server is SUSPENDED
assert:
that:
- info14.openstack_servers.0.status == 'SUSPENDED'
- server is changed
- name: Suspend server again
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: suspend
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info15
- name: Ensure status for server is SUSPENDED
assert:
that:
- info15.openstack_servers.0.status == 'SUSPENDED'
- server is not changed
- name: Resume server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: resume
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info16
- name: Ensure status for server is ACTIVE
assert:
that:
- info16.openstack_servers.0.status == 'ACTIVE'
- server is changed
- name: Resume server again
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: resume
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info17
- name: Ensure status for server is ACTIVE
assert:
that:
- info17.openstack_servers.0.status == 'ACTIVE'
- server is not changed
- name: Rebuild server - error
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: rebuild
wait: true
register: server
ignore_errors: true
- name: Ensure server rebuild failed
assert:
that:
- server is failed
- "'missing: image' in server.msg "
- name: Rebuild server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
image: "{{ image_name }}"
action: rebuild
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info18
- name: Ensure status for server is ACTIVE
assert:
that:
- info18.openstack_servers.0.status in ('ACTIVE', 'REBUILD')
- server is changed
- name: Rebuild server with admin password
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
image: "{{ image_name }}"
action: rebuild
wait: true
admin_password: random
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info19
- name: Ensure status for server is ACTIVE
assert:
that:
- info19.openstack_servers.0.status in ('ACTIVE', 'REBUILD')
- server is changed
- name: Shelve server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: shelve
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info20
- name: Ensure status for server is SHELVED or SHELVED_OFFLOADED
assert:
that:
- info20.openstack_servers.0.status in ['SHELVED', 'SHELVED_OFFLOADED']
- server is changed
- name: Shelve offload server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: shelve_offload
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info21
- name: Ensure status for server is SHELVED_OFFLOADED
# no change if server has been offloaded automatically after first shelve command
assert:
that:
- info21.openstack_servers.0.status == 'SHELVED_OFFLOADED'
- name: Shelve offload server again
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: shelve_offload
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info22
- name: Ensure status for server is SHELVED_OFFLOADED
assert:
that:
- info22.openstack_servers.0.status == 'SHELVED_OFFLOADED'
- server is not changed
- name: Unshelve server
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: unshelve
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info23
- name: Ensure status for server is ACTIVE
assert:
that:
- info23.openstack_servers.0.status == 'ACTIVE'
- server is changed
- name: Unshelve server again
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
action: unshelve
wait: true
register: server
- name: Get info about server
openstack.cloud.server_info:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
register: info24
- name: Ensure status for server is ACTIVE
assert:
that:
- info24.openstack_servers.0.status == 'ACTIVE'
- server is not changed
- name: Create network for alternate server
openstack.cloud.network:
cloud: "{{ cloud_alt }}"
name: "{{ server_alt_network }}"
state: present
- name: Create subnet for alternate server
openstack.cloud.subnet:
cloud: "{{ cloud_alt }}"
network_name: "{{ server_alt_network }}"
name: "{{ server_alt_subnet }}"
state: present
cidr: 192.168.0.0/24
- name: Create server in alternate project
openstack.cloud.server:
cloud: "{{ cloud_alt }}"
state: present
name: "{{ server_alt_name }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_alt_network }}"
auto_floating_ip: false
wait: true
register: server_alt
- name: Get info about server in alternate project
openstack.cloud.server_info:
cloud: "{{ cloud_alt }}"
server: "{{ server_alt_name }}"
register: info25
- name: Ensure status for server in alternate project is ACTIVE
assert:
that:
- info25.openstack_servers.0.status == 'ACTIVE'
- name: Try to stop server in alternate project
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_alt_name }}"
action: stop
wait: true
ignore_errors: true
register: server_alt
- name: Ensure server was not stopped
assert:
that:
- server_alt is failed
- server_alt.msg == "Could not find server {{ server_alt_name }}"
- name: Stop server in alternate project with all_projects=true
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_alt_name }}"
action: stop
wait: true
all_projects: True
register: server_alt
- name: Get info about server in alternate project
openstack.cloud.server_info:
cloud: "{{ cloud_alt }}"
server: "{{ server_alt_name }}"
register: info26
- name: Ensure status for server is SHUTOFF
assert:
that:
- info26.openstack_servers.0.status == 'SHUTOFF'
- server_alt is changed
- name: Delete server in alternate project
openstack.cloud.server:
cloud: "{{ cloud_alt }}"
state: absent
name: "{{ server_alt_name }}"
wait: true
- name: Delete subnet for alternate server
openstack.cloud.subnet:
cloud: "{{ cloud_alt }}"
name: "{{ server_alt_subnet }}"
state: absent
- name: Delete network for alternate server
openstack.cloud.network:
cloud: "{{ cloud_alt }}"
name: "{{ server_alt_network }}"
state: absent

View File

@@ -17,6 +17,19 @@
allocation_pool_start: 192.168.0.2
allocation_pool_end: 192.168.0.4
- name: Create subnet {{ subnet_name }} on network {{ network_name }} again
openstack.cloud.subnet:
cloud: "{{ cloud }}"
network_name: "{{ network_name }}"
enable_dhcp: "{{ enable_subnet_dhcp }}"
name: "{{ subnet_name }}"
state: present
cidr: 192.168.0.0/24
gateway_ip: 192.168.0.1
allocation_pool_start: 192.168.0.2
allocation_pool_end: 192.168.0.4
register: idem1
- name: Update subnet {{ subnet_name }} allocation pools
openstack.cloud.subnet:
cloud: "{{ cloud }}"
@@ -24,7 +37,8 @@
name: "{{ subnet_name }}"
state: present
cidr: 192.168.0.0/24
allocation_pool_start: 192.168.0.5
gateway_ip: 192.168.0.1
allocation_pool_start: 192.168.0.2
allocation_pool_end: 192.168.0.8
- name: Get Subnet Info
@@ -36,19 +50,17 @@
- name: Verify Subnet Allocation Pools Exist
assert:
that:
- idem1 is not changed
- subnet_result.openstack_subnets is defined
- subnet_result.openstack_subnets | length == 1
- subnet_result.openstack_subnets[0].allocation_pools is defined
- subnet_result.openstack_subnets[0].allocation_pools | length == 2
- subnet_result.openstack_subnets[0].allocation_pools | length == 1
- name: Verify Subnet Allocation Pools
assert:
that:
- subnet_result.openstack_subnets[0].allocation_pools | selectattr('start','equalto',item.start) | list | count > 0
- subnet_result.openstack_subnets[0].allocation_pools | selectattr('end','equalto',item.end) | list | count > 0
loop:
- {start: '192.168.0.2', end: '192.168.0.4'}
- {start: '192.168.0.5', end: '192.168.0.8'}
- subnet_result.openstack_subnets[0].allocation_pools.0.start == '192.168.0.2'
- subnet_result.openstack_subnets[0].allocation_pools.0.end == '192.168.0.8'
- name: Delete subnet {{ subnet_name }}
openstack.cloud.subnet:

View File

@@ -0,0 +1,5 @@
subnet_pool_name: "subnet_pool"
address_scope_name: "address_scope"
default_prefix_length: 24
minimum_prefix_length: 10
maximum_prefix_length: 30

View File

@@ -0,0 +1,73 @@
---
- name: Create address_scope
openstack.cloud.address_scope:
cloud: "{{ cloud }}"
name: "{{ address_scope_name }}"
shared: False
ip_version: "4"
register: create_address_scope
- name: Create subnet pool
openstack.cloud.subnet_pool:
cloud: "{{ cloud }}"
name: "{{ subnet_pool_name }}"
shared: False
address_scope: "{{ address_scope_name }}"
prefixes:
- 192.168.0.0/24
register: create_subnet_pool
- name: Verify subnet pool
assert:
that:
- create_subnet_pool is successful
- create_subnet_pool is changed
- create_subnet_pool.subnet_pool.name == subnet_pool_name
- create_subnet_pool.subnet_pool.is_shared == False
- create_subnet_pool.subnet_pool.is_default == False
- create_subnet_pool.subnet_pool.address_scope_id == create_address_scope.address_scope.id
- create_subnet_pool.subnet_pool.prefixes == ['192.168.0.0/24']
- name: Update subnet pool
openstack.cloud.subnet_pool:
cloud: "{{ cloud }}"
name: "{{ subnet_pool_name }}"
address_scope: "{{ address_scope_name }}"
shared: False
default_prefix_length: "{{ default_prefix_length }}"
minimum_prefix_length: "{{ minimum_prefix_length }}"
maximum_prefix_length: "{{ maximum_prefix_length }}"
description: "test"
prefixes:
- 192.168.0.0/24
- 192.168.1.0/24
register: update_subnet_pool
- name: Verify updated subnet pool
assert:
that:
- update_subnet_pool is successful
- update_subnet_pool is changed
- update_subnet_pool.subnet_pool.name == subnet_pool_name
- update_subnet_pool.subnet_pool.is_shared == False
- update_subnet_pool.subnet_pool.is_default == False
- update_subnet_pool.subnet_pool.address_scope_id == create_address_scope.address_scope.id
- update_subnet_pool.subnet_pool.prefixes == ['192.168.0.0/23']
- update_subnet_pool.subnet_pool.description == 'test'
- update_subnet_pool.subnet_pool.default_prefix_length == default_prefix_length
- update_subnet_pool.subnet_pool.minimum_prefix_length == minimum_prefix_length
- update_subnet_pool.subnet_pool.maximum_prefix_length == maximum_prefix_length
- name: Delete created subnet pool
openstack.cloud.subnet_pool:
cloud: "{{ cloud }}"
name: "{{ subnet_pool_name }}"
state: absent
- name: Delete created address scope
openstack.cloud.address_scope:
cloud: "{{ cloud }}"
name: "{{ address_scope_name }}"
state: absent

View File

@@ -1,30 +0,0 @@
---
- name: Create user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
password: secret
email: ansible.user@nowhere.net
domain: default
default_project: demo
register: user
- debug: var=user
- name: Update user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
password: secret
email: updated.ansible.user@nowhere.net
register: updateduser
- debug: var=updateduser
- name: Delete user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: absent
name: ansible_user

View File

@@ -8,10 +8,63 @@
display_description: Test volume
register: vol
- name: Create volume snapshot
openstack.cloud.volume_snapshot:
cloud: "{{ cloud }}"
state: present
display_name: ansible_volume_snapshot
volume: ansible_volume
register: vol_snap
- name: Get snapshot info
openstack.cloud.volume_snapshot_info:
cloud: "{{ cloud }}"
name: ansible_volume_snapshot
register: snap_info
ignore_errors: sdk_version is version('0.49', '<')
- name: Create volume backup
openstack.cloud.volume_backup:
cloud: "{{ cloud }}"
state: present
display_name: ansible_volume_backup
volume: ansible_volume
register: vol_backup
ignore_errors: sdk_version is version('0.49', '<')
- name: Get backup info
openstack.cloud.volume_backup_info:
cloud: "{{ cloud }}"
name: ansible_volume_backup
register: backup_info
ignore_errors: sdk_version is version('0.49', '<')
- debug: var=vol
- debug: var=vol_backup
- debug: var=backup_info
- debug: var=snap_info
- name: Delete volume backup
openstack.cloud.volume_backup:
cloud: "{{ cloud }}"
display_name: ansible_volume_backup
state: absent
ignore_errors: sdk_version is version(0.49, '<')
- name: Delete volume snapshot
openstack.cloud.volume_snapshot:
cloud: "{{ cloud }}"
display_name: ansible_volume_snapshot
volume: ansible_volume
state: absent
- name: Delete volume
openstack.cloud.volume:
cloud: "{{ cloud }}"
state: absent
display_name: ansible_volume
- include_tasks: volume_info.yml

View File

@@ -0,0 +1,155 @@
- name: Get info about volumes and all projects for all SDK
openstack.cloud.volume_info:
cloud: "{{ cloud }}"
details: true
all_projects: true
register: all_sdk
ignore_errors: true
- name: Check info for all projects
assert:
that:
# Rocky SDK doesn't have all_projects attribute
- >-
(all_sdk is failed and sdk_version is version(0.19, '<')) or
all_sdk is success
- name: Get info about volumes for all SDK
openstack.cloud.volume_info:
cloud: "{{ cloud }}"
details: true
register: all_sdk1
ignore_errors: true
- name: Check info for all SDK
assert:
that:
- all_sdk1 is success
- all_sdk1.volumes is defined
- name: Run tests for SDK > 0.28 (from train)
when: sdk_version is version(0.28, '>')
block:
- name: Get info about volumes
openstack.cloud.volume_info:
cloud: "{{ cloud }}"
all_projects: true
register: delete
- name: Clean up volumes before the test
openstack.cloud.volume:
cloud: "{{ cloud }}"
state: absent
display_name: "{{ vol.name }}"
loop: "{{ delete.volumes }}"
loop_control:
loop_var: vol
- name: Create volume
openstack.cloud.volume:
cloud: "{{ cloud }}"
state: present
size: 1
display_name: ansible_test
display_description: testci
register: vol
- name: Get info about volumes
openstack.cloud.volume_info:
cloud: "{{ cloud }}"
details: true
all_projects: true
register: info
- name: Check info
assert:
that:
- info.volumes | selectattr("description", "equalto", "testci") | list | length == 1
- info.volumes.0.name == 'ansible_test'
- info.volumes.0.status == 'available'
- name: Get not detailed info about volumes
openstack.cloud.volume_info:
cloud: "{{ cloud }}"
details: false
all_projects: true
register: info1
- name: Check info
assert:
that:
- info1.volumes | selectattr("id", "equalto", info.volumes.0.id) | list | length == 1
- info1.volumes.0.name == 'ansible_test'
- info1.volumes.0.status == None
- name: Get info about volumes with name
openstack.cloud.volume_info:
cloud: "{{ cloud }}"
details: false
name: ansible_test
all_projects: true
register: info2
- name: Check info
assert:
that:
- info2.volumes | length == 1
- info2.volumes.0.name == 'ansible_test'
- name: Get info about volumes with non-existent name
openstack.cloud.volume_info:
cloud: "{{ cloud }}"
details: false
name: nothing_here
all_projects: true
register: info3
- name: Check info
assert:
that:
- info3.volumes | length == 0
- name: Get info about volumes
openstack.cloud.volume_info:
cloud: "{{ cloud }}"
details: false
name: ansible_test
all_projects: true
register: info4
- name: Check info
assert:
that:
- info4.volumes | length == 1
- info4.volumes.0.name == 'ansible_test'
- name: Get info about volumes not from all projects
openstack.cloud.volume_info:
cloud: "{{ cloud }}"
details: false
name: ansible_test
register: info4a
- name: Check info
assert:
that:
- info4a.volumes | length == 1
- info4a.volumes.0.name == 'ansible_test'
- name: Delete volume
openstack.cloud.volume:
cloud: "{{ cloud }}"
state: absent
display_name: ansible_test
- name: Get info when no volumes
openstack.cloud.volume_info:
cloud: "{{ cloud }}"
all_projects: true
register: info5
- name: Check info
assert:
that:
- info5.volumes | selectattr("name", "equalto", "ansible_test") | list | length == 0

126
ci/run-ansible-tests-collection.sh Normal file → Executable file
View File

@@ -1,3 +1,4 @@
#!/bin/bash
#############################################################################
# run-ansible-tests.sh
#
@@ -6,20 +7,22 @@
#
# tox -e ansible [TAG ...]
# or
# tox -e ansible -- -c cloudX [TAG ...]
# tox -e ansible -- -c cloudX -u cloudY [TAG ...]
# or to use the development version of Ansible:
# tox -e ansible -- -d -c cloudX [TAG ...]
# tox -e ansible -- -d -c cloudX -u cloudY [TAG ...]
#
# USAGE:
# run-ansible-tests.sh -e ENVDIR [-d] [-c CLOUD] [TAG ...]
# run-ansible-tests.sh -e ENVDIR [-d] [-c CLOUD] [-u CLOUD_ALT] [TAG ...]
#
# PARAMETERS:
# -d Use Ansible source repo development branch.
# -e ENVDIR Directory of the tox environment to use for testing.
# -c CLOUD Name of the cloud to use for testing.
# Defaults to "devstack-admin".
# [TAG ...] Optional list of space-separated tags to control which
# modules are tested.
# -d Use Ansible source repo development branch.
# -e ENVDIR Directory of the tox environment to use for testing.
# -c CLOUD Name of the cloud to use for testing.
# Defaults to "devstack-admin".
# -u CLOUD_ALT Name of another cloud to use for testing.
# Defaults to "devstack-alt".
# [TAG ...] Optional list of space-separated tags to control which
# modules are tested.
#
# EXAMPLES:
# # Run all Ansible tests
@@ -31,50 +34,65 @@
set -ex
CLOUD="devstack-admin"
CLOUD_ALT="devstack-alt"
ENVDIR=
USE_DEV=0
while getopts "c:de:" opt
while getopts "c:de:u:" opt
do
case $opt in
d) USE_DEV=1 ;;
c) CLOUD=${OPTARG} ;;
e) ENVDIR=${OPTARG} ;;
?) echo "Invalid option: -${OPTARG}"
c) CLOUD=$OPTARG ;;
u) CLOUD_ALT=$OPTARG ;;
e) ENVDIR=$OPTARG ;;
?) echo "Invalid option: -$OPTARG"
exit 1;;
esac
done
if [ -z ${ENVDIR} ]
then
# Shift arguments read by getopts
shift $((OPTIND-1))
# Remaining arguments are Ansible tags
TAGS=$( echo "$*" | tr ' ' , )
if [ -z "$ENVDIR" ]; then
echo "Option -e is required"
exit 1
fi
shift $((OPTIND-1))
TAGS=$( echo "$*" | tr ' ' , )
if [ ! -d ci ]; then
echo "Script must be run from collection's root directory"
exit 2
fi
# Install Ansible collections before dealing with virtual environments for Ansible
# Install collections used in ci
ansible-galaxy collection install --requirements-file ci/requirements.yml
# Install this collection
if [ -z "$PIP_INSTALL" ]; then
tox -ebuild
ansible-galaxy collection install "$(find build_artifact/ -maxdepth 1 -name 'openstack-cloud-*')" --force
TEST_COLLECTIONS_PATHS=${HOME}/.ansible/collections:$ANSIBLE_COLLECTIONS_PATHS
else
pip freeze | grep ansible-collections-openstack
TEST_COLLECTIONS_PATHS=$VIRTUAL_ENV/share/ansible/collections:$ANSIBLE_COLLECTIONS_PATHS
fi
# We need to source the current tox environment so that Ansible will
# be setup for the correct python environment.
source $ENVDIR/bin/activate
source "$ENVDIR/bin/activate"
if [ ${USE_DEV} -eq 1 ]
then
if [ -d ${ENVDIR}/ansible ]
then
if [ "$USE_DEV" -eq 1 ]; then
if [ -d "$ENVDIR/ansible" ]; then
echo "Using existing Ansible source repo"
else
echo "Installing Ansible source repo at $ENVDIR"
git clone --recursive https://github.com/ansible/ansible.git ${ENVDIR}/ansible
git clone --recursive https://github.com/ansible/ansible.git "$ENVDIR/ansible"
fi
source $ENVDIR/ansible/hacking/env-setup
fi
# Run the shade Ansible tests
tag_opt=""
if [ ! -z ${TAGS} ]
then
tag_opt="--tags ${TAGS}"
source "$ENVDIR/ansible/hacking/env-setup"
fi
# Loop through all ANSIBLE_VAR_ environment variables to allow passing the further
@@ -86,26 +104,32 @@ for var in $(env | grep -e '^ANSIBLE_VAR_'); do
ANSIBLE_VARS+="${ANSIBLE_VAR_NAME}=${ANSIBLE_VAR_VALUE} " # concat variables
done
# Until we have a module that lets us determine the image we want from
# within a playbook, we have to find the image here and pass it in.
# We use the openstack client instead of nova client since it can use clouds.yaml.
IMAGE=`openstack --os-cloud=${CLOUD} image list -f value -c Name | grep cirros | grep -v -e ramdisk -e kernel`
if [ $? -ne 0 ]
then
echo "Failed to find Cirros image"
exit 1
# Discover openstacksdk version
SDK_VER=$(python -c "import openstack; print(openstack.version.__version__)")
# Choose integration tests
tag_opt=""
if [ -n "$TAGS" ]; then
tag_opt="--tags $TAGS"
fi
# install collections
tox -ebuild
ansible-galaxy collection build --force . --output-path ./build_artifact
ansible-galaxy collection install $(ls build_artifact/openstack-cloud-*) --force
# Discover openstackSDK version
SDK_VER=$(python -c "import openstack; print(openstack.version.__version__)")
pushd ci/
# run tests
ANSIBLE_COLLECTIONS_PATHS=${HOME}/.ansible/collections ansible-playbook \
if ! systemctl is-enabled devstack@o-api.service 2>&1; then
# Skip loadbalancer tasks if Octavia is not available
tag_opt+=" --skip-tags loadbalancer"
fi
# TODO: Replace with more robust test for Magnum availability
if [ ! -e /etc/magnum ]; then
# Skip coe tasks if Magnum is not available
tag_opt+=" --skip-tags coe_cluster,coe_cluster_template"
fi
cd ci/
# Run tests
set -o pipefail
# shellcheck disable=SC2086
ANSIBLE_COLLECTIONS_PATHS=$TEST_COLLECTIONS_PATHS ansible-playbook \
-vvv ./run-collection.yml \
-e "sdk_version=${SDK_VER} cloud=${CLOUD} image=${IMAGE} ${ANSIBLE_VARS}" \
${tag_opt}
popd
-e "sdk_version=${SDK_VER} cloud=${CLOUD} cloud_alt=${CLOUD_ALT} ${ANSIBLE_VARS}" \
${tag_opt} 2>&1 | sudo tee /opt/stack/logs/test_output.log

View File

@@ -4,12 +4,31 @@
gather_facts: true
roles:
- { role: address_scope, tags: address_scope }
- { role: auth, tags: auth }
- { role: catalog_service, tags: catalog_service }
- { role: client_config, tags: client_config }
- { role: coe_cluster, tags: coe_cluster }
- { role: coe_cluster_template, tags: coe_cluster_template }
- { role: dns_zone_info, tags: dns_zone_info }
- role: object_container
tags: object_container
when: sdk_version is version(0.18, '>=')
- { role: group, tags: group }
# TODO(mordred) Reenable this once the fixed openstack.cloud.image winds up in an
# upstream ansible release.
# - { role: image, tags: image }
- role: dns
tags: dns
when: sdk_version is version(0.28, '>=')
- { role: endpoint, tags: endpoint }
- { role: floating_ip_info, tags: floating_ip_info }
- { role: host_aggregate, tags: host_aggregate }
- { role: identity_domain_info, tags: identity_domain_info }
- { role: identity_group_info, tags: identity_group_info }
- { role: identity_user, tags: identity_user }
- { role: identity_user_info, tags: identity_user_info }
- { role: identity_role, tags: identity_role }
- { role: identity_role_info, tags: identity_role_info }
- { role: image, tags: image }
- { role: image_info, tags: image_info }
- { role: keypair, tags: keypair }
- { role: keystone_domain, tags: keystone_domain }
- role: keystone_mapping
@@ -21,20 +40,34 @@
- role: keystone_federation_protocol
tags: keystone_federation_protocol
when: sdk_version is version(0.44, '>=')
- { role: keystone_role, tags: keystone_role }
- { role: logging, tags: logging }
- { role: network, tags: network }
- role: neutron_rbac
tags:
- rbac
- neutron_rbac
- { role: nova_flavor, tags: nova_flavor }
- role: compute_flavor_info
tags: nova_flavor
- role: nova_services
tags: nova_services
when: sdk_version is version(0.44, '>=')
- { role: object, tags: object }
- { role: port, tags: port }
- { role: project, tags: project }
- role: project_properties
tags: project_properties
when: sdk_version is version("0.45.01", '>')
- { role: recordset, tags: recordset }
- { role: role_assignment, tags: role_assignment }
- { role: router, tags: router }
- { role: security_group, tags: security_group }
- { role: server, tags: server }
- { role: subnet, tags: subnet }
- { role: user, tags: user }
- { role: subnet_pool, tags: subnet_pool }
- { role: user_group, tags: user_group }
- { role: user_role, tags: user_role }
- { role: volume, tags: volume }
- role: orchestration
tags: orchestrate
when: sdk_version is version("0.53.0", '>=')
- role: loadbalancer
tags: loadbalancer
- { role: floating_ip, tags: floating_ip }

115
docs/branching.md Normal file
View File

@@ -0,0 +1,115 @@
# Ansible OpenStack Collection and its branches
Our codebase has been split into two separate release series, `2.x.x` and `1.x.x`:
* `2.x.x` releases of Ansible OpenStack collection are compatible with [OpenStack SDK][openstacksdk] `1.x.x` and its
release candidates `0.99.0` and later *only* (OpenStack Zed and later). Our [`master` branch][a-c-o-branch-master]
tracks our `2.x.x` releases.
* `1.x.x` releases of Ansible OpenStack collection are compatible with [OpenStack SDK][openstacksdk] `0.x.x` prior to
`0.99.0` *only* (OpenStack Yoga and earlier). Our [`stable/1.0.0` branch][a-c-o-branch-stable-1-0-0] tracks our
`1.x.x` releases.
* `2.x.x` releases of Ansible OpenStack collection are not backward compatible to `1.x.x` releases ⚠️
Both branches will be developed in parallel for the time being. Patches from `master` will be backported to
`stable/1.0.0` on a best effort basis but expect new features to be introduced in our `master` branch only.
Contributions are welcome for both branches!
Our decision to break backward compatibility was not taken lightly. OpenStack SDK's first major release (`1.0.0` and its
release candidates >=`0.99.0`) has streamlined and improved large parts of its codebase. For example, its Connection
interface now consistently uses the Resource interfaces under the hood. [This required breaking changes from older SDK
releases though][openstacksdk-release-notes-zed]. The Ansible OpenStack collection is heavily based on OpenStack SDK.
With OpenStack SDK becoming backward incompatible, so does our Ansible OpenStack collection. For example, with
openstacksdk `>=0.99.0` most Ansible modules return dictionaries instead `Munch` objects and many of their keys have
been renamed. We simply lack the development resources to maintain a backward compatible interface in Ansible OpenStack
collection across several SDK releases.
[a-c-o-branch-master]: https://opendev.org/openstack/ansible-collections-openstack/src/branch/master
[a-c-o-branch-stable-1-0-0]: https://opendev.org/openstack/ansible-collections-openstack/src/branch/stable/1.0.0
[ansible-tags]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_tags.html
[openstacksdk-cloud-layer-stays]: https://meetings.opendev.org/irclogs/%23openstack-sdks/%23openstack-sdks.2022-04-27.log.html
[openstacksdk-release-notes-zed]: https://docs.openstack.org/releasenotes/openstacksdk/zed.html
[openstacksdk-to-dict]: https://opendev.org/openstack/openstacksdk/src/branch/master/openstack/resource.py
[openstacksdk]: https://opendev.org/openstack/openstacksdk
## Notable changes between release series 2.x.x and 1.x.x
When we ported our collection to [openstacksdk][openstacksdk] `>=0.99.0`, a series of changes were applied to our
`master` branch. We went through each module in our collection and did the following:
* Identify function calls which use [openstacksdk][openstacksdk]'s cloud layer, e.g. `self.conn.get_network()`. Change
these calls to functions from openstacksdk's resource proxies, e.g. `self.conn.network.find_network()`, if possible.
As a guideline use this decision tree:
- If a functionality requires a single api call (to the OpenStack API), then use functions from openstacksdk's
resource proxies.
- If a functionality requires multiple api calls (to the OpenStack API), e.g. when creating and attaching a floating
ip to a server, then use functions from openstacksdk's cloud layer.
- When unsure which of openstacksdk's layers to use, then first go to resource proxies and then to its cloud layer.
Mainly this applies to functions retrieving information, i.e. all calls where we get info about cloud resources
should be changed to openstacksdk functions which return proxy resources.
**Note**: Using openstacksdk's cloud layer for functionality which is not provided by openstacksdk's proxy layer is
acceptable. [openstacksdk's cloud layer is not going away][openstacksdk-cloud-layer-stays]. For example, listing
functions in openstacksdk's cloud layer such as `search_users()` often allow to filter results with function parameter
`filters`. openstacksdk's proxy layer does not provide an equivalent and thus using `search_users()` is fine.
* Functions in openstacksdk's cloud layer often have different return values then pre-0.99.0 releases. When return
values have changed in any of the functions which a module uses, update `RETURN` variable. If a module has no `RETURN`
variable, define it.
* Only return data types such as lists or dictionaries to Ansible. For example, the return statement
`self.exit_json(changed=False, floating_ips=floating_ips)` in module [`floating_ip_info`](
../plugins/modules/floating_ip_info.py) shall return a list of `dict`'s. Use openstacksdk's `to_dict` function to
convert resources to dictionaries. Setting its parameters such as `computed` to `False` will drop computed attributes
from the resulting dict. Read [`to_dict`'s docstring][openstacksdk-to-dict] for more parameters. Using `to_dict` might
change the return values of your Ansible module. Please document changes to return values in `RETURN`.
* Older openstacksdk releases did not provide the `to_dict` function. We decided to allow breaking backward
compatibility with release `2.x.x`, so workarounds such as `(o.to_dict() if hasattr(o, 'to_dict') else dict(o))` are
not required anymore and shall be avoided.
* Manually dropping attributes such as `location` or `link` from openstacksdk resources is no longer necessary.
Workarounds such as
```Python
for raw in self.conn.block_storage.backups(**attrs):
dt = raw.to_dict()
dt.pop('location')
data.append(dt)
```
are no longer necessary and can be removed.
* Add tests to [ci/run-collection.yml](../ci/run-collection.yml) and [ci/roles](../ci/roles). Each module has a
dedicated Ansible role with tests in `ci/roles`. Create one if no such directory exist.
* With release of openstacksdk 0.99.0 most of our CI tests in [ci/](../ci/) failed. To prove that module patches
actually fix issues all CI tests for unrelated broken modules have to be skipped. To run CI tests for patched modules
only, temporarily list the [Ansible tags][ansible-tags] of all CI tests which should run in
`vars: { tox_extra_args: ... }` of job `ansible-collections-openstack-functional-devstack-ansible` in `.zuul.yaml`
([example](https://review.opendev.org/c/openstack/ansible-collections-openstack/+/825291/16/.zuul.yaml)) and send the
patch for review. Once all CI tests are passing in Zuul CI, undo changes to [`.zuul.yaml`](../.zuul.yaml), i.e. revert
changes to `tox_extra_args` and submit final patch for review.
* ~~Cherry-pick or backport patches for `master` branch to `stable/1.0.0` branch. Both branches should divert only if
necessary in order to keep maintainence of two separate branches simple. When applying patches to the `stable/1.0.0`
branch, it is often necessary to make changes to not break backward compatibility on the `stable/1.0.0` branch. On
`master` we use `.to_dict(computed=False)` which we have to change to `.to_dict(computed=True)` on `stable/1.0.0`. For
example, this [patch for `master` branch](
https://review.opendev.org/c/openstack/ansible-collections-openstack/+/828108) has been [tweaked and cherry-picked to
`stable/1.0.0` branch](https://review.opendev.org/c/openstack/ansible-collections-openstack/+/836312).~~
Backporting patches from `master` to `stable/1.0.0` branch have been abandoned due to lack of time and resources ⚠️
* Version checks in modules are no longer necessary because we require openstacksdk >=0.99.0 globally. For example,
drop `min_ver`/`max_ver` constraints on module arguments.
* Rename module parameter names to the attribute names that openstacksdk uses, e.g. `shared` becomes `is_shared`. Keep
old names as aliases for input backward compatibility.
* Some modules have if-else branches for handling cases where a `name` is given. For most modules these can be dropped
safely because names can be passed as a query parameter.
* Some modules do not use `name` as module parameters for resource names. For example, `port` module had an attribute
called `port` instead of `name`. Rename those attributes to `name` to be consistent with other modules and because
openstacksdk is doing the same. Add old attribute names as aliases to keep input backward compatibility.
* Replacing `self.conn.get_*` with `self.conn.*.find_*` functions provide a `ignore_missing=False` parameter. This
allows to drop `self.fail_json()` calls in modules. Less code means less to maintain.
* Some modules pass `ignore_missing=True` to `self.conn.*.find_*` functions and then fail if the return value is `None`.
Often this code can be simplified by changing `ignore_missing` to `False` and dropping the if-else branches.
* When module attribute that have choices, always doubt its values. The module code was probably written long ago and
the choices given might be outdated. It might also make sense to drop the `choices` parameter completely when choices
are to narrow and might soon be outdated again.
* Check comments whether they are still relevant.
* Sanity check existing integration tests. For example, return values of module calls should be tested else running a
test could be useless in the first place.
* Most functions in openstacksdk's cloud layer no longer return `Munch` objects. Instead they return resources which
should be converted to dictionaries. Update `RETURN` docs in modules, e.g. change from `type: complex` to
`type: dict`.
* Move list of expected module results to role defaults, e.g. define a variable `expected_fields`. This enables easier
reuse.
* Following and applying our [development guide](contributing.md) and [review guide](reviewing.md)

189
docs/contributing.md Normal file
View File

@@ -0,0 +1,189 @@
# Development Guide for Ansible OpenStack Collection
Ansible OpenStack collection is a set of Ansible modules for interacting with the OpenStack API as either an admin or an
end user.
We, and the OpenStack community in general, use OpenDev for its development. Patches are submitted to [OpenDev Gerrit][
opendev-gerrit]. Pull requests submitted through GitHub will be ignored. Please read OpenStack's [Developer Workflow][
openstack-developer-workflow] for details.
For hacking on the Ansible OpenStack collection it helps to [prepare a DevStack environment](devstack.md) first.
## Hosting
* [Bug tracker][storyboard]
* [Mailing list `openstack-discuss@lists.openstack.org`][openstack-discuss].
Prefix subjects with `[aoc]` or `[aco]` for faster responses.
* [Code Hosting][opendev-a-c-o]
* [Code Review][gerrit-a-c-o]
## Branches
For rationale behind our `master` and `stable/1.0.0` branches and details on our relation to [openstacksdk][
openstacksdk], please read our [branching docs](branching.md).
## Examples
* For an example on how to write a `*_info` module, have a look at module
[`openstack.cloud.neutron_rbac_policies_info`](../plugins/modules/neutron_rbac_policies_info.py).
* For an example on how to write a regular non-`*_info` module, have a look at module
[`openstack.cloud.neutron_rbac_policy`](../plugins/modules/neutron_rbac_policy.py) or any other module which
contains a `_will_change` method.
* Do NOT use modules which define a `_system_state_change` function as examples, because they often do not properly
define Ansible's check mode, idempotency and/or updates. Refer to modules which define a `_will_change` function
instead.
## Naming
* This collection is named `openstack.cloud`. There is no need for further namespace prefixing.
* Name any module that a cloud consumer would expect from [openstackclient (OSC)][openstackclient], for example `server`
instead of `nova`. This naming convention acknowledges that the end user does not care which service manages the
resource - that is a deployment detail. For example, cloud consumers may not know whether their floating ip address
are managed by Nova or Neutron.
## Interface
* If the resource being managed has an `id`, it should be returned.
* If the resource being managed has an associated object more complex than an `id`, that should be returned instead of
the `id`.
* Modules should return a value of type `dict`, `list` or other primitive data types. For example, `floating_ips` in
`self.exit_json(changed=False, floating_ips=floating_ips)` should to be a list of `dict`s. Use `to_dict()` on
[openstacksdk][openstacksdk] objects to convert resources to dictionaries. Setting its parameters such as `computed`
to `False` will drop computed attributes from the resulting dict. Read [`to_dict`'s docstring][openstacksdk-to-dict]
for more parameters.
* Module results have to be documented in `RETURN` docstring.
* We should document which attribute cannot be updated in `DOCUMENTATION` variable. For example, insert
`'This attribute cannot be updated.'` to `DOCUMENTATION` like we did for the `server` module and others.
* Sorting module options in `DOCUMENTATION`, attributes in `RETURN`, entries in `argument_spec` and expected fields in
integration tests will make reviewing easier and faster.
## Interoperability
* It should be assumed that the cloud consumer does not know details about the deployment choices their cloud provider
made. A best effort should be made to present one sane interface to the Ansible user regardless of deployer choices.
* It should be assumed that a user may have more than one cloud account that they wish to combine as part of a single
Ansible-managed infrastructure.
* All modules should work appropriately against all existing versions of OpenStack regardless of upstream EOL status.
The reason for this is that the Ansible modules are for consumers of cloud APIs who are not in a position to impact
what version of OpenStack their cloud provider is running. It is known that there are OpenStack Public Clouds running
rather old versions of OpenStack, but from a user point of view the Ansible modules can still support these users
without impacting use of more modern versions.
## Coding Guidelines
* Modules should
+ be idempotent (not being idempotent requires a solid reason),
+ return whether something has `changed`,
+ support `check mode`,
+ be based on (be subclasses of) `OpenStackModule` in
`ansible_collections.openstack.cloud.plugins.module_utils.openstack`,
+ should include `extends_documentation_fragment: openstack` in their `DOCUMENTATION` docstring,
+ be registered in `meta/action_groups.yml` for enabling the variables to be set in
[group level][ansible-module-defaults].
* Complex functionality, cloud interaction or interoperability code should be moved to [openstacksdk][openstacksdk].
* OpenStack API interactions should happen via [openstacksdk][openstacksdk] and not via OpenStack component libraries.
The OpenStack component libraries do no have end users as a primary audience, they are for intra-server communication.
* When a resource exist and should be deleted (absent), then pass the resource to the `delete_*` function, not its name.
Passing a name requires openstacksdk to find that resource again, doing a unnecessary api call, because we queried the
resource before.
* `*_info` modules never raise exceptions when resources cannot be found. When resources cannot be found, then a
`*_info` module returns an empty list instead. For example, module `openstack.cloud.neutron_rbac_policies_info` will
return an empty list when no project with name given in module parameter `project` can be found.
* When a id is given in `*_info` modules, then we do not need nor want extra code to handle that. Instead most
[openstacksdk][openstacksdk] resources allow to pass ids as query arguments to OpenStack API. For example,
`identity.identity_providers()` can be used for both cases: Where an id is given and where no id is given. No need to
call `get_identity_provider()`.
* `EXAMPLES` docstring in modules (and Ansible's own modules) consist of a list of tasks. They do not contain YAML
directives end marker line (---) and do not define playbooks (e.g. hosts keyword). They shall be simple, e.g. do not
do fancy loops, heavy use of variables or use Ansible directives for no apparent reason such as ignore_errors or
register.
* `self.params.get('...')` can be replaced with `self.params['...']` because parameters from `argument_spec` will always
be in `self.params`. If not defined differently, they have a default value of `None`.
* Writing code to check that some options cannot be updated and to fail if user still tries to update that value is most
often not worth it. It would require much more code to catch all cases where updates are impossible and we would have
to implement it consistently across modules. Atm we are fine with documenting which attribute cannot be updated in
`DOCUMENTATION` variable. We could simply drop these checks and insert `'This attribute cannot be updated.'` to
`DOCUMENTATION` like we did for the server module and others.
* [openstacksdk][openstacksdk] functions often accept IDs but no names, e.g. `find_address_scope()` and
`create_address_scope()` accept a `project_id` parameter. Most modules in our collection use names for finding
resources, so we want to support the same for resources attributes such as `project_id` in `AddressScope`.
* Constraints for module parameters and error handling can often be implemented in `argument_spec` or `module_kwargs`
`module_kwargs` allows to define dependencies between module options such as [`mutually_exclusive`,
`required_together`, `required_if` etc.][ansible-argument-spec-dependencies].
* When using [openstacksdk][openstacksdk]'s `find_*` functions (`self.conn.*.find_*`), then pass `ignore_missing=False`
instead of checking its return value and failing with `self.fail_json()` if it is `None`.
* Use module option names which match attribute names used in [openstacksdk][openstacksdk], e.g. use `is_shared` instead
of `shared`. When refactoring modules, keep old option names as aliases to keep backward compatibility. Using
openstacksdk names provides two benefits:
- The module inputs and outputs do match, are consistent and thus the module is easier to use.
- Most code for filters and query arguments can be replaced with loops. [This patch for floating_ip_info has some
ideas for how to write loops](https://review.opendev.org/c/openstack/ansible-collections-openstack/+/828613).
* Use functions from [openstacksdk][openstacksdk]'s proxy layer instead of its cloud layer, if possible. For example,
use `self.conn.network.find_network()`, not `self.conn.get_network()`. As a guideline use this decision tree:
- If a functionality requires a single api call (to the OpenStack API), then use functions from openstacksdk's proxy
layer.
- If a functionality requires several api calls (to the OpenStack API), e.g. when creating and attaching a floating ip
to a server, then use functions from openstacksdk's cloud layer.
- When unsure which of openstacksdk's layers to use, then first go to proxy layer, then to its cloud layer and if this
is not sufficient, then use its resource layer. Mainly, this applies to functions retrieving information, i.e. all
calls where we get info about cloud resources should be changed to openstacksdk functions which return proxy
resources.
- It is perfectly fine to use openstacksdk's cloud layer for functionality which is not provided by openstacksdk's
proxy layer. [SDK's cloud layer is not going away][openstacksdk-cloud-layer-stays].
For example, `list_*` functions from openstacksdk's cloud layer such as `search_users()` allow to filter retrieved
results with function parameter `filters`. openstacksdk's proxy layer does not provide an equivalent and thus the
use of `search_users()` is perfectly fine.
## Testing
* Modules have to be tested with CI integration tests (if possible).
* Each module has a corresponding Ansible role containing integration tests in [`ci/roles`](../ci/roles) directory.
* Ensure role names of integration tests in [`ci/roles`](../ci/roles) match the module names.
Only exception are `*_info` modules: Their integration tests are located in the same Ansible roles as their
non-`*_info` equivalents (to reduce redundant code). For example, tests for both modules `federation_mapping` and
`federation_mapping_info` can be found in role `federation_mapping`.
* Zuul CI jobs are defined in [`.zuul.yaml`](../.zuul.yaml).
* Add assertions on return values from Ansible modules in integration tests. For an example, refer to
[`ci/roles/floating_ip/tasks/main.yml`](../ci/roles/floating_ip/tasks/main.yml).
We need those checks to validate return values from [openstacksdk][openstacksdk], which might change across releases.
Adding those assertions will be done in minutes, while checking the output manually during code reviews takes much
more time.
* Our Zuul CI jobs will run `ansible-test` for sanity checking.
* Use `tox -elinters_latest` to run various linters against your code.
## Upload
* Study our [Review Guidelines](reviewing.md) before submitting a patch.
* Use Gerrit's work-in-progress feature to mark the status of the patch. A minus workflow (-w) will be reset when a new
patchset is uploaded and hence easy to miss.
* When you edit a patch, first rebase your patch on top of the current branch. Sometimes we replace code in all modules
which might cause merge conflicts for you otherwise. For example, we dropped all options with default values from
`argument_spec` such as `required=False`.
## Release
Read [Release Guide](releasing.md) on how to publish new releases.
## Permissions
* Only [members of group `ansible-collections-openstack-core`][group-a-c-o-core] are allowed to merge patches.
* Only [members of group `ansible-collections-openstack-release`][group-a-c-o-release] are allowed to push tags and
trigger our release job `ansible-collections-openstack-release` in [galaxy.yml](../galaxy.yml).
* Only members of `openstack` namespace in Ansible Galaxy are allowed to apply changes to meta properties of Ansible
collection [`openstack.cloud`][ansible-galaxy-openstack-cloud] on Ansible Galaxy.
[ansible-argument-spec-dependencies]: https://docs.ansible.com/ansible/latest/dev_guide/developing_program_flow_modules.html#argument-spec-dependencies
[ansible-galaxy-openstack-cloud]: https://galaxy.ansible.com/openstack/cloud
[ansible-module-defaults]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_module_defaults.html
[gerrit-a-c-o]: https://review.opendev.org/q/status:open+project:openstack/ansible-collections-openstack
[group-a-c-o-core]: https://review.opendev.org/admin/groups/0e01228e912733e8b9a8d957631e41665aa0ffbd,members
[group-a-c-o-release]: https://review.opendev.org/admin/groups/8bca2018f3710f94374aee4b3c9771b9ff0a2254,members
[opendev-a-c-o]: https://opendev.org/openstack/ansible-collections-openstack
[opendev-gerrit]: https://review.opendev.org/
[openstack-developer-workflow]: https://docs.openstack.org/infra/manual/developers.html#development-workflow
[openstack-discuss]: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-discuss
[openstackclient]: https://docs.openstack.org/python-openstackclient/latest/
[openstacksdk-cloud-layer-stays]: https://meetings.opendev.org/irclogs/%23openstack-sdks/%23openstack-sdks.2022-04-27.log.html
[openstacksdk-to-dict]: https://opendev.org/openstack/openstacksdk/src/branch/master/openstack/resource.py
[openstacksdk]: https://opendev.org/openstack/openstacksdk
[storyboard]: https://storyboard.openstack.org/#!/project/openstack/ansible-collections-openstack

107
docs/devstack.md Normal file
View File

@@ -0,0 +1,107 @@
# Preparing a DevStack environment for Ansible collection development
For developing on the Ansible OpenStack collection, it helps to install DevStack and two Python [`virtualenv`][
virtualenv]s, one with [openstacksdk][openstacksdk] `<0.99.0` and one with [openstacksdk][openstacksdk] `>=1.0.0` (or
one of its release candidates `>=0.99.0`). The first is for patches against our `stable/1.0.0` branch of the collection,
while the newer openstacksdk is for patches against our `master` branch.
First, [follow DevStack's guide][devstack] to set up DevStack on a virtual machine. An Ansible inventory and a playbook
to set up your own local DevStack as a libvirt domain can be found in Ansible collection [`jm1.cloudy`][jm1-cloudy],
look for host `lvrt-lcl-session-srv-200-devstack`.
**Beware:** DevStack's purpose is to be set up quickly and destroyed after development or testing is done. It cannot
be rebooted safely or upgraded easily.
Some Ansible modules and unit tests in the Ansible OpenStack collection require additional DevStack plugins which
are not enabled by default. [Plugins are enabled in DevStack's `local.conf`][devstack-plugins]. Examples:
- Use the DevStack configuration which the Zuul CI jobs are applying when testing the Ansible OpenStack collection. For
example, go to the logs of job [`ansible-collections-openstack-functional-devstack`][devstack-jobs] and use file
`controller/logs/local_conf.txt` as your `local.conf` for DevStack.
- https://gist.github.com/sshnaidm/43ca23c3f23bd6015d18868ac7405a13
- https://paste.opendev.org/show/812460/
For a list of plugins refer to [DevStack's plugin registry][devstack-plugin-registry].
Next, prepare two Python [`virtualenv`][virtualenv]s, one with [openstacksdk][openstacksdk] `<0.99.0` and one with
[openstacksdk][openstacksdk] `>=1.0.0` (or one of its release candidates `>=0.99.0`):
```sh
# DevStack is presumed to be installed on the development machine
# and its configuration file available at ~/devstack/openrc
git clone https://opendev.org/openstack/ansible-collections-openstack.git
mkdir -p ~/.ansible/collections/ansible_collections/openstack/
ln -s ansible-collections-openstack ~/.ansible/collections/ansible_collections/openstack/cloud
# Prepare environment for developing patches against
# Ansible OpenStack collection 2.x.x and openstacksdk>=0.99.0
cd ansible-collections-openstack/
git checkout master
virtualenv -p python3 ~/.local/share/virtualenv/ansible-openstacksdk-1
source ~/.local/share/virtualenv/ansible-openstacksdk-1/bin/activate
pip install -r test-requirements.txt
pip install git+https://opendev.org/openstack/openstacksdk
pip install ipython
source ~/devstack/openrc admin admin
ipython
cd ..
# Prepare environment for developing patches against
# Ansible OpenStack collection 1.x.x and openstacksdk<0.99.0
virtualenv -p python3 ~/.local/share/virtualenv/ansible-openstacksdk-0
source ~/.local/share/virtualenv/ansible-openstacksdk-0/bin/activate
cd ansible-collections-openstack/
git checkout stable/1.0.0
pip install -r test-requirements.txt
pip install 'openstacksdk<0.99.0'
pip install ipython
source ~/devstack/openrc admin admin
ipython
```
The first IPython instance uses openstacksdk >=0.99.0 and is for developing at the 2.x.x series of the Ansible OpenStack
collection. The second IPython instance uses openstacksdk <0.99.0 and is suited for the 1.x.x series of the collection.
For example, type in each IPython instance:
```python
import openstack
conn = openstack.connect()
# optional
openstack.enable_logging(debug=True)
# and start hacking..
list(conn.network.ips())[0].to_dict(computed=False)
```
To run the unit tests of the collection, run this in a Bash shell:
```sh
SDK_VER=$(python -c "import openstack; print(openstack.version.__version__)")
ansible-playbook -vvv ci/run-collection.yml -e "sdk_version=${SDK_VER} cloud=devstack-admin cloud_alt=devstack-alt"
```
Use `ansible-playbook`'s `--tags` and `--skip-tags` parameters to skip CI tests. For a list of available tags, refer to
[`ci/run-collection.yml`](../ci/run-collection.yml).
Or run Ansible modules individually:
```sh
ansible localhost -m openstack.cloud.floating_ip -a 'server=ansible_server1 wait=true' -vvv
```
When submitting a patch with `git review`, our Zuul CI jobs will test your changes against different versions of
openstacksdk, Ansible and DevStack. Refer to [`.zuul.yaml`](../.zuul.yaml) for a complete view of all CI jobs. To
trigger experimental jobs, write a comment in Gerrit which contains `check experimental`.
Happy hacking!
[devstack-jobs]: https://zuul.opendev.org/t/openstack/builds?job_name=ansible-collections-openstack-functional-devstack&project=openstack/ansible-collections-openstack
[devstack-plugin-registry]: https://docs.openstack.org/devstack/latest/plugin-registry.html
[devstack-plugins]: https://docs.openstack.org/devstack/latest/plugins.html
[devstack]: https://docs.openstack.org/devstack/latest/
[jm1-cloudy]: https://github.com/JM1/ansible-collection-jm1-cloudy
[openstacksdk]: https://opendev.org/openstack/openstacksdk/
[virtualenv]: https://virtualenv.pypa.io/en/latest/

View File

@@ -1,67 +0,0 @@
.. _OpenStack_module_development:
OpenStack Ansible Modules
=========================
These are a set of modules for interacting with the OpenStack API as either an admin
or an end user.
.. contents::
:local:
Naming
------
* This is a collection named ``openstack.cloud``. There is no need for further namespace prefixing.
* Name any module that a cloud consumer would expect to use after the logical resource it manages:
``server`` not ``nova``. This naming convention acknowledges that the end user does not care
which service manages the resource - that is a deployment detail. For example cloud consumers may
not know whether their floating IPs are managed by Nova or Neutron.
Interface
---------
* If the resource being managed has an id, it should be returned.
* If the resource being managed has an associated object more complex than
an id, it should also be returned.
Interoperability
----------------
* It should be assumed that the cloud consumer does not know
details about the deployment choices their cloud provider made. A best
effort should be made to present one sane interface to the Ansible user
regardless of deployer choices.
* It should be assumed that a user may have more than one cloud account that
they wish to combine as part of a single Ansible-managed infrastructure.
* All modules should work appropriately against all existing versions of
OpenStack regardless of upstream EOL status. The reason for this is that
the Ansible modules are for consumers of cloud APIs who are not in a
position to impact what version of OpenStack their cloud provider is
running. It is known that there are OpenStack Public Clouds running rather
old versions of OpenStack, but from a user point of view the Ansible
modules can still support these users without impacting use of more
modern versions.
Libraries
---------
* All modules should use ``OpenStackModule`` from
``ansible_collections.openstack.cloud.plugins.module_utils.openstack``
as their base class.
* All modules should include ``extends_documentation_fragment: openstack``.
* All complex cloud interaction or interoperability code should be housed in
the `openstacksdk <https://opendev.org/openstack/openstacksdk>`_
library.
* All OpenStack API interactions should happen via the openstacksdk and not via
OpenStack Client libraries. The OpenStack Client libraries do no have end
users as a primary audience, they are for intra-server communication.
* All modules should be registered in ``meta/action_groups.yml`` for enabling the
variables to be set in `group level
<https://docs.ansible.com/ansible/latest/user_guide/playbooks_module_defaults.html>`.
Testing
-------
* Integration testing is currently done in `OpenStack's CI system
<https://opendev.org/openstack/ansible-collections-openstack/src/branch/master/zuul.yaml>`

125
docs/releasing.md Normal file
View File

@@ -0,0 +1,125 @@
# Release process for Ansible OpenStack collection
## Publishing to Ansible Galaxy
1. Create entry in [changelog.yaml](../changelogs/changelog.yaml) with commits since last release.
* Modules should be in a separate section `modules`
* Bugfixes and minor changes in their sections
2. Change version in [galaxy.yml](../galaxy.yml). Apply [Semantic Versioning](https://semver.org/):
* Increase major version for breaking changes or modules were removed
* Increase minor version when modules were added
* Increase patch version for bugfixes
3. Run `antsibull-changelog release` command (run `pip install antsibull` before) to generate [CHANGELOG.rst](
../CHANGELOG.rst) and verify correctness of generated files.
4. Commit changes to `changelog.yaml` and `galaxy.yml`, submit patch and wait until it has been merged
5. Tag the release with version as it's described in [OpenStack docs](
https://docs.opendev.org/opendev/infra-manual/latest/drivers.html#tagging-a-release):
* [Make sure you have a valid GnuPG key pair](
https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key)
* `git checkout <your_branch>`
* `git pull --ff-only`
* `git tag -s <version number>` where `<version number>` is your tag
* `git push gerrit <version number>`
6. When your tag has been pushed in the previous step, our release job `ansible-collections-openstack-release`, defined
in [galaxy.yml](../galaxy.yml), will run automatically and publish a new release with your tag to [Ansible Galaxy](
https://galaxy.ansible.com/openstack/cloud). When it has finished, its status and logs can be accessed on [Zuul CI's
builds page](https://zuul.opendev.org/t/openstack/builds?job_name=ansible-collections-openstack-release).
7. When release job `ansible-collections-openstack-release` has failed, you can manually build the collection locally
and publish your release to Ansible Galaxy:
* `git checkout <version number>` where `<version number>` is your tag
* Delete untracked files and directories with `git clean -n; git clean -fd`
* Build collection with `ansible-galaxy`, for example:
```sh
ansible-galaxy collection build --force --output-path /path/to/collection/dir
```
* On success you will find a `*.tar.gz` file in `/path/to/collection/dir`, e.g. `openstack-cloud-1.5.0.tar.gz`
* Go to [your content page on Ansible Galaxy](https://galaxy.ansible.com/my-content/namespaces), open namespace
`openstack`, click on `Upload New Version` and upload your release `*.tar.gz`, e.g. `openstack-cloud-1.5.0.tar.gz`.
Push collection tarballs to the `openstack.cloud` namespace requires membership in `openstack` namespace on Ansible
Galaxy.
* Instead of using Ansible Galaxy web interface, you could also upload your release from cli. For example:
```sh
ansible-galaxy collection publish --token $API_GALAXY_TOKEN -v /path/to/openstack-cloud-1.5.0.tar.gz
```
where `$API_GALAXY_TOKEN` is your API key from [Ansible Galaxy](https://galaxy.ansible.com/me/preferences).
* [Monitor import progress on Ansible Galaxy](https://galaxy.ansible.com/my-imports/) and act accordingly to issues.
8. Announce new release to [The Bullhorn](https://github.com/ansible/community/wiki/News#the-bullhorn): Join
[Ansible Social room on Matrix](https://matrix.to/#/#social:ansible.com) and mention [newsbot](
https://matrix.to/#/@newsbot:ansible.im) to have your news item tagged for review for the next issue!
## Publishing to Fedora
**NOTE:** Before publishing an updated RPM for Fedora or RDO, contact Alfredo Moralejo Alonso <amoralej@redhat.com>
(amoralej) or Joel Capitao <jcapitao@redhat.com> (jcapitao[m]) in `#rdo` on [OFTC IRC](https://www.oftc.net/) about the
latest release process.
**NOTE:** If your username is in Fedora's `admins` group, you can push your commit directly to Fedora's repository for
Ansible OpenStack collection. Otherwise you will have to open pull requests to sent changes.
1. Get familiar with packaging for Fedora. Useful resources are:
* [Fedora's Package Update Guide](https://docs.fedoraproject.org/en-US/package-maintainers/Package_Update_Guide/)
* [Fedora package source for Ansible OpenStack collection](
https://src.fedoraproject.org/rpms/ansible-collections-openstack)
* [Koji page for `ansible-collections-openstack`](https://koji.fedoraproject.org/koji/packageinfo?packageID=33611)
* [Bodhi's page `Create New Update`](https://bodhi.fedoraproject.org/updates/new)
2. Install all necessary packaging tools, mainly `fedpkg`.
3. Create a scratch space with `mkdir fedora-scm`.
4. Fork Fedora repository [rpms/ansible-collections-openstack](
https://src.fedoraproject.org/rpms/ansible-collections-openstack).
5. Clone [rpms/ansible-collections-openstack](https://src.fedoraproject.org/rpms/ansible-collections-openstack) with
`fedpkg clone rpms/ansible-collections-openstack`. Or clone your forked repository (something like
`https://src.fedoraproject.org/fork/sshnaidm/rpms/ansible-collections-openstack`) with
`fedpkg clone forks/sshnaidm/rpms/ansible-collections-openstack` where `sshnaidm` has to be replaced with your
username.
6. `cd ansible-collections-openstack` and go to branch `rawhide` with `fedpkg switch-branch rawhide`.
7. Download new collection sources from Ansible Galaxy using
`wget https://galaxy.ansible.com/download/openstack-cloud-<version_tag>.tar.gz` where `<version_tag>` is a your new
version, e.g. `1.10.0`. Or run `spectool -g *.spec` *after* having changed the `*.spec` file in the next step.
8. Bump version in `*.spec` file as in this [example for `1.9.4`](
https://src.fedoraproject.org/rpms/ansible-collection-containers-podman/c/6dc5eb79a3aa082e062768993bed66675ff9d520):
```diff
+Version: <version-tag>
+Release: 1%{?dist}
```
and add changelog, sort of:
```diff
+* Tue Jun 08 2021 Sagi Shnaidman <sshnaidm@redhat.com> - <version-tag>-1
+- Bump to <version-tag>-1
```
9. Upload sources you downloaded before with `fedpkg new-sources <version-tag>.tar.gz`.
10. Optionally check build with `fedpkg mockbuild`.
11. Verify and commit updated `*.spec` file with:
```sh
fedpkg diff
fedpkg lint # run linters against your changes
fedpkg commit # with message such as 'Bumped Ansible OpenStack collection to <version-tag>'
```
12. Push changes for `rawhide` with `fedpkg push`.
13. Ask Koji to build your package with `fedpkg build`.
14. Optionally check [Koji's page for `ansible-collections-openstack`](
https://koji.fedoraproject.org/koji/packageinfo?packageID=33611).
15. Repeat release process for older Fedora branches such as Fedora 36 aka `f36`:
```sh
fedpkg switch-branch f36
git merge rawhide
fedpkg push
fedpkg build
fedpkg update # or use Bodhi's page "Create New Update" at https://bodhi.fedoraproject.org/updates/new
```
## Publishing to RDO
**NOTE:** Before publishing an updated RPM for Fedora or RDO, contact Alfredo Moralejo Alonso <amoralej@redhat.com>
(amoralej) or Joel Capitao <jcapitao@redhat.com> (jcapitao[m]) in `#rdo` on [OFTC IRC](https://www.oftc.net/) about the
latest release process.
[All `master` branches on RDO trunk](https://trunk.rdoproject.org) consume code from the `master` branch of the Ansible
OpenStack collection. Its RPM is (re)build whenever a new patch has been merged to the collection repository. Afterwards
[it is promoted as any other TripleO components in `client` component CI](
https://docs.openstack.org/tripleo-docs/latest/ci/stages-overview.html).
To update stable RDO branches such as [`CentOS 9 Zed`](https://trunk.rdoproject.org/centos9-zed/), patches have to be
submitted to CentOS Cloud SIG repositories. In this case, create a patch for stable branches such as `wallaby-rdo`, and
`ussuri-rdo` at [ansible-collections-openstack-distgit](
https://github.com/rdo-packages/ansible-collections-openstack-distgit). [Example](
https://review.rdoproject.org/r/c/openstack/ansible-collections-openstack-distgit/+/34282).

66
docs/reviewing.md Normal file
View File

@@ -0,0 +1,66 @@
# Reviews
How to do a review? What to look for when reviewing patches?
* Should functionality be implemented in Ansible modules or in openstacksdk? Ansible modules should only be "wrappers"
for functionality in openstacksdk. Big code chunks are a good indicator that functionality should better be moved to
openstacksdk.
* For each function call(s) and code section which has been refactored, does the new code return the same results?
Pay special attention whenever a function from openstacksdk's cloud layer has been replaced because those functions
often have different semantics than functions of SDK's proxy layer.
* Can API calls (to OpenStack API, not openstacksdk API) be reduced any further to improve performance?
* Can calls to OpenStack API be tweaked to return less data?
For example, listing calls such as `image.images()` or `network.networks()` provide filters to reduce the number of
returned values.
* Sanity check `argument_spec` and `module_kwargs`. Some modules try to be clever and add checks to fail early instead
of letting `openstacksdk` or OpenStack API handle incompatible arguments.
* Are `choices` in module attributes apropriate? Sometimes it makes sense to get rid of the choices because the choices
are simply to narrow and might soon be outdated again.
* Are `choices` in module attributes still valid? Module code might be written long ago and thus the choices might be
horrible outdated.
* Does a module use `name` as module options for resource names instead of e.g. `port` in `port` module? Rename those
attributes to `name` to be consistent with other modules and with openstacksdk. When refactoring a module, then add
the old attribute as an alias to keep backward compatibility.
* Does the module have integration tests in `ci/roles`?
* Is documentation in `DOCUMENTATION`, `RETURN` and `EXAMPLES` up to date?
* Does `RETURN` list all values which are returned by the module?
* Are descriptions, keys, names, types etc. in `RETURN` up to date and sorted?
- For example, [`type: complex` often can be changed to `type: list` / `elements: dict`](
https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html).
- `returned: always, but can be null` often has to be changed to `returned: always, but can be empty` or shorter
`returned: always`.
- Are there any values in `RETURN` which are not returned by OpenStack SDK any longer?
- Module return value documentation can be found in [OpenStack SDK docs](
https://docs.openstack.org/openstacksdk/latest/), e.g. [Identity v3 API](
https://docs.openstack.org/openstacksdk/latest/user/proxies/identity_v3.html).
For more detailed descriptions on return values refer to [OpenStack API](https://docs.openstack.org/api-ref/).
* Do integration tests have assertions of module's return values?
* Does `RETURN` documentation and assertions in integration tests match?
* Does `RETURN` documentation and `self.exit_json()` statements match?
* Do all modules use `to_dict(computed=False)` before returning values?
* Because `id` is already part of most resource dictionaries returned from modules, we can safely drop dedicated `id`
attributes in `self.exit_json()` calls. We will not loose data and we break backward compatibility anyway.
* Is `EXAMPLES` documentation up to date?
When module arguments have been changed, examples have to be updated as well.
* Do integration tests execute successfully in your local dev environment? \
Example:
```sh
ansible-playbook -vvv ci/run-collection.yml \
-e "sdk_version=1.0.0 cloud=devstack-admin cloud_alt=devstack-alt" \
--tags floating_ip_info
```
* Does a patch remove any functionality or break backwards compatibility? The author must give a good explanation for
both.
- One valid reason is that a functionality has never worked before.
- Not a valid reason for dropping functionality or backwards compatibility is that functions from openstacksdk's proxy
layer do not support the functionality from openstacksdk's cloud layer. [SDK's cloud layer is not going away](
https://meetings.opendev.org/irclogs/%23openstack-sdks/%23openstack-sdks.2022-04-27.log.html) and can be used for
functionality which openstacksdk's proxy layer does not support. For example, `list_*` functions from openstacksdk's
cloud layer such as `search_users()` allow to filter retrieved results with function parameter `filters`.
openstacksdk's proxy layer does not provide an equivalent and thus the use of `search_users()` is perfectly fine.
* Try to look at the patch from user perspective:
- Will users understand and approve the change(s)?
- Will the patch break their code?
**Note**: For operators / administrators, a stable and reliable and bug free API is more important than the number
of features.
- If a change breaks or changes the behavior of their code, will it be easy to spot the difference?

35
galaxy.yml Normal file
View File

@@ -0,0 +1,35 @@
namespace: openstack
name: cloud
readme: README.md
authors: Openstack
description: Openstack Ansible modules
license: GPL-3.0-or-later
tags:
- cloud
- openstack
dependencies: {}
repository: https://opendev.org/openstack/ansible-collections-openstack
documentation: https://docs.ansible.com/ansible/latest/collections/openstack/cloud/index.html
homepage: https://opendev.org/openstack/ansible-collections-openstack
issues: https://storyboard.openstack.org/#!/project/openstack/ansible-collections-openstack
build_ignore:
- "*.tar.gz"
- build_artifact
- ci
- galaxy.yml.in
- setup.cfg
- test-requirements*
- tests
- tools
- tox.ini
- .gitignore
- .gitreview
- .zuul.yaml
- .pytest_cache
- importer_result.json
- .tox
- .env
- .vscode
- ansible_collections_openstack.egg-info
- changelogs
version: 1.10.0

View File

@@ -8,17 +8,17 @@ tags:
- cloud
- openstack
dependencies: {}
repository: https://opendev.org/openstack/ansible-collections-openstack.git
documentation: https://docs.openstack.org/ansible-collections-openstack
homepage: https://opendev.org
issues: https://review.opendev.org/q/project:openstack/ansible-collections-openstack
repository: https://opendev.org/openstack/ansible-collections-openstack
documentation: https://docs.ansible.com/ansible/latest/collections/openstack/cloud/index.html
homepage: https://opendev.org/openstack/ansible-collections-openstack
issues: https://storyboard.openstack.org/#!/project/openstack/ansible-collections-openstack
build_ignore:
- "*.tar.gz"
- build_artifact
- ci
- galaxy.yml.in
- setup.cfg
- test-requirements.txt
- test-requirements*
- tests
- tools
- tox.ini
@@ -27,3 +27,8 @@ build_ignore:
- .zuul.yaml
- .pytest_cache
- importer_result.json
- .tox
- .env
- .vscode
- ansible_collections_openstack.egg-info
- changelogs

View File

@@ -1,269 +0,0 @@
openstack:
- auth
- baremetal_inspect
- baremetal_inspect
- baremetal_node
- baremetal_node
- baremetal_node_action
- baremetal_node_action
- catalog_endpoint
- catalog_service
- catalog_service
- coe_cluster
- coe_cluster_template
- compute_flavor
- compute_flavor
- compute_flavor
- compute_flavor_info
- compute_flavor_info
- config
- config
- dns_zone
- dns_zone
- endpoint
- endpoint
- federation_idp
- federation_idp
- federation_idp_info
- federation_idp_info
- federation_mapping
- federation_mapping
- federation_mapping_info
- federation_mapping_info
- floating_ip
- group_assignment
- group_assignment
- host_aggregate
- host_aggregate
- identity_domain
- identity_domain
- identity_domain_info
- identity_domain_info
- identity_group
- identity_group
- identity_group_info
- identity_group_info
- identity_role
- identity_role
- identity_user
- identity_user
- identity_user_info
- identity_user_info
- image
- image_info
- keypair
- keystone_federation_protocol
- keystone_federation_protocol_info
- lb_listener
- lb_listener
- lb_member
- lb_member
- lb_pool
- lb_pool
- loadbalancer
- network
- networks_info
- object
- port
- port_info
- project
- project_access
- project_info
- quota
- recordset
- role_assignment
- role_assignment
- router
- routers_info
- security_group
- security_group_rule
- server
- server_action
- server_group
- server_info
- server_metadata
- server_volume
- stack
- subnet
- subnets_info
- volume
- volume_snapshot
os:
- auth
- baremetal_inspect
- baremetal_inspect
- baremetal_node
- baremetal_node
- baremetal_node_action
- baremetal_node_action
- catalog_endpoint
- catalog_service
- catalog_service
- coe_cluster
- coe_cluster_template
- compute_flavor
- compute_flavor
- compute_flavor
- compute_flavor_info
- compute_flavor_info
- config
- config
- dns_zone
- dns_zone
- endpoint
- endpoint
- federation_idp
- federation_idp
- federation_idp_info
- federation_idp_info
- federation_mapping
- federation_mapping
- federation_mapping_info
- federation_mapping_info
- floating_ip
- group_assignment
- group_assignment
- host_aggregate
- host_aggregate
- identity_domain
- identity_domain
- identity_domain_info
- identity_domain_info
- identity_group
- identity_group
- identity_group_info
- identity_group_info
- identity_role
- identity_role
- identity_user
- identity_user
- identity_user_info
- identity_user_info
- image
- image_info
- keypair
- keystone_federation_protocol
- keystone_federation_protocol_info
- lb_listener
- lb_listener
- lb_member
- lb_member
- lb_pool
- lb_pool
- loadbalancer
- network
- networks_info
- object
- port
- port_info
- project
- project_access
- project_info
- quota
- recordset
- role_assignment
- role_assignment
- router
- routers_info
- security_group
- security_group_rule
- server
- server_action
- server_group
- server_info
- server_metadata
- server_volume
- stack
- subnet
- subnets_info
- volume
- volume_snapshot
- os_auth
- os_client_config
- os_client_config
- os_coe_cluster
- os_coe_cluster_template
- os_endpoint
- os_flavor
- os_flavor_info
- os_flavor_info
- os_floating_ip
- os_group
- os_group
- os_group_info
- os_group_info
- os_image
- os_image_info
- os_ironic
- os_ironic
- os_ironic_inspect
- os_ironic_inspect
- os_ironic_node
- os_ironic_node
- os_keypair
- os_keystone_domain
- os_keystone_domain
- os_keystone_domain_info
- os_keystone_domain_info
- os_keystone_endpoint
- os_keystone_endpoint
- os_keystone_federation_protocol
- os_keystone_federation_protocol_info
- os_keystone_identity_provider
- os_keystone_identity_provider
- os_keystone_identity_provider_info
- os_keystone_identity_provider_info
- os_keystone_mapping
- os_keystone_mapping
- os_keystone_mapping_info
- os_keystone_mapping_info
- os_keystone_role
- os_keystone_role
- os_keystone_service
- os_keystone_service
- os_listener
- os_listener
- os_loadbalancer
- os_member
- os_member
- os_network
- os_networks_info
- os_nova_flavor
- os_nova_flavor
- os_nova_host_aggregate
- os_nova_host_aggregate
- os_object
- os_pool
- os_pool
- os_port
- os_port_info
- os_project
- os_project_access
- os_project_info
- os_quota
- os_recordset
- os_router
- os_routers_info
- os_security_group
- os_security_group_rule
- os_server
- os_server_action
- os_server_group
- os_server_info
- os_server_metadata
- os_server_volume
- os_stack
- os_subnet
- os_subnets_info
- os_user
- os_user
- os_user_group
- os_user_group
- os_user_info
- os_user_info
- os_user_role
- os_user_role
- os_volume
- os_volume_snapshot
- os_zone
- os_zone

View File

@@ -1,317 +1,613 @@
requires_ansible: ">=2.8"
action_groups:
openstack:
- address_scope
- auth
- baremetal_inspect
- baremetal_inspect
- baremetal_node
- baremetal_node
- baremetal_node_action
- baremetal_node_action
- baremetal_node_info
- baremetal_port_info
- baremetal_port
- catalog_endpoint
- catalog_service
- catalog_service
- coe_cluster
- coe_cluster_template
- compute_flavor
- compute_flavor
- compute_flavor
- compute_flavor_info
- compute_flavor_info
- compute_service_info
- compute_service_info
- config
- config
- dns_zone
- dns_zone_info
- endpoint
- endpoint
- federation_idp
- federation_idp
- federation_idp_info
- federation_idp_info
- federation_mapping
- federation_mapping
- federation_mapping_info
- federation_mapping_info
- floating_ip
- floating_ip_info
- group_assignment
- group_assignment
- host_aggregate
- host_aggregate
- identity_domain
- identity_domain
- identity_domain_info
- identity_domain_info
- identity_group
- identity_group
- identity_group_info
- identity_group_info
- identity_role
- identity_role
- identity_user
- identity_user
- identity_user_info
- identity_user_info
- image
- image_info
- keypair
- keypair_info
- keystone_federation_protocol
- keystone_federation_protocol_info
- lb_listener
- lb_listener
- lb_member
- lb_member
- lb_pool
- lb_pool
- loadbalancer
- network
- networks_info
- object
- object_container
- port
- port_info
- project
- project_access
- project_info
- quota
- recordset
- role_assignment
- role_assignment
- router
- routers_info
- security_group
- security_group_info
- security_group_rule
- security_group_rule_info
- server
- server_action
- server_group
- server_info
- server_metadata
- server_volume
- stack
- subnet
- subnets_info
- subnet_pool
- volume
- volume_backup
- volume_backup_info
- volume_info
- volume_snapshot
- volume_snapshot_info
os:
- auth
- baremetal_inspect
- baremetal_inspect
- baremetal_node
- baremetal_node
- baremetal_node_action
- baremetal_node_action
- catalog_endpoint
- catalog_service
- catalog_service
- coe_cluster
- coe_cluster_template
- compute_flavor
- compute_flavor
- compute_flavor
- compute_flavor_info
- compute_flavor_info
- config
- config
- dns_zone
- dns_zone
- endpoint
- endpoint
- federation_idp
- federation_idp
- federation_idp_info
- federation_idp_info
- federation_mapping
- federation_mapping
- federation_mapping_info
- federation_mapping_info
- floating_ip
- group_assignment
- group_assignment
- host_aggregate
- host_aggregate
- identity_domain
- identity_domain
- identity_domain_info
- identity_domain_info
- identity_group
- identity_group
- identity_group_info
- identity_group_info
- identity_role
- identity_role
- identity_user
- identity_user
- identity_user_info
- identity_user_info
- image
- image_info
- keypair
- keypair_info
- keystone_federation_protocol
- keystone_federation_protocol_info
- lb_listener
- lb_listener
- lb_member
- lb_member
- lb_pool
- lb_pool
- loadbalancer
- network
- networks_info
- object
- object_container
- port
- port_info
- project
- project_access
- project_info
- quota
- recordset
- role_assignment
- role_assignment
- router
- routers_info
- security_group
- security_group_info
- security_group_rule
- security_group_rule_info
- server
- server_action
- server_group
- server_info
- server_metadata
- server_volume
- stack
- subnet
- subnets_info
- volume
- volume_backup
- volume_backup_info
- volume_info
- volume_snapshot
- volume_snapshot_info
- os_auth
- os_client_config
- os_client_config
- os_coe_cluster
- os_coe_cluster_template
- os_endpoint
- os_flavor
- os_flavor_info
- os_flavor_info
- os_floating_ip
- os_group
- os_group
- os_group_info
- os_group_info
- os_image
- os_image_info
- os_ironic
- os_ironic
- os_ironic_inspect
- os_ironic_inspect
- os_ironic_node
- os_ironic_node
- os_keypair
- os_keystone_domain
- os_keystone_domain
- os_keystone_domain_info
- os_keystone_domain_info
- os_keystone_endpoint
- os_keystone_endpoint
- os_keystone_federation_protocol
- os_keystone_federation_protocol_info
- os_keystone_identity_provider
- os_keystone_identity_provider
- os_keystone_identity_provider_info
- os_keystone_identity_provider_info
- os_keystone_mapping
- os_keystone_mapping
- os_keystone_mapping_info
- os_keystone_mapping_info
- os_keystone_role
- os_keystone_role
- os_keystone_service
- os_keystone_service
- os_listener
- os_listener
- os_loadbalancer
- os_member
- os_member
- os_network
- os_networks_info
- os_nova_flavor
- os_nova_flavor
- os_nova_host_aggregate
- os_nova_host_aggregate
- os_object
- os_pool
- os_pool
- os_port
- os_port_info
- os_project
- os_project_access
- os_project_info
- os_quota
- os_recordset
- os_router
- os_routers_info
- os_security_group
- os_security_group_rule
- os_server
- os_server_action
- os_server_group
- os_server_info
- os_server_metadata
- os_server_volume
- os_stack
- os_subnet
- os_subnets_info
- os_user
- os_user
- os_user_group
- os_user_group
- os_user_info
- os_user_info
- os_user_role
- os_user_role
- os_volume
- os_volume_snapshot
- os_zone
- os_zone
plugin_routing:
modules:
os_auth:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.auth
redirect: openstack.cloud.auth
os_client_config:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.config
redirect: openstack.cloud.config
os_coe_cluster:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.coe_cluster
redirect: openstack.cloud.coe_cluster
os_coe_cluster_template:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.coe_cluster_template
redirect: openstack.cloud.coe_cluster_template
os_endpoint:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.catalog_endpoint
redirect: openstack.cloud.catalog_endpoint
os_flavor:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.compute_flavor
redirect: openstack.cloud.compute_flavor
os_flavor_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.compute_flavor_info
redirect: openstack.cloud.compute_flavor_info
os_floating_ip:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.floating_ip
redirect: openstack.cloud.floating_ip
os_group:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.identity_group
redirect: openstack.cloud.identity_group
os_group_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.identity_group_info
redirect: openstack.cloud.identity_group_info
os_image:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.image
redirect: openstack.cloud.image
os_image_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.image_info
redirect: openstack.cloud.image_info
os_ironic:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.baremetal_node
redirect: openstack.cloud.baremetal_node
os_ironic_inspect:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.baremetal_inspect
redirect: openstack.cloud.baremetal_inspect
os_ironic_node:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.baremetal_node_action
redirect: openstack.cloud.baremetal_node_action
os_keypair:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.keypair
redirect: openstack.cloud.keypair
os_keystone_domain:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.identity_domain
redirect: openstack.cloud.identity_domain
os_keystone_domain_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.identity_domain_info
redirect: openstack.cloud.identity_domain_info
os_keystone_endpoint:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.endpoint
redirect: openstack.cloud.endpoint
os_keystone_federation_protocol:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.keystone_federation_protocol
redirect: openstack.cloud.keystone_federation_protocol
os_keystone_federation_protocol_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.keystone_federation_protocol_info
redirect: openstack.cloud.keystone_federation_protocol_info
os_keystone_identity_provider:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.federation_idp
redirect: openstack.cloud.federation_idp
os_keystone_identity_provider_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.federation_idp_info
redirect: openstack.cloud.federation_idp_info
os_keystone_mapping:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.federation_mapping
redirect: openstack.cloud.federation_mapping
os_keystone_mapping_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.federation_mapping_info
redirect: openstack.cloud.federation_mapping_info
os_keystone_role:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.identity_role
redirect: openstack.cloud.identity_role
os_keystone_service:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.catalog_service
redirect: openstack.cloud.catalog_service
os_listener:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.lb_listener
redirect: openstack.cloud.lb_listener
os_loadbalancer:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.loadbalancer
redirect: openstack.cloud.loadbalancer
os_member:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.lb_member
redirect: openstack.cloud.lb_member
os_network:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.network
redirect: openstack.cloud.network
os_networks_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.networks_info
redirect: openstack.cloud.networks_info
os_nova_flavor:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.compute_flavor
redirect: openstack.cloud.compute_flavor
os_nova_host_aggregate:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.host_aggregate
redirect: openstack.cloud.host_aggregate
os_object:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.object
redirect: openstack.cloud.object
os_pool:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.lb_pool
redirect: openstack.cloud.lb_pool
os_port:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.port
redirect: openstack.cloud.port
os_port_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.port_info
redirect: openstack.cloud.port_info
os_project:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.project
redirect: openstack.cloud.project
os_project_access:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.project_access
redirect: openstack.cloud.project_access
os_project_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.project_info
redirect: openstack.cloud.project_info
os_quota:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.quota
redirect: openstack.cloud.quota
os_recordset:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.recordset
redirect: openstack.cloud.recordset
os_router:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.router
redirect: openstack.cloud.router
os_routers_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.routers_info
redirect: openstack.cloud.routers_info
os_security_group:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.security_group
redirect: openstack.cloud.security_group
os_security_group_rule:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.security_group_rule
redirect: openstack.cloud.security_group_rule
os_server:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.server
redirect: openstack.cloud.server
os_server_action:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.server_action
redirect: openstack.cloud.server_action
os_server_group:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.server_group
redirect: openstack.cloud.server_group
os_server_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.server_info
redirect: openstack.cloud.server_info
os_server_metadata:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.server_metadata
redirect: openstack.cloud.server_metadata
os_server_volume:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.server_volume
redirect: openstack.cloud.server_volume
os_stack:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.stack
redirect: openstack.cloud.stack
os_subnet:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.subnet
redirect: openstack.cloud.subnet
os_subnets_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.subnets_info
redirect: openstack.cloud.subnets_info
os_user:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.identity_user
redirect: openstack.cloud.identity_user
os_user_group:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.group_assignment
redirect: openstack.cloud.group_assignment
os_user_info:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.identity_user_info
redirect: openstack.cloud.identity_user_info
os_user_role:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.role_assignment
redirect: openstack.cloud.role_assignment
os_volume:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.volume
redirect: openstack.cloud.volume
os_volume_snapshot:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.volume_snapshot
redirect: openstack.cloud.volume_snapshot
os_zone:
deprecation:
removal_date: TBD
removal_date: 2021-12-12
warning_text: os_ prefixed module names are deprecated, use openstack.cloud.dns_zone
redirect: openstack.cloud.dns_zone

View File

@@ -61,7 +61,6 @@ options:
- Whether or not SSL API requests should be verified.
- Before Ansible 2.3 this defaulted to C(yes).
type: bool
default: no
aliases: [ verify ]
ca_cert:
description:
@@ -90,9 +89,18 @@ options:
description:
- Ignored. Present for backwards compatibility
type: str
sdk_log_path:
description:
- Path to the logfile of the OpenStackSDK. If empty no log is written
type: str
sdk_log_level:
description: Log level of the OpenStackSDK
type: str
default: INFO
choices: [INFO, DEBUG]
requirements:
- python >= 3.6
- openstacksdk >= 0.12.0
- "python >= 3.6"
- "openstacksdk >= 0.36, < 0.99.0"
notes:
- The standard OpenStack environment variables, such as C(OS_USERNAME)
may be used instead of providing explicit values.

View File

@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2012, Marco Vito Moscaritolo <marco@agavee.com>
# Copyright (c) 2013, Jesse Keating <jesse.keating@rackspace.com>
# Copyright (c) 2015, Hewlett-Packard Development Company, L.P.
@@ -9,13 +10,8 @@
DOCUMENTATION = '''
---
name: openstack
plugin_type: inventory
author:
- "Marco Vito Moscaritolo <marco@agavee.com>"
- "Jesse Keating <jesse.keating@rackspace.com>"
author: OpenStack Ansible SIG
short_description: OpenStack inventory source
requirements:
- "openstacksdk >= 0.28"
description:
- Get inventory hosts from OpenStack clouds
- Uses openstack.(yml|yaml) YAML configuration file to configure the inventory plugin
@@ -24,11 +20,11 @@ options:
plugin:
description: token that ensures this is a source file for the 'openstack' plugin.
required: True
choices: ['openstack']
choices: ['openstack', 'openstack.cloud.openstack']
show_all:
description: toggles showing all vms vs only those with a working IP
type: bool
default: 'no'
default: false
inventory_hostname:
description: |
What to register as the inventory hostname.
@@ -44,6 +40,13 @@ options:
- name
- uuid
default: "name"
use_names:
description: |
Use the host's 'name' instead of 'interface_ip' for the 'ansible_host' and
'ansible_ssh_host' facts. This might be desired when using jump or
bastion hosts and the name is the FQDN of the host.
type: bool
default: false
expand_hostvars:
description: |
Run extra commands on each host to fill in additional
@@ -52,7 +55,7 @@ options:
(Note, the default value of this is opposite from the default
old openstack.py inventory script's option expand_hostvars)
type: bool
default: 'no'
default: false
private:
description: |
Use the private interface of each server, if it has one, as
@@ -60,12 +63,13 @@ options:
running ansible inside a server in the cloud and would rather
communicate to your servers over the private network.
type: bool
default: 'no'
default: false
only_clouds:
description: |
List of clouds from clouds.yaml to use, instead of using
the whole list.
type: list
elements: str
default: []
fail_on_errors:
description: |
@@ -76,12 +80,12 @@ options:
default value of this is opposite from the old openstack.py
inventory script's option fail_on_errors)
type: bool
default: 'no'
default: false
all_projects:
description: |
Lists servers from all projects
type: bool
default: 'no'
default: false
clouds_yaml_path:
description: |
Override path to clouds.yaml file. If this value is given it
@@ -90,6 +94,7 @@ options:
/etc/ansible/openstack.yml to the regular locations documented
at https://docs.openstack.org/os-client-config/latest/user/configuration.html#config-files
type: list
elements: str
env:
- name: OS_CLIENT_CONFIG_FILE
compose:
@@ -100,17 +105,22 @@ options:
description: Add hosts to group based on Jinja2 conditionals.
type: dictionary
default: {}
legacy_groups:
description: Automatically create groups from host variables.
type: bool
default: true
requirements:
- "python >= 3.6"
- "openstacksdk >= 0.36, < 0.99.0"
extends_documentation_fragment:
- inventory_cache
- constructed
'''
EXAMPLES = '''
# file must be named openstack.yaml or openstack.yml
# Make the plugin behave like the default behavior of the old script
plugin: openstack
plugin: openstack.cloud.openstack
expand_hostvars: yes
fail_on_errors: yes
all_projects: yes
@@ -118,9 +128,17 @@ all_projects: yes
import collections
import sys
import logging
from ansible.errors import AnsibleParserError
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
from ansible.utils.display import Display
from ansible_collections.openstack.cloud.plugins.module_utils.openstack import (
ensure_compatibility
)
display = Display()
os_logger = logging.getLogger("openstack")
try:
# Due to the name shadowing we should import other way
@@ -128,8 +146,10 @@ try:
sdk = importlib.import_module('openstack')
sdk_inventory = importlib.import_module('openstack.cloud.inventory')
client_config = importlib.import_module('openstack.config.loader')
sdk_exceptions = importlib.import_module("openstack.exceptions")
HAS_SDK = True
except ImportError:
display.vvvv("Couldn't import Openstack SDK modules")
HAS_SDK = False
@@ -150,19 +170,29 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
msg = ''
if not self._config_data:
msg = 'File empty. this is not my config file'
elif 'plugin' in self._config_data and self._config_data['plugin'] != self.NAME:
elif 'plugin' in self._config_data and self._config_data['plugin'] not in (self.NAME, 'openstack'):
msg = 'plugin config file, but not for us: %s' % self._config_data['plugin']
elif 'plugin' not in self._config_data and 'clouds' not in self._config_data:
msg = "it's not a plugin configuration nor a clouds.yaml file"
elif not HAS_SDK:
msg = "openstacksdk is required for the OpenStack inventory plugin. OpenStack inventory sources will be skipped."
if not msg:
try:
ensure_compatibility(sdk.version.__version__)
except ImportError as e:
msg = ("Incompatible openstacksdk library found: {error}."
.format(error=str(e)))
if msg:
display.vvvv(msg)
raise AnsibleParserError(msg)
# The user has pointed us at a clouds.yaml file. Use defaults for
# everything.
if 'clouds' in self._config_data:
self.display.vvvv(
"Found clouds config file instead of plugin config. "
"Using default configuration."
)
self._config_data = {}
# update cache if the user has caching enabled and the cache is being refreshed
@@ -173,13 +203,16 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
cache = self.get_option('cache')
source_data = None
if cache:
self.display.vvvv("Reading inventory data from cache: %s" % cache_key)
try:
source_data = self._cache[cache_key]
except KeyError:
# cache expired or doesn't exist yet
display.vvvv("Inventory data cache not found")
cache_needs_update = True
if not source_data:
self.display.vvvv("Getting hosts from Openstack clouds")
clouds_yaml_path = self._config_data.get('clouds_yaml_path')
if clouds_yaml_path:
config_files = (
@@ -192,11 +225,16 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
# Redict logging to stderr so it does not mix with output
# particular ansible-inventory JSON output
# TODO(mordred) Integrate openstack's logging with ansible's logging
sdk.enable_logging(stream=sys.stderr)
if self.display.verbosity > 3:
sdk.enable_logging(debug=True, stream=sys.stderr)
else:
sdk.enable_logging(stream=sys.stderr)
cloud_inventory = sdk_inventory.OpenStackInventory(
config_files=config_files,
private=self._config_data.get('private', False))
self.display.vvvv("Found %d cloud(s) in Openstack" %
len(cloud_inventory.clouds))
only_clouds = self._config_data.get('only_clouds', [])
if only_clouds and not isinstance(only_clouds, list):
raise ValueError(
@@ -205,20 +243,32 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
if only_clouds:
new_clouds = []
for cloud in cloud_inventory.clouds:
self.display.vvvv("Looking at cloud : %s" % cloud.name)
if cloud.name in only_clouds:
self.display.vvvv("Selecting cloud : %s" % cloud.name)
new_clouds.append(cloud)
cloud_inventory.clouds = new_clouds
self.display.vvvv("Selected %d cloud(s)" %
len(cloud_inventory.clouds))
expand_hostvars = self._config_data.get('expand_hostvars', False)
fail_on_errors = self._config_data.get('fail_on_errors', False)
all_projects = self._config_data.get('all_projects', False)
self.use_names = self._config_data.get('use_names', False)
source_data = cloud_inventory.list_hosts(
expand=expand_hostvars, fail_on_cloud_config=fail_on_errors,
all_projects=all_projects)
if cache_needs_update:
self._cache[cache_key] = source_data
source_data = []
try:
source_data = cloud_inventory.list_hosts(
expand=expand_hostvars, fail_on_cloud_config=fail_on_errors,
all_projects=all_projects)
except Exception as e:
self.display.warning("Couldn't list Openstack hosts. "
"See logs for details")
os_logger.error(e.message)
finally:
if cache_needs_update:
self._cache[cache_key] = source_data
self._populate_from_source(source_data)
@@ -280,7 +330,11 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
for group_name, group_hosts in groups.items():
gname = self.inventory.add_group(group_name)
for host in group_hosts:
self.inventory.add_child(gname, host)
if gname == host:
display.vvvv("Same name for host %s and group %s" % (host, gname))
self.inventory.add_host(host, gname)
else:
self.inventory.add_child(gname, host)
def _get_groups_from_server(self, server_vars, namegroup=True):
groups = []
@@ -328,14 +382,25 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
def _append_hostvars(self, hostvars, groups, current_host,
server, namegroup=False):
hostvars[current_host] = dict(
ansible_ssh_host=server['interface_ip'],
ansible_host=server['interface_ip'],
openstack=server)
if not self.use_names:
hostvars[current_host] = dict(
ansible_ssh_host=server['interface_ip'],
ansible_host=server['interface_ip'],
openstack=server,
)
if self.use_names:
hostvars[current_host] = dict(
ansible_ssh_host=server['name'],
ansible_host=server['name'],
openstack=server,
)
self.inventory.add_host(current_host)
for group in self._get_groups_from_server(server, namegroup=namegroup):
groups[group].append(current_host)
if self.get_option('legacy_groups'):
for group in self._get_groups_from_server(server, namegroup=namegroup):
groups[group].append(current_host)
def verify_file(self, path):
@@ -344,5 +409,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
for suffix in ('yaml', 'yml'):
maybe = '{fn}.{suffix}'.format(fn=fn, suffix=suffix)
if path.endswith(maybe):
self.display.vvvv("Valid plugin config file found")
return True
return False

View File

@@ -0,0 +1,68 @@
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete work.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.openstack.cloud.plugins.module_utils.openstack import openstack_full_argument_spec
def ironic_argument_spec(**kwargs):
spec = dict(
auth_type=dict(required=False),
ironic_url=dict(required=False),
)
spec.update(kwargs)
return openstack_full_argument_spec(**spec)
# TODO(dtantsur): inherit the collection's base module
class IronicModule(AnsibleModule):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._update_ironic_auth()
def _update_ironic_auth(self):
"""Validate and update authentication parameters for ironic."""
if (
self.params['auth_type'] in [None, 'None', 'none']
and self.params['ironic_url'] is None
and not self.params['cloud']
and not (self.params['auth']
and self.params['auth'].get('endpoint'))
):
self.fail_json(msg=("Authentication appears to be disabled, "
"Please define either ironic_url, or cloud, "
"or auth.endpoint"))
if (
self.params['ironic_url']
and self.params['auth_type'] in [None, 'None', 'none']
and not (self.params['auth']
and self.params['auth'].get('endpoint'))
):
self.params['auth'] = dict(
endpoint=self.params['ironic_url']
)

View File

@@ -28,13 +28,90 @@
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import abc
from distutils.version import StrictVersion
import copy
from ansible.module_utils.six import raise_from
try:
from ansible.module_utils.compat.version import StrictVersion
except ImportError:
try:
from distutils.version import StrictVersion
except ImportError as exc:
raise_from(ImportError('To use this plugin or module with ansible-core'
' < 2.11, you need to use Python < 3.12 with '
'distutils.version present'), exc)
import importlib
import os
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import iteritems
OVERRIDES = {'os_client_config': 'config',
'os_endpoint': 'catalog_endpoint',
'os_flavor': 'compute_flavor',
'os_flavor_info': 'compute_flavor_info',
'os_group': 'identity_group',
'os_group_info': 'identity_group_info',
'os_ironic': 'baremetal_node',
'os_ironic_inspect': 'baremetal_inspect',
'os_ironic_node': 'baremetal_node_action',
'os_keystone_domain': 'identity_domain',
'os_keystone_domain_info': 'identity_domain_info',
'os_keystone_endpoint': 'endpoint',
'os_keystone_identity_provider': 'federation_idp',
'os_keystone_identity_provider_info': 'federation_idp_info',
'os_keystone_mapping': 'federation_mapping',
'os_keystone_mapping_info': 'federation_mapping_info',
'os_keystone_role': 'identity_role',
'os_keystone_service': 'catalog_service',
'os_listener': 'lb_listener',
'os_member': 'lb_member',
'os_nova_flavor': 'compute_flavor',
'os_nova_host_aggregate': 'host_aggregate',
'os_pool': 'lb_pool',
'os_user': 'identity_user',
'os_user_group': 'group_assignment',
'os_user_info': 'identity_user_info',
'os_user_role': 'role_assignment',
'os_zone': 'dns_zone'}
CUSTOM_VAR_PARAMS = ['min_ver', 'max_ver']
MINIMUM_SDK_VERSION = '0.36.0'
MAXIMUM_SDK_VERSION = '0.98.999'
def ensure_compatibility(version, min_version=None, max_version=None):
""" Raises ImportError if the specified version does not
meet the minimum and maximum version requirements"""
if min_version and MINIMUM_SDK_VERSION:
min_version = max(StrictVersion(MINIMUM_SDK_VERSION),
StrictVersion(min_version))
elif MINIMUM_SDK_VERSION:
min_version = StrictVersion(MINIMUM_SDK_VERSION)
if max_version and MAXIMUM_SDK_VERSION:
max_version = min(StrictVersion(MAXIMUM_SDK_VERSION),
StrictVersion(max_version))
elif MAXIMUM_SDK_VERSION:
max_version = StrictVersion(MAXIMUM_SDK_VERSION)
if min_version and StrictVersion(version) < min_version:
raise ImportError(
"Version MUST be >={min_version} and <={max_version}, but"
" {version} is smaller than minimum version {min_version}"
.format(version=version,
min_version=min_version,
max_version=max_version))
if max_version and StrictVersion(version) > max_version:
raise ImportError(
"Version MUST be >={min_version} and <={max_version}, but"
" {version} is larger than maximum version {max_version}"
.format(version=version,
min_version=min_version,
max_version=max_version))
def openstack_argument_spec():
# DEPRECATED: This argument spec is only used for the deprecated old
@@ -96,8 +173,16 @@ def openstack_full_argument_spec(**kwargs):
interface=dict(
default='public', choices=['public', 'internal', 'admin'],
aliases=['endpoint_type']),
sdk_log_path=dict(default=None, type='str'),
sdk_log_level=dict(
default='INFO', type='str', choices=['INFO', 'DEBUG']),
)
spec.update(kwargs)
# Filter out all our custom parameters before passing to AnsibleModule
kwargs_copy = copy.deepcopy(kwargs)
for v in kwargs_copy.values():
for c in CUSTOM_VAR_PARAMS:
v.pop(c, None)
spec.update(kwargs_copy)
return spec
@@ -109,28 +194,24 @@ def openstack_module_kwargs(**kwargs):
ret[key].extend(kwargs[key])
else:
ret[key] = kwargs[key]
return ret
def openstack_cloud_from_module(module, min_version='0.12.0'):
# for compatibility with old versions
def openstack_cloud_from_module(module, min_version=None, max_version=None):
try:
# Due to the name shadowing we should import other way
sdk = importlib.import_module('openstack')
sdk_version = importlib.import_module('openstack.version')
except ImportError:
module.fail_json(msg='openstacksdk is required for this module')
if min_version:
min_version = max(StrictVersion('0.12.0'), StrictVersion(min_version))
else:
min_version = StrictVersion('0.12.0')
if StrictVersion(sdk_version.__version__) < min_version:
try:
ensure_compatibility(sdk.version.__version__,
min_version, max_version)
except ImportError as e:
module.fail_json(
msg="To utilize this module, the installed version of "
"the openstacksdk library MUST be >={min_version}.".format(
min_version=min_version))
msg="Incompatible openstacksdk library found: {error}."
.format(error=str(e)))
cloud_config = module.params.pop('cloud', None)
try:
@@ -166,25 +247,224 @@ def openstack_cloud_from_module(module, min_version='0.12.0'):
module.fail_json(msg=str(e))
class OpenStackModule(AnsibleModule):
class OpenStackModule:
"""Openstack Module is a base class for all Openstack Module classes.
The class has `run` function that should be overriden in child classes,
the provided methods include:
Methods:
params: Dictionary of Ansible module parameters.
module_name: Module name (i.e. server_action)
sdk_version: Version of used OpenstackSDK.
results: Dictionary for return of Ansible module,
must include `changed` keyword.
exit, exit_json: Exit module and return data inside, must include
changed` keyword in a data.
fail, fail_json: Exit module with failure, has `msg` keyword to
specify a reason of failure.
conn: Connection to SDK object.
log: Print message to system log.
debug: Print debug message to system log, prints if Ansible Debug is
enabled or verbosity is more than 2.
check_deprecated_names: Function that checks if module was called with
a deprecated name and prints the correct name
with deprecation warning.
check_versioned: helper function to check that all arguments are known
in the current SDK version.
run: method that executes and shall be overriden in inherited classes.
Args:
deprecated_names: Should specify deprecated modules names for current
module.
argument_spec: Used for construction of Openstack common arguments.
module_kwargs: Additional arguments for Ansible Module.
"""
deprecated_names = ()
argument_spec = {}
module_kwargs = {}
module_min_sdk_version = None
module_max_sdk_version = None
def __init__(self):
"""Initialize Openstack base class.
super(OpenStackModule, self).__init__(
Set up variables, connection to SDK and check if there are
deprecated names.
"""
self.ansible = AnsibleModule(
openstack_full_argument_spec(**self.argument_spec),
**self.module_kwargs)
self.params = self.ansible.params
self.module_name = self.ansible._name
self.check_mode = self.ansible.check_mode
self.sdk_version = None
self.results = {'changed': False}
self.exit = self.exit_json = self.ansible.exit_json
self.fail = self.fail_json = self.ansible.fail_json
self.warn = self.ansible.warn
self.sdk, self.conn = self.openstack_cloud_from_module()
self.check_deprecated_names()
self.setup_sdk_logging()
self.sdk, self.conn = openstack_cloud_from_module(self)
def log(self, msg):
"""Prints log message to system log.
Arguments:
msg {str} -- Log message
"""
self.ansible.log(msg)
def debug(self, msg):
"""Prints debug message to system log
Arguments:
msg {str} -- Debug message.
"""
if self.ansible._debug or self.ansible._verbosity > 2:
self.ansible.log(
" ".join(['[DEBUG]', msg]))
def setup_sdk_logging(self):
log_path = self.params.get('sdk_log_path')
if log_path is not None:
log_level = self.params.get('sdk_log_level')
self.sdk.enable_logging(
debug=True if log_level == 'DEBUG' else False,
http_debug=True if log_level == 'DEBUG' else False,
path=log_path
)
def check_deprecated_names(self):
"""Check deprecated module names if `deprecated_names` variable is set.
"""
new_module_name = OVERRIDES.get(self.module_name)
if self.module_name in self.deprecated_names and new_module_name:
self.ansible.deprecate(
"The '%s' module has been renamed to '%s' in openstack "
"collection: openstack.cloud.%s" % (
self.module_name, new_module_name, new_module_name),
version='2.0.0', collection_name='openstack.cloud')
def openstack_cloud_from_module(self):
"""Sets up connection to cloud using provided options. Checks if all
provided variables are supported for the used SDK version.
"""
try:
# Due to the name shadowing we should import other way
sdk = importlib.import_module('openstack')
self.sdk_version = sdk.version.__version__
except ImportError:
self.fail_json(msg='openstacksdk is required for this module')
try:
ensure_compatibility(self.sdk_version,
self.module_min_sdk_version,
self.module_max_sdk_version)
except ImportError as e:
self.fail_json(
msg="Incompatible openstacksdk library found: {error}."
.format(error=str(e)))
# Fail if there are set unsupported for this version parameters
# New parameters should NOT use 'default' but rely on SDK defaults
for param in self.argument_spec:
if (self.params[param] is not None
and 'min_ver' in self.argument_spec[param]
and StrictVersion(self.sdk_version) < self.argument_spec[param]['min_ver']):
self.fail_json(
msg="To use parameter '{param}' with module '{module}', the installed version of "
"the openstacksdk library MUST be >={min_version}.".format(
min_version=self.argument_spec[param]['min_ver'],
param=param,
module=self.module_name))
if (self.params[param] is not None
and 'max_ver' in self.argument_spec[param]
and StrictVersion(self.sdk_version) > self.argument_spec[param]['max_ver']):
self.fail_json(
msg="To use parameter '{param}' with module '{module}', the installed version of "
"the openstacksdk library MUST be <={max_version}.".format(
max_version=self.argument_spec[param]['max_ver'],
param=param,
module=self.module_name))
cloud_config = self.params.pop('cloud', None)
if isinstance(cloud_config, dict):
fail_message = (
"A cloud config dict was provided to the cloud parameter"
" but also a value was provided for {param}. If a cloud"
" config dict is provided, {param} should be"
" excluded.")
for param in (
'auth', 'region_name', 'validate_certs',
'ca_cert', 'client_key', 'api_timeout', 'auth_type'):
if self.params[param] is not None:
self.fail_json(msg=fail_message.format(param=param))
# For 'interface' parameter, fail if we receive a non-default value
if self.params['interface'] != 'public':
self.fail_json(msg=fail_message.format(param='interface'))
else:
cloud_config = dict(
cloud=cloud_config,
auth_type=self.params['auth_type'],
auth=self.params['auth'],
region_name=self.params['region_name'],
verify=self.params['validate_certs'],
cacert=self.params['ca_cert'],
key=self.params['client_key'],
api_timeout=self.params['api_timeout'],
interface=self.params['interface'],
)
try:
return sdk, sdk.connect(**cloud_config)
except sdk.exceptions.SDKException as e:
# Probably a cloud configuration/login error
self.fail_json(msg=str(e))
# Filter out all arguments that are not from current SDK version
def check_versioned(self, **kwargs):
"""Check that provided arguments are supported by current SDK version
Returns:
versioned_result {dict} dictionary of only arguments that are
supported by current SDK version. All others
are dropped.
"""
versioned_result = {}
for var_name in kwargs:
if ('min_ver' in self.argument_spec[var_name]
and StrictVersion(self.sdk_version) < self.argument_spec[var_name]['min_ver']):
continue
if ('max_ver' in self.argument_spec[var_name]
and StrictVersion(self.sdk_version) > self.argument_spec[var_name]['max_ver']):
continue
versioned_result.update({var_name: kwargs[var_name]})
return versioned_result
@abc.abstractmethod
def run(self):
"""Function for overriding in inhetired classes, it's executed by default.
"""
pass
def __call__(self):
"""Execute `run` function when calling the class.
"""
try:
self.run()
results = self.run()
if results and isinstance(results, dict):
self.ansible.exit_json(**results)
except self.sdk.exceptions.OpenStackCloudException as e:
self.fail_json(msg=str(e), extra_data=e.extra_data)
params = {
'msg': str(e),
'extra_data': {
'data': getattr(e, 'extra_data', 'None'),
'details': getattr(e, 'details', 'None'),
'response': getattr(getattr(e, 'response', ''),
'text', 'None')
}
}
self.ansible.fail_json(**params)
# if we got to this place, modules didn't exit
self.ansible.exit_json(**self.results)

View File

@@ -0,0 +1,197 @@
#!/usr/bin/python
# coding: utf-8 -*-
#
# Copyright (c) 2021 by Uemit Seren <uemit.seren@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = '''
---
module: address_scope
short_description: Create or delete address scopes from OpenStack
author: OpenStack Ansible SIG
description:
- Create or Delete address scopes from OpenStack.
options:
state:
description:
- Indicate desired state of the resource
choices: ['present', 'absent']
default: present
type: str
name:
description:
- Name to be give to the address scope
required: true
type: str
project:
description:
- Unique name or ID of the project.
type: str
ip_version:
description:
- The IP version of the subnet 4 or 6
default: '4'
type: str
choices: ['4', '6']
shared:
description:
- Whether this address scope is shared or not.
type: bool
default: 'no'
extra_specs:
description:
- Dictionary with extra key/value pairs passed to the API
required: false
default: {}
type: dict
extends_documentation_fragment:
- openstack.cloud.openstack
'''
EXAMPLES = '''
# Create an IPv4 address scope.
- openstack.cloud.address_scope:
cloud: mycloud
state: present
name: my_adress_scope
# Create a shared IPv6 address scope for a given project.
- openstack.cloud.address_scope:
cloud: mycloud
state: present
ip_version: 6
name: ipv6_address_scope
project: myproj
# Delete address scope.
- openstack.cloud.address_scope:
cloud: mycloud
state: absent
name: my_adress_scope
'''
RETURN = '''
address_scope:
description: Dictionary describing the address scope.
returned: On success when I(state) is 'present'
type: complex
contains:
id:
description: Address Scope ID.
type: str
sample: "474acfe5-be34-494c-b339-50f06aa143e4"
name:
description: Address Scope name.
type: str
sample: "my_address_scope"
tenant_id:
description: The tenant ID.
type: str
sample: "861174b82b43463c9edc5202aadc60ef"
ip_version:
description: The IP version of the subnet 4 or 6.
type: str
sample: "4"
is_shared:
description: Indicates whether this address scope is shared across all tenants.
type: bool
sample: false
'''
from ansible_collections.openstack.cloud.plugins.module_utils.openstack import OpenStackModule
class AddressScopeModule(OpenStackModule):
argument_spec = dict(
state=dict(default='present', choices=['absent', 'present']),
name=dict(required=True),
shared=dict(default=False, type='bool'),
ip_version=dict(type='str', default='4', choices=['4', '6']),
project=dict(default=None),
extra_specs=dict(type='dict', default=dict())
)
def _needs_update(self, address_scope, filters=None):
"""Decide if the given address_scope needs an update.
"""
ip_version = int(self.params['ip_version'])
if address_scope['is_shared'] != self.params['shared']:
return True
if ip_version and address_scope['ip_version'] != ip_version:
self.fail_json(msg='Cannot update ip_version in existing address scope')
return False
def _system_state_change(self, address_scope, filters=None):
"""Check if the system state would be changed."""
state = self.params['state']
if state == 'absent' and address_scope:
return True
if state == 'present':
if not address_scope:
return True
return self._needs_update(address_scope, filters)
return False
def run(self):
state = self.params['state']
name = self.params['name']
shared = self.params['shared']
ip_version = self.params['ip_version']
project = self.params['project']
extra_specs = self.params['extra_specs']
if project is not None:
proj = self.conn.get_project(project)
if proj is None:
self.fail(msg='Project %s could not be found' % project)
project_id = proj['id']
else:
project_id = self.conn.current_project_id
address_scope = self.conn.network.find_address_scope(name_or_id=name)
if self.ansible.check_mode:
self.exit_json(
changed=self._system_state_change(address_scope)
)
if state == 'present':
changed = False
if not address_scope:
kwargs = dict(
name=name,
ip_version=ip_version,
is_shared=shared,
tenant_id=project_id)
dup_args = set(kwargs.keys()) & set(extra_specs.keys())
if dup_args:
raise ValueError('Duplicate key(s) {0} in extra_specs'
.format(list(dup_args)))
kwargs = dict(kwargs, **extra_specs)
address_scope = self.conn.network.create_address_scope(**kwargs)
changed = True
else:
if self._needs_update(address_scope):
address_scope = self.conn.network.update_address_scope(address_scope['id'], is_shared=shared)
changed = True
else:
changed = False
self.exit_json(changed=changed, address_scope=address_scope, id=address_scope['id'])
elif state == 'absent':
if not address_scope:
self.exit(changed=False)
else:
self.conn.network.delete_address_scope(address_scope['id'])
self.exit_json(changed=True)
def main():
module = AddressScopeModule()
module()
if __name__ == '__main__':
main()

View File

@@ -7,12 +7,9 @@ DOCUMENTATION = '''
---
module: auth
short_description: Retrieve an auth token
author: "Monty Taylor (@emonty)"
author: OpenStack Ansible SIG
description:
- Retrieve an auth token from an OpenStack Cloud
requirements:
- "python >= 3.6"
- "openstacksdk"
extends_documentation_fragment:
- openstack.cloud.openstack
'''
@@ -38,29 +35,24 @@ service_catalog:
type: dict
'''
import traceback
from ansible_collections.openstack.cloud.plugins.module_utils.openstack import OpenStackModule
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.openstack.cloud.plugins.module_utils.openstack import (openstack_full_argument_spec,
openstack_module_kwargs,
openstack_cloud_from_module)
class AuthModule(OpenStackModule):
argument_spec = dict()
module_kwargs = dict()
def run(self):
self.exit_json(
changed=False,
ansible_facts=dict(
auth_token=self.conn.auth_token,
service_catalog=self.conn.service_catalog))
def main():
argument_spec = openstack_full_argument_spec()
module_kwargs = openstack_module_kwargs()
module = AnsibleModule(argument_spec, **module_kwargs)
sdk, cloud = openstack_cloud_from_module(module)
try:
module.exit_json(
changed=False,
ansible_facts=dict(
auth_token=cloud.auth_token,
service_catalog=cloud.service_catalog))
except Exception as e:
module.fail_json(msg=str(e), exception=traceback.format_exc())
module = AuthModule()
module()
if __name__ == '__main__':

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