331 Commits

Author SHA1 Message Date
Sagi Shnaidman
20a27c461d Remove secret from experimental branch
Change-Id: I521069b356a14839720de954959a35b49fa59117
2024-12-17 13:01:13 +02:00
gtema
fff978d273 Prepare release 2.2.0
Prepare data for the v2.2.0 release with few new modules and bugfixes.

Change-Id: Id593b623b389cedb140fb05e8063f48ef7eacc36
2023-12-01 17:29:42 +01:00
Zuul
9fb544d94a Merge "Fix port_security_enabled key for port module" 2023-10-17 09:28:52 +00:00
Simon Hensel
94ed95c8b6 Fix port_security_enabled key for port module
Changes to the port_security_enabled parameter are not applied due to
mismatching key names.
In the port module, the input parameter is called `port_security_enabled`,
while the OpenStackSDK is using a field called `is_port_security_enabled`.

When updating an existing port, the port module is comparing the dictionary
keys of the Ansible module parameters with those of the port object
returned by the OpenStackSDK.
Since these keys different, they will not match and changes to
port security are not applied.

Story: 2010687
Task: 47789
Change-Id: I838e9d6ebf1a281269add91724eac240abe35fd4
2023-10-17 08:56:21 +02:00
Zuul
4ab054790c Merge "Prevent routers to be always updated if no shared public network" 2023-10-16 15:31:30 +00:00
Zuul
2c68080758 Merge "Added module for volume type encription" 2023-10-16 14:42:15 +00:00
Zuul
6e680d594b Merge "Add volume_type related plugins/modules" 2023-10-16 14:29:57 +00:00
Dmitriy Rabotyagov
b25e93dbdd Prevent routers to be always updated if no shared public network
Current logic assumes that external_fixed_ips should be always defined,
otherwise `req_fip_map` is an empty sequence, which makes _needs_update
to return True.
With that not having external_fixed_ips is a vaild case whenever
deployment does not have shared public network. This usually
the case when public network is not passed to computes and public
network is used only for routers and floating IPs.

Patch changes logic by addind a `is not None` support to only compare
external_fip configration when user explicitly passed something (passing
an empty dict is equal to requesting "empty" configuration).

Co-Authored-by: Artem Goncharov
Change-Id: Id0f69fe4c985c4c38b493577250cad4e589b9d24
2023-10-16 12:04:50 +02:00
Will Szumski
0aedc268f1 Adds stateful parameter to security groups
This is a missing option.

Change-Id: Ic7b43093d9c35de8962978e9ee108cf7b5379fcd
2023-09-01 17:53:32 +00:00
Dmitriy Rabotyagov
9b47cb4b59 Fix usage of subnet_id key for router
At the moment `subnet` is an alias of `subnet_id`. The way, how aliases
work in ansible modules, is that ansible does add intended key to param
in case alias is used. When riginal key is used, aliases are not
populated.

Right now in case user define `subnet_id` instead of its alias `subnet`
module will fail with KeyError.

Change-Id: I5ce547352097ea821be4c9bbc18147575986c740
2023-09-01 07:23:05 +00:00
Zuul
8612171af3 Merge "Image filters should be dict not set" 2023-08-28 11:04:30 +00:00
arddennis
8f321eaeb2 Added module for volume type encription
New module to manipulate volume type encryption. Including simple CI
task to verify functionality.

Change-Id: I7380a5d258c3df1f9bd512aa4295868294391e31
2023-08-21 08:43:23 +02:00
Denys Mishchenko
147ad6c452 Add volume_type related plugins/modules
Added 2 new modules to manipulate volume types in OpenStack
* volume_type is used to create, delete and modify volume type
* volume_type_info is used to show volume_type details, including
  encryption information

ci tests extended with additional role to test basic module behaviour

It is currently impossible to update is_public volume type attribute
as it is being changed to "os-volume-type-access:is_public" which is not
expected by api. Which expects just "is_public"
https://docs.openstack.org/api-ref/block-storage/v3/?expanded=update-a-volume-type-detail#update-a-volume-type
Which results in "'os-volume-type-access:is_public' was unexpected"
reply. I guess the change is required by openstacksdk or on the API side

Change-Id: Idc26a5240b5f3314c8384c7326d8a82dcc8c6171
2023-08-16 16:35:51 +02:00
Dmitriy Rabotyagov
407369da6e Fix linters for mocking
Right now linters test fail due to a trivial issue in mock loader.
This aims to fix CI for the repo.

Change-Id: Ib58e70d3a54b75ca4cb9ad86b761db1ded157143
2023-08-15 20:16:31 +02:00
Dmitriy Rabotyagov
0a371445eb Image filters should be dict not set
At the moment we generate a set as a filter for image checksums which
lead to AttributeError in SDK:
'set' object has no attribute 'keys'

With that we ensure that supllying checksum does not cause
module crash.

Change-Id: I490f51950592f62c9ad81806593340779bf6dbdb
2023-07-25 12:49:28 +02:00
Joker 234
2808d1c155 fix(inventory): bug when using clouds_yaml_path
Before this fix the current implementation in combination with the most
recent openstacksdk (1.2.0) resulted in a list containing the default
values and another list inside this list containing the value of
clouds_yaml_path. The clouds_yaml_path value gets now added directly to
the list only if it was set.

Change-Id: I3c3b6f59393928d098e9b80c55b87fc6ee1e9912
2023-06-01 19:41:20 +02:00
Jakob Meng
c30e4db77c Publish 2.1.0 release
Change-Id: I142f14dd35720557539b9cf3489a3c12c31f342a
2023-04-18 08:46:14 +02:00
Jakob Meng
ab6f2e45c6 Change security group rules only when instructed to do so
Security group rules in module openstack.cloud.security_group
are changed/updated only when option 'security_group_rules' was
defined explicitly. This follows our policy of "apply no change"
when module options in our Ansible modules have not been set.

Story: 2010691
Task: 47795
Change-Id: I4a0cda46cb160b5321913b63ff1123d8b8a19705
2023-04-18 08:39:57 +02:00
Zuul
568adcb890 Merge "Add baremetal_deploy_template module" 2023-04-17 23:37:52 +00:00
Jakob Meng
18cf839db4 Highlight our mode of operation more prominently
Change-Id: I23d9f390ffbe2c67ebca4e114c9d417a8bd2065e
2023-03-30 10:02:46 +02:00
Mark Goddard
454a05452b Add baremetal_deploy_template module
This module supports managing deploy template resources in OpenStack
Ironic.

https: //docs.openstack.org/ironic/latest/admin/node-deployment.html#deploy-templates

Change-Id: I2d1b89e7cbd1a7e847f54ffd62778f953ba65863
2023-03-28 12:05:38 +00:00
Dmitriy Rabotyagov
ad9594dcd7 Fix mistake in compute_flavor_access notes
In order to execute addTenantAccess or removeTenantAccess
a flavor should have have is_public set to false, which means it must
be private.

Change-Id: Iea1c4e7167b7134a4f70a4fb44fc0a8676265419
2023-03-14 18:43:35 +01:00
Jakob Meng
62c0169e64 Fixed private option in inventory plugin
Story: 2010614
Task: 47538
Change-Id: I64e1b3ce5323ca8e351ee9faef4bddbef53dfd5d
2023-03-06 21:07:23 +01:00
Christian Kueppers
497f020100 Fix for AttributeError: 'dict' object has no attribute 'status'.
Story: 2010610
Task: 47505
Change-Id: I9e138d8f282de9adfb3d7e1142c10ab77c22578e
2023-03-05 09:41:42 +00:00
Jakob Meng
92c3e87467 Respect description option and delete security group rules first
The description option of security group rules will now be used properly
when creating new rules.

Security group rules have to be deleted first before new ones get
created, because if one changes one rule attribute such as its
description, then the old rule must be deleted before recreating it,
as rules cannot be updated.

Story: 2010605
Task: 47486

Change-Id: I75b900e6675f7ec33532089738a6c2bfc10a898b
2023-02-23 21:20:51 +01:00
Jakob Meng
f73a0e385e Use true and false instead of yes and no for boolean values
Story: 2010586
Task: 47380
Change-Id: I1b88aa925d823d74b2d012153dfe26d35c93dfd5
2023-02-21 13:07:29 +01:00
Jakob Meng
b6b5f63877 Do not hardcode image name and properly delete mock images in CI tests
Change-Id: I2962dd1d1c27989cbd135b051cfb3e9f8c9e3823
2023-02-21 13:06:44 +01:00
Sagi Shnaidman
edd4e1b2e9 Fix issue with multiple records in recordset
Story: #2010527
Task: #47136

Sort records in recordset so it can be compared to existing ones
and not to trigger update in case of a different order.

Change-Id: Ib5d2af56616532174c29ec2be86827ccd0a17940
2023-02-01 21:26:26 +02:00
Jakob Meng
01e1742acf Publish 2.0.0 release
Change-Id: I523c933d57a9ff7fe8d670435dc86fd70a55a975
2023-01-31 19:52:32 +01:00
Jakob Meng
5b77519b89 Refactored coe_cluster{,_template} modules again
Change-Id: If9e28cf236db9a617657f177c0a7176eabc752ea
2023-01-31 19:52:19 +01:00
Jakob Meng
19d1d41ee0 Bump minimum required openstacksdk release to 1.0.0
openstacksdk's first major release brings new features and bug fixes,
e.g. for Magnum clusters and cluster templates [1], [2], [3].

[1] https://review.opendev.org/c/openstack/openstacksdk/+/865267
[2] https://review.opendev.org/c/openstack/openstacksdk/+/871648
[3] https://review.opendev.org/c/openstack/openstacksdk/+/871987

Change-Id: Ic7aa998ac5fa5c05dbea188a4d3b76ea774ff797
2023-01-31 19:52:01 +01:00
Jakob Meng
f758dfa626 Added workaround for non-determinism in ansible-inventory output
YAML output of ansible-inventory does not guarantee which group will
actually populate hosts with all their host vars.

Change-Id: Ia7d46898b8e91bafff05873be2b3c92bc85d83d2
2023-01-31 19:49:35 +01:00
Jakob Meng
34017d511b Dropped unmaintained, obsolete and broken inventory script
This removes the old inventory script only. For a proper replacement,
please use inventory plugin openstack.cloud.openstack.

Change-Id: Ib677862c049b70f39630d56a147bd5537b12fb2b
2023-01-28 14:18:08 +01:00
Jakob Meng
70c029fa50 Refactored inventory script
Change-Id: I78dbee41071bbfa8040ee13d662c1ba0fbdc10a5
2023-01-28 14:17:40 +01:00
Jakob Meng
d5ab2bf33f Refactored {group,role}_assignment modules
Change-Id: I6ec79eb203d0f68661b54bc89a194c366b3574c6
2023-01-26 13:36:30 +01:00
Jakob Meng
754ae5e50d Sorted Ansible roles with ci integration tests
Change-Id: I95e0bcc2715493a5a3d27411957faf53b2394d52
2023-01-26 13:36:17 +01:00
Jakob Meng
546f24940f Refactored tests for keystone_federation_protocol{,_info} modules
Change-Id: I9665f04e6c0d5a84d6c20a73ef7b0dfdc7bd8159
2023-01-26 13:36:03 +01:00
Jakob Meng
f507465c9e Pivoted docs to generic resource{,s} modules and StateMachine class
Change-Id: Iebcd45d0eae79ab3911fd97c63d17b42d238f875
2023-01-26 13:35:45 +01:00
Jakob Meng
90b110794f Refactored federation_idp{,_info} modules
Change-Id: Icbff6c799a9c33f1104633f7d9521f02228217a5
2023-01-26 13:35:27 +01:00
Jakob Meng
c9afdbfd73 Refactored identity_user{,_info} modules
Change-Id: Iae52d1a86f8f78790290be3966681f2277b9701d
2023-01-26 13:35:09 +01:00
Jakob Meng
4a27306440 Refactored identity_role{,_info} modules
Change-Id: If8230eb8b41b5461e1eaa470569030e8a888015b
2023-01-26 13:34:53 +01:00
Jakob Meng
8534990840 Refactored identity_group{,_info} modules
Change-Id: I72dce1278a7623d4f68cabcceafcdfefda900195
2023-01-26 13:34:33 +01:00
Jakob Meng
16a8a9e5d4 Refactored identity_domain{,_info} modules
Change-Id: Idf48f10e66a5651fa4693774eecd2c8683703082
2023-01-26 13:34:06 +01:00
Jakob Meng
a4a6e6d4ec Added resource{,s} modules
Change-Id: I0b04d43d5095ee74ec5af27013b6159a6a4d0f13
2023-01-26 09:34:30 +01:00
Rafael Castillo
778cf14f1b Refactored server_action module
Co-Authored-By: Jakob Meng <code@jakobmeng.de>
Change-Id: Ib9b7e26889123443a67b35e094deb3cadeb615fe
2023-01-19 08:54:40 +01:00
Jakob Meng
1b38b7c500 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: I727ed95ee480bb644b5a533f6a9526973677064c
2023-01-16 13:51:01 +01:00
Jakob Meng
a46bbd0d48 Warn about issues with (de)attaching floating ip addresses to/from servers
Change-Id: I6d3349537ad836385fc415d51009fb868b6279e0
2023-01-16 13:35:48 +01:00
Jakob Meng
39ffebea4c Removed TripleO related Zuul CI jobs
TripleO jobs are no longer relevant for upcoming
releases of Ansible OpenStack collection.

Change-Id: I1d4faa295d3e146514c33a6307d205aaf0e0ba4b
2023-01-15 19:38:05 +01:00
Jakob Meng
cc9ca5a34b Refactored image{,_info} modules
Code of the image module has been refactored partially only.
It will have to be completed in a follow up patch.

Change-Id: Id2360163117db9639a0af502ab44e02cae5cebaa
2023-01-14 09:12:21 +01:00
Jakob Meng
1f8c9fee05 Fixed ci integration tests for server actions
Change-Id: I151510cb0e914c33a86d2eb9d205c389bbe2acba
2023-01-13 21:00:59 +01:00
Jakob Meng
0c75f19e4c Refactored compute_flavor_info module
Change-Id: Ic598a60c2dd6fb465965fa8beee0ea973385bbcf
2023-01-13 20:59:59 +01:00
Jakob Meng
e34f259566 Added support for 'any' protocol in security group rules
Story: 2007849
Task: 40143

Story: 2008064
Task: 40747
Change-Id: I1e2f6dde4c7a17b6c5c9fcffad1b5748a1d44a15
2023-01-13 20:55:05 +01:00
Jakob Meng
5aaa41c9c4 Inlined network_external variable
Change-Id: I4cbbd84eaed99dae40c72fbdf567b480a1f268a4
2023-01-12 13:49:43 +01:00
Jakob Meng
eaa26c6b9c Refactored project{,_info} modules
Change-Id: I863d08c42b4c708444b74e3d47f0ca70a8ff94fd
2023-01-11 07:39:17 +01:00
Jakob Meng
0071fdcd97 Refactored compute_service_info module
Change-Id: I1773b72f8c7eaec77f0480045c45073dc522c5cf
2023-01-11 07:38:57 +01:00
Balazs Pokoradi
124e174d27 Added parameter for managing rules in security_group module
Co-Authored-By: Jakob Meng <code@jakobmeng.de>

Change-Id: I571955e8f4023293cce325604de5f1689b855416
2023-01-11 07:38:05 +01:00
Jakob Meng
4dc6c421db Refactored security_group_rule{,_info} modules
Change-Id: Ie953bee843a43b945d24d6152766b3ae418f797c
2023-01-11 07:37:18 +01:00
Jakob Meng
4cf6842222 Refactored security_group{,_info} modules
Change-Id: I8ae38c038e24ae53704224adb614b98e2e56a271
2023-01-11 07:36:59 +01:00
Jakob Meng
647ffef375 Refactored coe_cluster{,_template} modules
Change-Id: I209b242b43d8b79740752cd2c405705d247326c4
2023-01-10 16:16:28 +01:00
Jakob Meng
97c4531d15 Refactored lb_{health_monitor,listener,member,pool} modules
Change-Id: Iffd6ffb08aae4cbd84e4cade79993d82e8c2b2de
2023-01-10 16:16:03 +01:00
Jakob Meng
407b50c8b2 Refactored loadbalancer module breaking backward compatibility
Module option 'listeners' has been removed because it shares
functionality and a huge amount of code with
lb_{listener,member,pool} modules.

Co-Authored-By: Rafael Castillo <rcastill@redhat.com>

Change-Id: I839365bd3485859a2351b0124eae9d09a9d0b31a
2023-01-10 16:15:45 +01:00
Jakob Meng
122afc170c Fixed docs
Change-Id: I33953e9293a2ef2715bfcf076a262c474da40dc3
2023-01-10 15:20:07 +01:00
Polina-Gubina
52e7bfe7a4 Added is_multiattach parameter to volume module
Change-Id: Ieb98d78d730ee51480c78053152da265481c11f1
2023-01-10 13:33:53 +01:00
Jakob Meng
7d9de2858a Updated docs
Co-Authored-By: Sagi Shnaidman <sshnaidm@redhat.com>

Change-Id: Ib94adb1c6d6237800db13b3cc243e0897aa6a49f
2023-01-10 13:16:01 +01:00
Arnaud Morin
852d971d50 Add reboot and reboot_hard actions on server
Reboot actions (both SOFT and HARD) were missing in ansible actions.
Reboot is different than stop and start, because reboot (HARD) is asking
openstack nova to recreate the libvirt XML, which is sometimes needed.

Signed-off-by: Arnaud Morin <arnaud.morin@ovhcloud.com>
Change-Id: I43a42010e7474f47020c8df2839f8584157c97a4
2023-01-10 08:16:19 +00:00
Jakob Meng
3b0ae6c43f Use Neutron instead of Nova when detaching floating ips if available
Nova's API for detaching floating ips is deprecated and will fail
with a 404 starting from microversion 2.44. It has been replaced with
Neutron networking service API [0].

Previously, this did not cause issues because openstacksdk was not
passing a microversion for server actions, but this has been fixed
in [1].

[0] https://docs.openstack.org/api-ref/compute/#remove-disassociate-floating-ip-removefloatingip-action-deprecated
[1] https://review.opendev.org/c/openstack/openstacksdk/+/867890

Change-Id: Idad68d12f4ee163480877418caa93146ea873237
2023-01-05 09:14:20 +01:00
Jakob Meng
7945d7f01a 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
2022-12-30 10:38:58 +01:00
Jakob Meng
85fa2bb2b6 Moved Octavia image upload and CirrOS image identification to Ansible
Change-Id: Ief843310ce57a2d1062d86c54cd7ad6e0f705b68
2022-12-10 14:25:08 +01:00
Jakob Meng
133af96666 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
2022-12-10 14:24:27 +01:00
Robin Koch
51f1fea8b3 Added tests for router interface creation in a shared network
Story: 2010012

Change-Id: Ifa6a7e5a799a5bdfb3bbf585436e57cc6eea0811
2022-12-10 13:21:25 +01:00
Jakob Meng
94c150b2e7 Allow all external commands in tox
Change-Id: I76e0fc0e574d791e8f4d83ccc22289fa06360709
2022-12-10 11:48:48 +01:00
Samuel Kunkel
6b911ebd21 Allow setting flavor description
This will, like all other options changes, recreate the flavor. This
matches the workflow allowed by the openstacksdk (if description is
not set, it defaults to None).

Change-Id: I3d46a3f527f0632f42f6796c0a2701addebde640
2022-11-30 10:55:01 +01:00
Jakob Meng
cec58d7560 Bump minimum required openstacksdk release to 0.103.0
Latest release candidate 0.103.0 of openstacksdk's first major release
brings new features and bug fixes, e.g. for floating ips [1],
servers [2] and flavors [3].

[1] https://review.opendev.org/c/openstack/openstacksdk/+/850115
[2] https://review.opendev.org/c/openstack/openstacksdk/+/857987
[3] https://review.opendev.org/c/openstack/openstacksdk/+/864554

Change-Id: Ib96cbc0522fcb0d7c10a11c98172184f60b4407d
2022-11-30 10:54:40 +01:00
Jakob Meng
0e07b15f92 Refactored dns_zone{,_info} modules
Change-Id: I030cc0566ae94edf340d33e1e00c20403acabb2d
2022-11-30 10:54:17 +01:00
Jakob Meng
7c536e69b3 Refactored object{,_container} modules breaking backward compatibility
Previously both modules object and object_container had huge overlaps in
functionality. Both allowed to create and delete containers. One would
not have to pass a object to the object module at all and could use it
to manage containers only. Now the object module has been changed to
manage an object in a container only while the object_container module
is responsible for managing Swift containers only.

With object module it is now also possible to pass data instead of a
filename via module options. The container_access functionality has been
dropped from object module. It has been moved and extended as read_ACL
and write_ACL options in object_container module.

With object_container module it is now also possible to manage the
container access with read_ACL and write_ACL options. Those mirror
earlier container_access option of the object module which has been
removed.

Change-Id: I96fb9b946444866b157655e148250f1eda35e942
2022-11-30 10:53:52 +01:00
Jakob Meng
1ca6f208f7 Refactored catalog_service{,_info} and auth modules
Replaced service_catalog return value in auth module with new
catalog_service_info module.

Change-Id: I1ca5082d643eb97e8cb951a4bccf92b78537d917
2022-11-30 10:53:24 +01:00
Jakob Meng
00ec3f1c92 Refactored subnet_pool module
Change-Id: If210789edac2768178ccf323ec5be12f0c439a0f
2022-11-30 10:53:08 +01:00
Jakob Meng
0f37ed795b Refactored neutron_rbac_polic{ies_info,y} modules
Change-Id: I1cd37096834d4159b5fa46719f5c479cb2bc29a9
2022-11-30 10:52:27 +01:00
Rafael Castillo
daf79de37e Updates server_group for 2.0.0
Replaces the policies argument with policy. The policies attribute is
ancient and was superceded by policy a long time ago[0][1]. Since policy and
policies differ in type, we can't simply alias these and had to drop
policies to keep the implementation small.

[0] https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id59
[1] https://docs.openstack.org/api-ref/compute/#create-server-group

Change-Id: Icd658fb179ca0a96276b033130b9dddfedd84236
2022-11-17 04:41:14 -07:00
Jakob Meng
961bdb5bd5 Refactored federation_mapping{,_info} modules
Change-Id: I8ab45280badf7fc9448e2ebfc6e38648cc2dc1b7
2022-11-10 19:50:48 +01:00
Jakob Meng
d3c5ddd40f Refactored compute_flavor module
Change-Id: Id023d13abf5c1179044fcc611a3e509f16f10621
2022-11-10 19:41:36 +01:00
Jakob Meng
114bc855c0 Refactored keystone_federation_protocol{,_info} modules
Change-Id: I6f9eef184538df4feff49dd6ed659a9b9ac1289f
2022-11-10 19:39:51 +01:00
Jakob Meng
5862d91615 Split project_access into {compute_flavor,volume_type}_access modules
Change-Id: I33fa4b3a08392feac702f45a2c47f8b04799ac0b
2022-11-10 19:35:49 +01:00
Rafael Castillo
4fe73c978a Updates server_metadata for 2.0.0
- Switch to using proxy layer calls
- Return whole server resource instead of only metadata map
- Swap the name and server aliased parameters
- Add a server_metadata test role
- Ensure check mode returns tentatively updated metadata
- Remove server_id return value

Change-Id: Id63e6a80d1b8e3574911016fec792f00b63f1524
2022-11-10 13:04:52 +00:00
Jakob Meng
cd002a5555 Use module defaults groups in ci integration tests to reduce code bloat
Change-Id: I1370f5bcde602f63b4763c487f027677e79c73b0
2022-11-09 14:35:17 +01:00
Jakob Meng
d0ac32eefd Refactored integration test of openstacksdk logging feature
Instead of asserting that openstacksdk created a logging file,
we read the contents of that log file now. The benefit is, that
this integration test gives users an idea how to actually use the
logging feature and also read the contents of the log file.

Change-Id: I9e3c75dda4c1c920937c9780fbdcbe3caeb4d6ad
2022-11-09 14:35:09 +01:00
Jakob Meng
d07778c24a Refactored config module
Change-Id: I7ba626e2ef2a108bf79cacd8d6ee0735b8a0bdeb
2022-11-09 09:32:27 +00:00
Jakob Meng
a8f6dbd904 Renamed image->image_name and flavor->flavor_name to avoid collisions
Change-Id: I09a133b5c4f6c71e10d274be1c70b7edcce1c83c
2022-11-08 20:44:02 +01:00
Jakob Meng
b3c2e8f1ce Refactored volume_snapshot{,_info} modules
Change-Id: I70fc744f786a9de654592c97188af48ddbe8751d
2022-11-08 13:48:57 +01:00
Jakob Meng
8c889f8eb3 Fixed check mode
Change-Id: I3a7a0b0567ac24fb9433352fdc99022bf366fc6a
2022-11-08 13:48:01 +01:00
Jakob Meng
764a8bff64 Refactored volume_backup{,_info} modules
Change-Id: I523fd25a11f8f39a346afc17ae1e3a4dfcb8bae2
2022-11-04 20:06:50 +01:00
Zuul
e9cd9bff2a Merge "Fix documentation defaults for modules" 2022-11-04 08:54:52 +00:00
Jakob Meng
8955110586 Refactored volume_info module
Change-Id: I5fd844fbb7b9831deb32594c4a587b7249f63d00
2022-11-03 10:31:54 +01:00
Sagi Shnaidman
a180f339a8 Fix documentation defaults for modules
Match defaults in spec and documentation, make happy ansible-test.

Change-Id: Ifd6a02e957d1f0df27d89c350fb9d1ebf1ca7680
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2022-11-02 21:19:02 +00:00
Denys Mishchenko
53da712635 Existing images update name, visibility etc
Dropped default values of min_disk and min_ram parameters because
it interferes with the update mechanism and glance uses those values
anyway [1], [2].

If the image is already present and visibility param is defined we
should check its visibility and correct it if needed. Added tests
to verify that both is_public and visibility can change the image.

If both name and id are specified for the image, we might want to
update the image name. This rely on fact that id pram is checked first.
Added rename tests to verify this.

For some reason if image object is used for the image update, 409
error produced and exception trown, but the change is in place. So
instead of image object, update query rely on the image.id

[1] 75051dd5a2/glance/db/simple/api.py (L226)
[2] 75051dd5a2/glance/domain/__init__.py (L125)

Change-Id: I9ca6b78bec96b69e6946b65796f12314a1ec6ab4
2022-11-02 14:08:17 +01:00
Jakob Meng
1e27b6b69c Revert openstack.cloud.server parameter user_data to userdata
openstacksdk's create_server() [1] takes cloud-init userdata as a
plaintext string (or other data types [2]) via argument 'userdata',
not 'user_data' [3]. This is 'userdata' argument of create_server()
is different from the 'user_data' value which is returned [4]. The
latter is base64 decoded, while the former is e.g. a plaintext string.
As a (tiny) visual indicator for this difference, this patch reverts
the module parameter 'user_data' to 'userdata' which was used before
this module got refactored [5].

[1] 57fbb72e32/openstack/cloud/_compute.py (L678)
[2] 57fbb72e32/openstack/cloud/_compute.py (L1757)
[3] 57fbb72e32/openstack/cloud/_compute.py (L796)
[4] 57fbb72e32/openstack/compute/v2/server.py (L223)
[5] ac401bb354

Change-Id: I1f3b9314e4d82674cd2ae45f6209de5611e2b6cb
2022-10-28 18:19:24 +02:00
Sagi Shnaidman
65ac75b518 Run *-devstack-ansible-devel job on Ubuntu 22.04 LTS (Jammy Jellyfish)
Ansible requires Python 3.9+ since ansible-core 2.14 [1], but our
ansible-collections-openstack-functional-devstack-* jobs use
Ubuntu 20.04 LTS (Focal Fossa) which has Python 3.8 only.

[1] 884244f1b2

Co-Authored-By: Jakob Meng <code@jakobmeng.de>

Change-Id: I0c363a925265a5d42c16870094c8384fa509e4d2
2022-10-27 12:34:46 +00:00
Jakob Meng
2f87448567 Always remove temporary files in volume's integration test
This will ensure proper cleanup when tests fail.

Change-Id: Ia5758ffeab43d92f670d3e159fe4f3747491ec94
2022-10-27 11:10:10 +02:00
Jakob Meng
4e1718db49 Refactored ci script with shellcheck suggestions and install collections
Change-Id: I071e50eadfaf0f17f413a0c5f86e5d6b96356b36
2022-10-26 13:05:07 +00:00
Kristian Kucerak
97fa59bf6f Change subnets_info module to work with new SDK
Change-Id: Ie23604c34ed9fb17eeb15bf73db9019ca9ebc7d8
2022-10-26 08:03:06 +00:00
Rafael Castillo
c13fac3796 Updates volume for 2.0.0
Changes sdk calls to use the proxy layer where convenient.

Ensures resources are converted to dict before returns.

Changes the name of various parameters to match sdk attributes. Adds the
old attribute names as aliases to maintain backward compatibility.

Adds detailed return documentation.

Removed the ability to create volumes in specific projects. Users
looking to do that can use the auth parameter to specify what project
is relevant

Removes conditionals in tests that maintained support for ancient
openstack and sdk releases.

Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/854293
Change-Id: I3c4f4209f2ca6348370a45473bdb0d111b2439b6
2022-10-26 05:50:47 +00:00
Jakob Meng
99074ccd12 Refactored baremetal_port and baremetal_port_info modules
Sorted argument specs and documentation of both modules.

Refactored both modules to be subclasses of OpenStackModule class.

Renamed baremetal_port's module attributes 'uuid' to 'id' and
'portgroup' to 'port_group' to match openstacksdk. Added the previous
attribute names as aliases to keep backward compatibility. Added
alias 'pxe_enabled' for 'is_pxe_enabled' which was previously set
programmatically.

Changed baremetal_port module to return attribute 'port' only when
state is present. It will return no values (except Ansible's default
values) when state is absent. Previous return value 'id' can be
retrieved from port's dictionary entry 'id'.
The non-standard return value 'result' has been dropped because its
content can easily be reconstructed with Ansible's is changed check.

The non-standard return value 'changes' has been dropped because its
content was only returned on updates, has no known uses and can
easily be reconstructed in Ansible by comparing the updated port
dictionary with a copy of the pre-updated port dictionary.

Module baremetal_port_info will no longer fail when no port with a
matching id or name or address could be found. Instead it will return
an empty list like other *_info modules.

baremetal_port_info's return attribute 'baremetal_ports' has been
renamed to 'ports' to be consistent with other modules. The former
name will keep to be available for now to keep backward compatibility.

Both modules convert their return values into dictionaries without
computed (redundant) values. They do not drop values such as links
anymore though, because we do not withhold information from users.

Updated DOCUMENTATION, EXAMPLES and RETURN docstrings in both modules.

Added integration tests for both modules. They will not run in CI atm,
because we do not have Ironic enabled in our DevStack environment.

Change-Id: I54b3ea9917fbbbdf381ef934a0d92e2857f6d51b
2022-10-25 11:31:07 +02:00
Jakob Meng
65a7e74b2b Refactored baremetal_node_action module
Sorted argument specs and documentation of the module.

Refactored baremetal_node_action module to be a subclass of the
OpenStackModule class.

Redefined baremetal_node_info's module attributes 'id' and 'uuid'
as aliases of the 'name' attribute because modules in this collection
do not differentiate between ids and names. The previous revision of
baremetal_node_info module had the same behaviour implemented but did
not make the relationship between 'id'/'uuid' and 'name' explicit.

Changed types and/or choices of module attributes 'deploy',
'maintenance', 'power' and 'state' to match what has been described
in DOCUMENTATION string and to get rid of the non-Ansible'ish and
inconsistent parsing of input values in _is_true() and _is_false()
functions. Ansible can handle argument types for us, no need to
implement it ourselfs.

Dropped deprecated ironic_url attribute from DOCUMENTATION docstring.
Dropped wait and timeout attributes from DOCUMENTATION because their
docstrings will be added via documentation fragment.

Dropped attribute 'result' from module results because in our modules
we consistently do not explain what we do in modules.

Updated DOCUMENTATION, EXAMPLES and added RETURN docstrings.

Refactored the change logic for maintenance, power state and state,
eliminating unreachable or broken code.

Dropped wait attribute from DOCUMENTATION because its docstring will
be added via documentation fragment.

Kept timeout attribute in DOCUMENTATION and argument_spec because
it has a high(er) default value, to account for long node
(de)activiation times, than what e.g. the generic doc fragment
specifies.

Change-Id: I991f23c16583da106105677d75b3651959280d98
2022-10-25 11:30:46 +02:00
Jakob Meng
902b2f8147 Refactored baremetal_node and baremetal_node_info modules
Added integration tests for both modules. They will not run in CI atm,
because we do not have Ironic enabled in our DevStack environment.

Sorted argument specs and documentation of both modules.

Refactored both modules to be subclasses of OpenStackModule class.

Renamed baremetal_node_info's module attribute 'node' to 'name' and
added the former as an alias to be consistent with other *_info
modules.

baremetal_node_info will no longer fetch port and portgroup details
because this requires extra api calls for each node. Users can use
the baremetal_port module to retrieve ports for each node on demand.

Refactored code for constructing node updates in baremetal_node module
which allowed us to drop the dependency on Python module jsonpatch.

Deprecated baremetal_node's skip_update_of_masked_password attribute.
Updating or even specificing passwords for nodes has not been
supported for a while now, rendering the attribute useless.

Renamed baremetal_node's module attributes 'chassis_uuid' to
'chassis_id', 'uuid' to 'id' as well as suboptions of
'properties' to match openstacksdk. Added the previous attribute
names as aliases to keep backward compatibility.
Marked nics attribute in baremetal_node as not updatable.

Changed baremetal_node module to return attribute 'node' only when
state is present. It will return no values (except Ansible's default
values) when state is absent. Previous return value 'uuid' can be
retrieved from node's dictionary entry 'id'.
The non-standard return value 'result' has been dropped because its
content can easily be reconstructed with Ansible's is changed check.
The non-standard return value 'changes' has been dropped because it
was only returned on updates, has no known uses and can easily be
reconstructed in Ansible by comparing the returned node dictionary
with a copy of a previous node dictionary.

Module baremetal_node_info will no longer fail when no node with a
matching id or name or mac could be found. Instead it will return
an empty list like other *_info modules.

baremetal_node_info's return attribute 'baremetal_nodes' has been
renamed to 'nodes' to be consistent with other modules. The former
name will keep to be available for now to keep backward
compatibility.

Both modules convert their return values into dictionaries without
computed (redundant) values. They do not drop values such as links
anymore though, because we do not withhold information from users.

Updated DOCUMENTATION, EXAMPLES and RETURN docstrings in both
modules.

Dropped deprecated ironic_url attribute from DOCUMENTATION docstring
in baremetal_info. Dropped wait attribute from DOCUMENTATION because
its docstring will be added via documentation fragment.

Kept timeout attribute in DOCUMENTATION and argument_spec because
it has a high(er) default value, to account for long provisioning
times, than what e.g. the generic doc fragment specifies.

Change-Id: If3044acf672295e9b61fa60d0969f47cd06dfdeb
2022-10-25 10:11:39 +02:00
Artem Goncharov
f51898bd2f Do not enforce optional params in network module
It is wrong to enforce values of optional networking parameters. In the
clouds where those optional extensions are not installed this leads to
failures. Instead only pass params down to SDK if user explicitly set
them.

Change-Id: I5660eb8a4a65dd365ae7ce8c09825bbed8d2fdde
2022-10-18 16:51:03 +02:00
Jakob Meng
7bad5cfd42 Refactored stack_info module and allow to filter by owner and project names
Allow to filter stacks by owner names and project names instead of
ids only, in order to be consistent with other *_info modules.

Renamed stack_info's module attributes 'owner_id' to 'owner' and
'project_id' to 'project' to account for the new filter by name
functionality. Added the *_id attributes as aliases to keep
backward compatibility.

Updated and extended DOCUMENTATION, EXAMPLES and RETURN docstrings.

The stack_info module will convert its return values into dictionaries
without computed (redundant) values. Thus dropping values such as
location is not required anymore.

Change-Id: I9cdfb44dd424f63c05943616cf5918ceb3a57b1f
2022-10-14 12:22:10 +02:00
Jakob Meng
34b0abb4ca Refactored floating_ip and floating_ip_info modules
Use service proxies from openstacksdk wherever reasonable in order to
reduce calls to OpenStack API.

Renamed floating_ip_info's attribute 'project_id' to 'project' to be
consistent with other attributes and added the former as an alias to
keep backward compatibility. The latter can now also be used to search
for floating ips by project names, not only project ids.

Sorted argument specs and documentation of both modules.

Reworked integration tests, e.g. replaced references to server's
'addresses' attribute with calls to our port_info and floating_ip_info
modules. Also reformatted tests and added assertion on return values.

Merged integration tests of floating_ip_info module into floating_ip
module, because the former does not create any floating ips and
assumes that they have been created earlier.

For Zuul CI job ansible-collections-openstack-functional-devstack-\
releases to pass, the minimum required openstacksdk release must be
0.102.0 because [1],[2],[3],[4] are available since that release
only.

[1] https://review.opendev.org/c/openstack/openstacksdk/+/851976
[2] 0ded7ac398
[3] https://review.opendev.org/c/openstack/openstacksdk/+/859672
[4] 2535ba7a28

Change-Id: I129f866e7ed8d5c0499c93e78ebbe2c424e09423
2022-10-14 12:09:28 +02:00
Jakob Meng
0ade33eb6f Bump minimum required openstacksdk release to 0.102.0
Latest release candidate 0.102.0 of openstacksdk's first major release
brings new features and bug fixes, e.g. for floating ips [1], [2].

[1] https://review.opendev.org/c/openstack/openstacksdk/+/859672
[2] 2535ba7a28

Change-Id: I009c8515e853baf4df3455fab19571f28e02ab46
2022-10-14 12:08:43 +02:00
Rafael Castillo
ed36d82a0c Refactor server_volume to be compatible with openstacksdk>=0.99.0
Change-Id: Id636bc5de1acb59ad8587cd6c7181e022097cfe7
2022-10-10 10:19:09 -07:00
Jakob Meng
41299b9666 Refactored stack module and use stack's tag(s) attribute
Dropped stack status checks for CREATE_COMPLETE and UPDATE_\
COMPLETE and instead pass wait=True to openstacksdk's create_stack()
and update_stack() calls because those will call event_utils.\
poll_for_events() which garantees that stack has reached those
states when they return [1],[2].

Check for duplicate keys in parameters which already have been
defined by regular module attributes. Raise an error to warn
users that they tried to overwrite parameters which they already
specified with module attributes.

Renamed stack's module attribute 'tag' to 'tags' to match both
openstacksdk and OpenStack API and clarify that more than a
single tag can be specified. Added 'tag' as an alias to keep
backward compatibility.

Actually pass the 'tags' aka 'tag' attribute to stack create
and update functions of the openstacksdk which was lost in [3].
Added tags to integration tests.

Sorted argument specs and documentation of the stack module and
marked attributes which are not updatable.

Dropped condition from self.conn.delete_stack() because the latter
will only return False when a stack could not be found which we
already. self.conn.delete_stack() will raise an exception when
stack deletion fails.

Renamed ci integration tests from 'orchestration' to 'stack' in
order to match module name and adapted tags accordingly.

Fixed and enabled ci integration tests for stack and stack_info
modules.

Dropped 'stack_name' from module return values in RETURN
docstring and ci integration tests because openstacksdk not
return this attribute.

[1] 9b1c433352/openstack/cloud/_orchestration.py (L92)
[2] 9b1c433352/openstack/cloud/_orchestration.py (L148)
[3] af79857bfb

Change-Id: I4ace6012112bbcce9094353e27eb4066cf25f229
2022-10-07 19:08:28 +00:00
Jakob Meng
a660a35d86 Replaced expensive get_server() and fixed issues in server module
openstacksdk's get_server() [1] calls add_server_interfaces() [2]
which queries OpenStack APIs several times to get all ports and
floating ips attached to a server.

Now we call openstacksdk's compute.find_server() [3] and compute.\
get_server() [4] which result in two API calls, in order to fill
server['addresses'] attribute which we later use to get floating ip
addresses attached to the server.

Do an extra call to compute.get_server() in order to return a pristine
server resource, because openstacksdk's create_server() might call
meta.add_server_interfaces() which alters server attributes such as
server['addresses'] [5].

Fail if options 'auto_ip', 'floating_ips' or 'floating_ip_pools'
are specified but 'wait' is not set to true, because openstacksdk
will add floating ip addresses only if we wait until the server
has been created [6]. This conditional fail will help users to not
shoot their foot.

Marked floating ip support unstable in this module due to various
unresolved issues in openstacksdk's add_ips_to_server() function
such as [9] and [10].

For Zuul CI job ansible-collections-openstack-functional-devstack-\
releases to pass, the minimum required openstacksdk release must be
0.101.0 because [7],[8] are available since that release only.

[1] 3f81d0001d/openstack/cloud/_compute.py (L484)
[2] 3f81d0001d/openstack/cloud/meta.py (L439)
[3] 3f81d0001d/openstack/compute/v2/_proxy.py (L652)
[4] 3f81d0001d/openstack/compute/v2/_proxy.py (L666)
[5] 3f81d0001d/openstack/cloud/_compute.py (L942)
[6] 3f81d0001d/openstack/cloud/_compute.py (L945)
[7] https://review.opendev.org/c/openstack/openstacksdk/+/851976
[8] 0ded7ac398
[9] https://storyboard.openstack.org/#!/story/2010352
[10] https://storyboard.openstack.org/#!/story/2010153

Change-Id: I6a5663433b1b9529f99d5eced22a28c692a1d288
2022-10-06 21:30:15 +02:00
Rafael Castillo
f0cb7f6802 Update quota for 2.0.0
Add a test role to validate module functionality

Replace calls to the sdk cloud layer to use the proxy layer.

Update module parameters to use names matching the sdk. Keep aliases for
old values.

Remove _scrub_results, no longer necessary with proxy layer.

Move check mode outside of main flow to keep the module readable.

Refactor code to handle fields that should be ignored.

Simplify return value from _system_state_change_details.

Inline calls to fetch existing quotas.

Remove metaprogramming calls to cloud layer methods, as the proxy layer
doesn't have the same consistent API.

Remove handling for case where neutron throws exception when unsetting
quotas that aren't set. This is validated in the test role.

Ensure return values are dicts.

Replace exception handler with conditionals which allows us to drop the
dependency on keystoneauth1 library and is much more correct than
catching all exceptions and always printing the same error even on
unrelated exceptions.

Story: 2010099
Task: 45654

Change-Id: I5eda8e476a4e779382e6c63f5982504d5951501d
2022-10-06 12:04:06 +02:00
Jakob Meng
6ab3d76696 Ensure openstacksdk compatibility in inventory plugin
Story: 2010337
Task: 46470

Change-Id: Ieb624b76627b5127d7a6c4d95233bbd5c2f16182
(cherry picked from commit e8bba38e2e)
2022-09-30 08:33:39 +02:00
Jakob Meng
40d913d2a6 Dropped minimum OpenStack SDK version in inventory plugin
We require openstacksdk>=0.99.0 for this collection but we do not
specify versions in module requirements. We probably should do so,
but then consistently across all modules and plugins.

Change-Id: If3d8cd1491266e3332f478267fc41771f280b9a8
2022-09-30 08:30:57 +02:00
anbanerj
41f3007a80 Makes stack module compatible with new sdk version
Change-Id: Iec99be0f422f1fab9b17e581b7b47a7540de749c
2022-09-27 10:28:56 +02:00
Jakob Meng
b416a3e242 Force major version bump in pbr
Sem-Ver: api-break

Ref.: https://docs.openstack.org/pbr/latest/user/features.html#version

Change-Id: Id0d5e5b389b3d2c194ff46ce91c3fe2e98e03c73
2022-09-23 10:43:22 +02:00
Rafael Castillo
ebaa1ac357 Specifically build master in tripleo periodic job
Currently, our tripleo periodic jobs are failing, while our check jobs
are passing. This is because build-test-packages is not building the
tip of master version of the collections, instead using the version
built in rdo. This patch explicitly adds ansible-collection-openstack to
the change list so it always gets picked up by build-test-packages.

Change-Id: I6938c8373872daed8632429df42d20396980bc76
2022-09-22 14:11:41 +00:00
Jakob Meng
57cc3e6aad Bump minimum required openstacksdk release to 0.101.0
Latest release candidate 0.101.0 of openstacksdk's first major release
brings new features and bug fixes, e.g. for floating ips [1], [2].

[1] https://review.opendev.org/c/openstack/openstacksdk/+/851976
[2] 0ded7ac398

Change-Id: I4f63e9edab19ba25918513b8c89fcd62913ae75a
2022-09-22 04:49:40 +00:00
Jakob Meng
9f3f0837c8 Updated network module docs
The network module does support updates since Will's patch [1].

[1] https://review.opendev.org/c/openstack/ansible-collections-openstack/+/854170

Story: 2010024
Task: 45262
Change-Id: I9e4af2c6e685686e28e7f2ae56a615529a6d7b59
2022-09-21 20:09:01 +00:00
Zuul
8a80113d54 Merge "Update federation_mapping_info module to be compatible with new sdk" 2022-09-21 17:42:22 +00:00
Arx Cruz
ffa84bd705 Update address scope to use proxy
Updating address scope module to use proxy layer and new openstacksdk

Change-Id: I4763e22e7ad9174e23aa2030f63f7535006399a0
2022-09-21 15:47:13 +02:00
Arx Cruz
c0bc0b0796 Update federation_mapping_info module to be compatible with new sdk
Change-Id: I5dae772622eb47822c4c0e0681a1d344fa9ef16a
2022-09-21 14:29:23 +02:00
anbanerj
fb0fb529b7 Makes security_group_rule_info compatible with new sdk version
- Changed get_security_group_rule to find_security_group_rule as
  get_security_group_rule throws an exception if the rule is not
  found
- Updated docs
- Updated tests
- Renamed ethertype to ether_type to match openstacksdk's attribute
  names and added the former as an alias to keep backward compat
- Renamed rule to id to match openstacksdk's attribute names and
  added the former as an alias to keep backward compat

Change-Id: Ieb99f875c990e11623c81e482013d0ecb8e61055
2022-09-21 00:27:25 +00:00
Will Szumski
2d0656f072 Allow networks to be updated
Neutron will allow you to update certain properties of the network after
creation. This change modifies the ansible code to perform an update
call if it detects that any updatable properties have been changed. If
you attempt to change a property that cannot be updated, the module will
fail. This gives you confidence that the ansible configuration matches
the state of the network in OpenStack. If we did not fail in this way,
you might think you have updated the network, but in reality those
changes would be silently ignored. Prior to this change, the only way to
update properties of a network was to delete it and then recreate.

Story: 2010024
Task: 45262
Change-Id: I4af2b50f207f349b58c63e0a4e92816ada0847fd
2022-09-20 10:02:41 +00:00
Sagi Shnaidman
515cc66287 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
2022-09-09 05:40:08 +00:00
Jakob Meng
73827a3d57 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
2022-09-07 10:38:40 +00:00
Sagi Shnaidman
f2bf56d984 Fix release job
include_vars works on the controller only, use loading facts
to get variables from galaxy.yml
Change-Id: Idf45354650dea93bd8bdbfa9fa2ba52abda93cc0
(cherry picked from commit 39bb4909ee)
2022-09-07 06:51:17 +00:00
Arx Cruz
6d8c965333 Move keypair module to proxy layer
Update keypair module to new openstacksdk

Change-Id: I8f29d983b176e83fbca1919be34a86fe4756aa5e
2022-09-07 00:13:57 +00:00
Travis Holton
81a81ad759 Add floating_ip_enabled flag to coe_cluster creation
* Pass option as true if present
* False if not present

Change-Id: I44eaa8ee99386fdbd5020b36711b13b17db29b7b
2022-08-28 14:19:55 +12:00
Jakob Meng
b99218c143 Deprecate special value 'auto' for attribute 'id' of compute_flavor
Across our modules we use the None values to mark default values for
module attributes. This is in line with openstacksdk's behaviour.

Change-Id: I5920aeeb8eef2ee1c2066a71a273ba52f02305c3
2022-08-22 14:10:11 +02:00
Jakob Meng
d47cf4333c Remove debug statement leftover
Change-Id: I0d3d749b2f5b3474028c83c582c4fd7d1f07687d
2022-08-16 17:06:19 +00:00
Arx Cruz
8563e2327c Update federation_idp to use proxy
Update federation_idp to use proxy layer

Change-Id: I89ed8526c15608a043cc98e0de50a1ef6f1c8020
2022-08-16 14:21:35 +00:00
Rafael Castillo
4df7a12ebf Update compute flavor module for 2.0.0
Switch sdk calls to use the proxy layer where sensible.

Ensure that returned resource objects are converted to dicts.

Removes undocumented id return value.

Rename flavorid to id. Keep flavorid as an alias for backward
compatibility.

Rename the test role from nova_flavor to compute_flavor to keep naming
consistent.

Fold tests from compute_flavor_info into the compute_flavor role.

Add additional tests to improve coverage.

Update return docs

Change-Id: I5419d1c02b9b50625beb3bff88c8e4a4f1c14667
2022-08-11 12:48:20 +00:00
Jakob Meng
0ec16fbecc Dropped extra interfaces_info attribute from routers_info module
routers_info's interfaces_info attribute is not provided by
openstacksdk, it is added to each router resource by the routers_info
module after retrieving the routers list. To get the required data
list_router_interfaces() [1] is being called for each router resource
which then retrieves all ports for each router. This requires extra
api calls which might be useless because we do not know whether the
user actually cares about the ports. For getting ports of a router
we have the openstack.cloud.ports module. So instead of proactively
retrieving the router ports we drop the interfaces_info attribute.

The interfaces_info attribute was introduced because retrieving
interfaces via openstacksdk and openstack.cloud modules was
complex in the past [2]. Nowadays, using openstack.cloud.ports
Ansible and Jinja2 filters retrieving ip addresses of a router
is straight forward. In case someone still needs the old
interfaces_info attribute, one can refer to the module example
to see how it could be reproduced. But in general, retrieving the
router interfaces is much easier as can be seen in the updated
integration tests.

[1] 3f81d0001d/openstack/cloud/_network.py (L1926)
[2] https://review.opendev.org/c/openstack/ansible-collections-openstack/+/703927/6/plugins/modules/os_routers_info.py

Change-Id: I7fbdf11d07c95421d3aee800bfeebb88ea829817
2022-08-11 08:37:10 +00:00
Rafael Castillo
5e7c29d97e Update identity_group for 2.0.0
Replace calls to the sdk cloud layer with proxy layer calls where
appropriate.

Ensure module return values are converted into dict.

General refactoring to bring module more in line with collection
conventions.

Expand tests to assert idempotency and presence of return values.

Rename test role to identity_group to match module name.

Change-Id: I06fe28f77431bb151d85c8d9cd924a1634d85d98
2022-08-10 12:05:44 +02:00
Jakob Meng
d0eb83e934 Refactored port and port_info modules
Define port's module attribute 'name' as a required attribute because
this parameter is used to find, update and delete ports. Technically,
a name is not required to create a port, but idempotency cannot be
implemented without an identifier to refer to a port. In this
collection we use resource names to find and identify resources. We
do not offer a dedicated id attribute in most modules.

Use port's module attribute 'network' when finding, creating,
updating or deleting ports if the user provided this attribute.
This allows to reduce ambiguity when equal names are used across
different networks.

Added 'description' parameter to port module.

Renamed port's module attributes 'vnic_type' to 'binding_vnic_type'
and 'admin_state_up' to 'is_admin_state_up' to match openstacksdk's
attribute names which are used e.g. in module results. Added aliases
for the old attribute names to keep backward compatibility.

Renamed port_info's module attribute 'port' to 'name' and added
the former as an alias to be consistent with other *_info modules.

Dropped default=None and required=False from argument_spec of port
module because those are the default in Ansible [1][2].

Dropped 'id' field from port module's results to be consistent across
other modules. Use 'port.id' instead.

Sorted argument specs and documentation of the port module and
marked attributes which are not updatable.

Updated RETURN fields documentation for the module results of both
port and port_info modules.

Added integration tests to check the update mechanism of the port
module.

Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.

Dropped openstacksdk version check since we require a recent release
anyway.

Fixed indentation in integration tests.

Merged integration tests of port_info module into port module,
because the former does not create any ports and assumes that
ports have been created earlier.

[1] https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html
[2] 61af59c808/lib/ansible/module_utils/common/parameters.py (L489)

Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: Iacca78649f8e01ae95649d8d462f5d0a1740405e
2022-08-08 19:05:19 +00:00
Arx Cruz
ce6193cd2f Update federation_idp_info module to use proxy layer
This patch update federation_idp_info to use proxy layer as well as add
the ansible role to test the module

Change-Id: I6b4544cca317f2d5fab4a9612b820872b87585f4
2022-08-08 11:59:58 +02:00
Jakob Meng
fdc67892e3 Refactored router module
Expanded and fixed module results docs.

Moved ext_ips_spec into the module class because global scope is not
necessary. Renamed it to external_fixed_ips_spec to explain its
purpose.

Sorted argument_spec and attribute docs by attribute name and fixed
indentations. Marked router attributes which cannot be updated.

Mark network attribute as required by enable_snat and
external_fixed_ips attributes. Fixed docstring of network attribute:
Module attribute interfaces does not require the network attribute,
its external_fixed_ips what requires network to be set.

Changed examples from deprecated ip to current ip_address attribute.

Dropped self.fail() calls and let openstacksdk handle missing networks,
subnets.. instead because less code means less code to maintain.

Limited line length to 80 chars to be consistent with other OpenStack
projects. Personally, I prefer a 120 chars limit but consistency is more
important.

Added explanation in code comment why we cannot update a router's name.

Moved upfront cleanup operations in router's integration tests to the
beginning of the role.

Assigned meaningful names to result variables
in router's ci role to easily identify which modules produced the
data.

Added tests for router ids, admin state and interfaces.

Change-Id: Icae77a43479fb4f0bae065d1c5d7942cb0f5fd6b
2022-08-03 06:16:42 +00:00
Rafael Castillo
d2eb98d048 Update baremetal_inspect to be compatible with new sdk
Refactors the module to be based off OpenstackModule.

Changes sdk calls to use the proxy layer where appropriate. The
inspection itself stays at the cloud layer to support waiting.

Make sure we convert returned resource objects to dict

Adds a barebones role to test the module. This won't run in CI, since
we don't have the ironic plugin configured in devstack.

Changes the return value of the module to be the entire node, instead of
just the properties that resulted from inspection. Return docs were
updated to reflect this.

Update module params to use `name` as the identifier for the node,
aliasing it to the previous supported values of `id` and `uuid`.

Use module kwargs to specify mutually exclusive params.

Stop catching exceptions and instead let them bubble up so ansible
handles them.

Change-Id: I2b07b58c8b068d7f18db9862fcecb4088328ac74
2022-08-02 10:10:06 +02:00
Jakob Meng
1bf22feb2d 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
2022-08-01 14:32:24 +02:00
Jakob Meng
ac401bb354 Refactored server and server_info modules
Allow to update server attributes such as its description.

Changed default value of server attribute 'security_groups' from
['default'] to [] because the latter is the default in
python-openstackclient [1] and the former behavior causes issues
with existing servers [2]: Previously, when no 'security_groups'
parameter was given, the server module would change existing
servers to use the default security group, dropping all other
security groups assigned to the server.
Our (undocumented) guideline when writing modules is to only
add or change what has been requested by the user and to stick to
defaults from openstacksdk and python-openstackclient whenever
possible. Since we have to break backward compatibility with the
next release anyway, we take this opportunity to clean up this odd
behavior. Now, when no security groups are given, then security
groups of an existing server will not be touched.
Closes story #2007893 [2].
Note, Nova will create a server in the default security group,
if the security_groups parameter is omitted.

Dropped 'openstack' field from server module's results. This
variable expanded to additional server information which might
be useful for Ansible inventories and was filled from
openstacksdk's get_openstack_vars() function [3]. Variables in
this function can make additional cloud queries to retrieve
additional data, so calling this function can be expensive [4].
Users can use *_info modules to retrieve this data on-demand.

Dropped 'availabity_zone' attribute from generic OpenStackModule
arguments and inserted it into server and volume modules because
it is relevant to those two modules only. This is completes what
was started years ago [5] and is possible now since we have
breaking changes anyway.

Switched attribute name 'userdata' with its alias 'user_data' to
match openstacksdk's attribute names which are used e.g. in module
results. The previous attribute name 'userdata' is now used as an
alias and 'user_data' is used as the attribute name to keep backward
compatibility.

Wait for server to get into 'ACTIVE' state when creating a server
and attribute 'wait' has been set to true.

Sorted argument specs and documentation of the server module and
marked attributes which are not updatable. Changed unstable bash
script example in server module documentation.

Renamed server's module attribute 'delete_fip' to 'delete_ips' to
match openstacksdk and clarify that it includes all floating ip
addresses of the server.

Renamed server_info's module attribute 'server' to 'name' and added
the former as an alias to be consistent with other *_info modules.

Added RETURN fields documentation for the module results of both
server and server_info modules.

Added description and examples of how to use the 'filters' attribute
of the server_info module. Closes story #2007873 [6].

Removed 'openstack_' prefix from module results because the prefix is
not consistently used across modules, is more to type without any
benefit and removal of the prefix allows us to signal to users that
their code for handling module results has to be updated. Many modules
have different return values with openstacksdk >= 0.99.0 because it
consistently uses resource proxies now.

Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.

Added integration tests to check the update mechanism of the server
module.

Fixed indentation in integration tests.

Ensure proper creation and deletion of resources such as networks,
subnets and servers in integration tests of server_action module.

Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
'a' in the file extension to be consistent with other filenames.

Dropped deprecated function openstack_find_nova_addresses() and
incorporated its code directly into the server module because it
is not used anywhere else.

[1] e49ad1795b/openstackclient/compute/v2/server.py (L1070)
[2] https://storyboard.openstack.org/#!/story/2007893
[3] 9e9fc98795/openstack/cloud/_compute.py (L1772)
[4] 9e9fc98795/openstack/cloud/meta.py (L482)
[5] 9bf33e56dd
[6] https://storyboard.openstack.org/#!/story/2007873

Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
2022-07-28 21:56:30 +02:00
Rafael Castillo
3fdbd56a58 Update router for 2.0.0
- Change sdk calls to use proxies
- Convert return values to
- Update module docs
- Change argspec to more closely match the new sdk (and therefore the
  API) without breaking backward compatibility

Change-Id: I0f9bc573fd0c69cab65bd808145d628732bb0830
2022-07-28 11:31:37 +02:00
Jakob Meng
0b2b56765c Fixed Python shebang and UTF-8 coding in modules
Be consistent with Ansible docs [1], [2], [3].

[1] https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html
[2] https://docs.ansible.com/ansible-core/devel/dev_guide/testing/sanity/shebang.html
[3] b86a18bd27/test/lib/ansible_test/_util/controller/sanity/code-smell/shebang.py

Change-Id: Ia3976bb3fcca662cefa219edeef057bcb7143c01
2022-07-28 10:03:09 +02:00
Sagi Shnaidman
ccbbc319ce 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
2022-07-27 14:03:59 +00:00
Jakob Meng
0215e2a5d4 Dropped default module options
Removed default=None, type='str' and required=False from all module's
argument_specs with

sed -i \
    -e 's/default=None, //g' \
    -e 's/default=None,//g' \
    -e 's/default=None//g' \
    -e "s/type='str', //g" \
    -e "s/type='str',//g" \
    -e "s/type='str'//g" \
    -e 's/required=False, //g' \
    -e 's/required=False,//g' \
    -e 's/required=False//g' \
    plugins/modules/*.py plugins/module_utils/*.py

and manually cleaned the results because those options values are the
default in Ansible.

Ref.: https://docs.ansible.com/ansible/latest/dev_guide/developing_program_flow_modules.html#argument-spec

Change-Id: Icbc3bb84269d3b8205fac259300902ebdaf6a3ae
2022-07-27 12:39:44 +02:00
Jakob Meng
ceae5c1030 Use master branch of openstacksdk in Bifrost jobs
Bifrost downgrades openstacksdk to a release <0.99.0 [1], which is
incompatible to our master branch of the Ansible OpenStack
collection. By adding openstacksdk to Zuul variable job.required-\
projects [2], Bifrost will install openstacksdk from its master
branch, overwriting any existing (older) openstacksdk releases.

[1] 03ddd02656
[2] https://review.opendev.org/c/openstack/bifrost/+/849563/5/playbooks/test-bifrost.yaml

Change-Id: I46dadc70338bb45d459e8176cc26e67c20c1d4ae
2022-07-25 20:20:46 +02:00
Dmitry Tantsur
2d60a045a6 Remove deprecated stuff from baremetal_node
Change-Id: Ia9fbc5b136347145d1a7ddc2d874f014c06558ae
2022-07-22 14:02:37 +00:00
Jakob Meng
b87ae7dcce Dropped symbolic links and plugin routing for deprecated module names
With Ansible OpenStack collection 2.0.0 we break backward
compatibility to older releases, mainly due to breaking changes
coming with openstacksdk >=0.99.0. For example, results will change
for most Ansible modules in this collection.

We take this opportunity to drop the symbolic links with prefix
os_ in plugins/modules and the plugin routing in meta/runtime.yml.
This means users have to call modules of the Ansible OpenStack
collection using their FQCN (Fully Qualified Collection Name) such
as openstack.cloud.server. Short module names such as os_server
will now raise an Ansible error. This also decreases the likelihood
of incompatible Ansible code going undetected.

Symbolic links were introduced to keep our collection backward
compatible to user code which was written for old(er) Ansible releases
which did not have support for collections and where OpenStack modules
where named with a prefix os_ such as os_server which is nowadays
known and stored as openstack.cloud.server.

In Ansible aka ansible-base 2.10, a internal routing table
lib/ansible/config/ansible_builtin_runtime.yml [1] was introduced which
Ansible uses to resolve deprecated module names missing the FQCN (Fully
Qualified Collection Name). Additionally, collections can define their
own plugin routing table in meta/runtime.yml [2] which we did.

In ansible-base 2.10 and ansible-core 2.11 or later, if a user uses a
short module name and the collections keyword is not used, Ansible
will first look in the internal routing table, get an FQCN, and then
looks in the collection for that FQCN. If there is another routing
entry for that new name in that collection's meta/runtime.yml,
Ansible will continue with that redirect. If it does not find another
redirect, Ansible will look for the plugin itself, so it will not
find a redirect in the collection before looking at its internal
redirects. Except if the user uses a FQCN, then it looks directly in
that collection.

Ansible 2.9 and 2.8 do not have any notion of these redirects with a
plugin routing table, backward compatibility with deprecated os_*
module names is solely achieved with symbolic links. Ansible releases
older than 2.11 are EOL [3], so usage of os_* symlinks should reduce
soon.

[1] https://github.com/ansible/ansible/blob/devel/lib/ansible/config/ansible_builtin_runtime.yml
[2] https://github.com/openstack/ansible-collections-openstack/blob/master/meta/runtime.yml
[3] https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html

Change-Id: I28cc05c95419b72552899c926721eb87fb6f0868
2022-07-22 09:48:20 +00:00
Dmitry Tantsur
fd15087c4d Add a wait argument to baremetal_node
openstacksdk will start using cleaning in 1.0.0 [1], so we need to be
able to wait for it to finish.

[1] https://review.opendev.org/c/openstack/openstacksdk/+/849402

Change-Id: I9695b1a5acfa007ad474c9b5b07a4fdb4c1b1198
2022-07-21 06:47:47 +00:00
Arx Cruz
960e5df17f Update port info
Make it compatible with new openstack sdk 1.0.0

Change-Id: I911eecd31ee69dbde1da02a74e152746c1e3edfa
2022-07-20 06:46:33 +00:00
Zuul
bae75b84bd Merge "Raise minimum OpenStack SDK version to 0.99.0 again" 2022-07-19 14:22:29 +00:00
Jakob Meng
eda2e301c3 Raise minimum OpenStack SDK version to 0.99.0 again
This reapplies commit 4bfa135b20 [1]
which got reverted in commit 1b59c19a24
[2] due to issues in how TripleO Quickstart installed the Ansible
OpenStack collection. TripleO Quickstart has now been fixed and
will install code from our stable/1.0.0 branch instead of master for
all RDO branches which have openstacksdk <0.99.0 [3][4].

[1] 4bfa135b20
[2] 1b59c19a24
[3] https://review.opendev.org/c/openstack/tripleo-ci/+/849500
[4] https://review.opendev.org/c/openstack/tripleo-quickstart/+/849620/

Change-Id: I918d776c1560f03a4a84df371feb013d47043aa0
2022-07-19 09:55:11 +00:00
Jakob Meng
b250b76c33 Dropped CentOS8-based TripleO job
No RDO release for CentOS8 will get a OpenStackSDK 1.x.x release.

Change-Id: I728f0f282717c11a782be30859f999008f3fc8cb
2022-07-19 09:28:52 +02:00
Jakob Meng
fc2dda1d86 Refactored TripleO jobs, e.g. to use latest openstacksdk RPM
Build and install latest RPM for openstacksdk from its master branch
instead of using the (pinned) RPM from RDO. This is necessary because
openstacksdk in RDO is currently pinned to <0.99.0 for all RDO
releases. Variable artg_change_list is used to define what code is
being build from source. The RPM of the Ansible OpenStack collection
does not have build 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 other 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. It is also cleaner since our
CentOS9 job is 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

Added tripleo-ci-centos-8-standalone-osa to experimental jobs so that we
can actually run this job on demand easily.

[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
2022-07-18 15:27:12 +02:00
Jakob Meng
1f5a2019a0 Replaced code in routers_info module with openstacksdk function
Replaced custom code for interface listing with call to openstacksdk.
The original idea was to reduce the number of calls to the OpenStack
API but this kind of optimization is better to be implemented in the
SDK itself [1]. Reimplementing code like this increases our
maintenance burden, does not help other SDK users and increases the
likeliness of bugs. For example, variable allowed_device_owners
introduced a bug, it is not 'network_router_interface_distributed'
but 'network:router_interface_distributed'.

[1] https://review.opendev.org/c/openstack/openstacksdk/+/849967

Change-Id: I9c52de03c53ef29d7cecdf26253c0c00a7cf3689
2022-07-15 12:34:39 +02:00
Rafael Castillo
7ec8e4d087 Update project module to be compatible with new sdk
- Change sdk calls to use proxy objects
- Convert return values to dict before updating
- Adds additional test values

Change-Id: I187a27af4a5b8aa7cd4b60a1a876b5e5e6975144
2022-07-12 13:12:08 +00:00
Jakob Meng
070e77feca Added assertions on endpoint module results
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: If8befd62ac59ef19debf0d63abe76f11b47c2da3
2022-07-12 10:43:22 +02:00
Arx Cruz
a120db2d60 Update routers_info for the new SDK
Make routers_info module compatible with the new sdk 1.0.0

Change-Id: I43ea8ccc0d882ca63bc294dd99fb4f010f3806a5
2022-07-06 16:29:08 +02:00
Zuul
96be88af21 Merge "Refactored endpoint module and explained region attribute" 2022-07-06 12:46:26 +00:00
anbanerj
d600284645 Makes security_group_info compatible with new openstacksdk
Updated documentation of return values and added test to verify
return values

Function self.conn.search_security_groups() cannot be used here.
Arguments for filtering such as 'description' would have to be passed
to self.conn.search_security_groups() in its 'filters' argument [1].
The latter is passed to both as query arguments to OpenStack API
and later to _utils._filter_list() [2] for filtering the results.
Some arguments such as 'any_tags' are only used as query arguments
by openstacksdk [3] when querying OpenStack API. They are no valid
attributes in security_group.py [4]. Whenever those non-attribute
arguments are passed to self.conn.search_security_groups(),
_utils._filter_list() [2] would drop all results because no result
would have a matching attributes.

[1] 0898398415/openstack/cloud/_security_group.py (L31)
[2] 0898398415/openstack/cloud/_utils.py (L63)
[3] 0898398415/openstack/common/tag.py (L19)
[4] 0898398415/openstack/network/v2/security_group.py

Change-Id: Ie7fe9d2e973d38751c48e71e6bd55e56a591ac1f
2022-07-05 15:52:48 +02:00
Jakob Meng
0e675a9129 Split CI tests for security_group and security_group_rule modules
Previously, all security_group{,_info} and security_group_rule{,_info}
modules were tested in the same Ansible role. This patch splits
tests into two separate Ansible roles to increase readibility and
prevent variable name conflicts, e.g. for expected_fields.

Change-Id: Ifc28435147b3bfe88d4ee5e176469a53b7395dc0
2022-07-05 12:22:35 +02:00
Vladimir Hasko
19cd6262cf 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
2022-07-04 14:16:16 +00:00
Rafael Castillo
e0958c605e Updates security group rule for latest sdk
- Update docs
- Change calls from cloud to proxy layer
- Make sure return value is a dict
- Improve test coverage

Change-Id: I857d7ba7b7ca1b23100ee7e85e90e98430d68462
2022-07-04 12:46:31 +02:00
Rafael Castillo
aa19d74cde Update subnet module to be compatible with new sdk
Change-Id: Iba1604ee9c0b922b8fb7c6a278acf90d080a63e7
2022-06-29 15:00:20 +02:00
Rafael Castillo
2419b5ab19 Update image for new sdk
- Use proxy layer where possible
  - Image upload has some tricky logic so that stays in the cloud layer
- Convert return value to dict
- Document return values
- Update visibility logic for glance v2 api
- Increase test coverage
- General refactoring to bring more in line with rest of collection
- Deprecate is_public attribute which has been replaced with
  visibility.
- Deprecate volume attribute which has been made obsolete with
  openstack.cloud.volume module. Removed examples showing the volume
  attribute since users are encouraged to use openstack.cloud.volume
  module.

Change-Id: I1d8034a3b9a391444ea275b68b06ee3a291c73c3
2022-06-28 10:55:34 -07:00
Zuul
caf1bc49da Merge "Update project_info module to new sdk" 2022-06-27 21:59:39 +00:00
Jakob Meng
ad3a3a89f2 Refactored endpoint module and explained region attribute
Regions have IDs, but do not have names.
Ref.: https://docs.openstack.org/api-ref/identity/v3/#regions

Change-Id: I2512bbde6e96e2ab0f1fef0230295223f46105dd
2022-06-27 11:34:26 +00:00
Jakob Meng
c6c1c6a070 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>
2022-06-26 13:07:34 +02:00
Arx Cruz
bcca2efe1a Update project_info module to new sdk
Make project_info module compatible with the new sdk 1.0.0 and also add
ansible tests for project_info module

Change-Id: I413200cf6a9b8bada7e5d78087246b888d53fac2
2022-06-23 15:11:59 +02:00
Zuul
802e46d554 Merge "Make publish_collection more universal" 2022-06-20 12:39:32 +00:00
Zuul
160d0dea4d Merge "Return details in baremetal_node_info when iterating over all machines" 2022-06-20 12:27:06 +00:00
Dmitriy Rabotyagov
8f27184f30 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
2022-06-17 16:31:33 +02:00
Jan Horstmann
9b62cd7734 Return details in baremetal_node_info when iterating over all machines
Without any parameters supplied openstack.cloud.baremetal_node_info is
supposed to gather and return information about all nodes.
This is done with a call to cloud.list_machines(), which itself calls
self.baremetal.nodes().
Unfortunately this will not return detailed information about each
machine as the details parameter of self.baremetal.nodes() defaults to
false.
This commit rewrites the module to use the baremetal service proxy of
openstacksdk to get machines with details and converts them using the
`to_dict()` method.

Story: 2010017
Task: 45207
Change-Id: Ib06aea5f59f799d6ed81b30264c8a168301c1a9b
2022-06-17 13:28:25 +02:00
anbanerj
595f7d1093 Moves keypair_info from cloud to proxy object
This makes keypair_info compatible with new sdk version

Change-Id: I09c75717a620272904b023179c726a19c4bca000
2022-06-16 18:38:02 +02:00
Zuul
86b573883a Merge "Update role_assignment to use proxy" 2022-06-14 15:39:02 +00:00
Zuul
c54b34db3f Merge "Update endpoint to new proxy layer" 2022-06-14 15:32:47 +00:00
Zuul
6767db64c2 Merge "Update catalog service for the new sdk" 2022-06-14 15:14:30 +00:00
Arx Cruz
452404ee87 Update endpoint to new proxy layer
Update endpoint to new openstack sdk

Change-Id: Ibd647d0c2cd2f90310f381e56088e7e8e93f76fc
2022-06-14 14:27:04 +02:00
Arx Cruz
8d5195fdf2 Update role_assignment to use proxy
Updating role_assignment module to use the new openstacksdk

Change-Id: I09258e18d50acb57501ea1b47d9422dad857607e
2022-06-14 11:04:29 +02:00
Arx Cruz
7c7e61d36b Update catalog service for the new sdk
This patch do the following:

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

Change-Id: I6778f5e91cb0ead63cede28af0111d7ffbbf3ab1
2022-06-08 13:25:14 -07:00
Sagi Shnaidman
9272146cf7 Change network modules to work with new SDK
Change-Id: I7625d696f6462a7a955008a5c7276f1548acbc2e
2022-06-02 15:33:38 +02:00
Jakob Meng
a9fa496ebe 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: I92668b37d42db758e2bae8e791357b72c131a899
2022-06-01 20:44:27 +02:00
Rafael Castillo
d6cdad2c42 Correctly build params dict in recordset
Change If8fda40780050d271c9d869d8959ef569644fd88 unintentionally broke
our integration tests. This patch fixes the code and tests to make
everything pass again.

Change-Id: Ief8d1f9e1eec13a2d435e96a0d70e31a2b4431f2
2022-06-01 11:21:10 -07:00
Zuul
d65ea4d560 Merge "Update recordset module to be compatible with OpenStack SDK 0.99.x/1.0.x" 2022-05-31 14:40:47 +00:00
Rafael Castillo
4ea2c5b50d Update host_aggregate to be compatible with new sdk
- Change the implementation to use the proxy layer
- Update the module to return an aggregate object
- Adds a role to test the module

Change-Id: I6a98ba8466863b41fc996855fd12cf9f3097abe0
2022-05-31 11:00:36 +02:00
Rafael Castillo
97b05533f1 Update recordset module to be compatible with OpenStack SDK 0.99.x/1.0.x
- Change sdk calls to use proxy layer
- Convert sdk results to dict before returning
- General refactoring of module
- Move recordset specific tests from the dns role to new recordset role
- Adds additional tests to recordset role

Change-Id: If8fda40780050d271c9d869d8959ef569644fd88
2022-05-31 09:43:53 +02:00
Jakob Meng
dee39a71b6 Warn users about us breaking backward compatibility
Change-Id: I7a2867329f65af6330abccb1954bf49b92cd8721
2022-05-27 08:06:52 +02:00
Jakob Meng
1b59c19a24 Revert "Raise minimum OpenStack SDK version to 0.99.0"
This reverts commit 4bfa135b20 [1] because
it broke TripleO [2] and possibly other users which were using code from
master branch with incompatible SDK releases. We will reapply this
safety check later once dust has settled.

Ref.:
[1] 4bfa135b20
[2] https://bugs.launchpad.net/tripleo/+bug/1975646

Change-Id: I637f1b7c1b792adf6d3d17a27ccb42179f56a83b
2022-05-25 08:34:29 +02:00
Jakob Meng
4bfa135b20 Raise minimum OpenStack SDK version to 0.99.0
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 bumps the minimum required SDK versions to 0.99.0, 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 master branch with
a OpenStack SDK 0.x.x release.

Change-Id: I3974deabc516379745794806886352279dc4f4a7
2022-05-24 14:36:19 +02:00
Jakob Meng
c7ae7a5f98 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
2022-05-23 14:07:41 +02:00
Jakob Meng
4db7a6238b 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
2022-05-11 11:47:31 +02:00
Arx Cruz
a6805cd019 Update identity_group_info to new sdk
The following changes were made:

* Update identity_group_info to use the new openstacksdk
* Added identity_group_info role to test the module

Change-Id: I24e64c9455618952ee612d7413882f0ac022189f
2022-05-11 06:50:33 +00:00
Jan Horstmann
80ef209336 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
(cherry picked from commit acf64a1f72)
2022-05-10 20:31:23 +02:00
anbanerj
c1a9794207 Moves image_info from cloud to proxy object
This makes image_info compatible with new sdk version
- This patch changes get_image (which is a cloud object method) to image.get_image (proxy object method)
- image.images accepts **query which is a dict object. So this patch changes the args passed to a dict. If properties is not specified it passes an empty dict.
- updates the documentation to reflect the actual returned parameters
- adds a ci test to list all images without specifying image name or property and assert no field is missing
- changes openstack_image to image in ansible return value

Change-Id: Ibf934568f069c305747fc24fbb22ce3fc095286c
2022-05-09 19:09:08 +00:00
Rafael Castillo
1d22a94a90 Update identity_role_info for latest openstacksdk release
- Stop checking for to_dict, breaking compatibility with older sdk
  releases
- Updates RETURN doc string with all the returned fields
- Adds a new identity_role_info role to test the identity_role_info
  module.
- Change the name of the module return value to remove 'openstack_'
  prefix

Change-Id: If8a1145a31d685d41367383930e6fd08d64c6ae8
2022-05-09 11:03:49 +02:00
Jakob Meng
fdf4999747 Reverted identity_user_info from identity.users() to search_users()
Commit 2df07f3523 changed module identity_user_info to use function
identity.users() instead of search_users(). The first does not allow
to search for id with parameter name while the previous and current
search_users() function has a name_or_id parameter which allows to
search by name and id.

Ref.: 2df07f3523

Change-Id: I71226e578a234d24e068a256cf4a5533ccd4c201
2022-05-09 10:42:54 +02:00
Rafael Castillo
b31fdf8320 Refactored identity_domain_info
Switch to SDK's cloud layer function search_domains which allows
us to reduce our code. Added integration test for this module.

Change-Id: Ic7915fd3334266783ea5e9d442ef304fa734ca00
2022-05-09 09:57:43 +02:00
Rafael Castillo
fd1b9fc0d2 Use proxy layer in identity_user module
This patch changes the module to use the sdk proxy layer and does some
general refactoring to simplify the code. It will no longer fail if
no password is supplied since it is perfectly fine to create a user
with an password.

Renamed the test role from user to identity_user to match the module
name

Change-Id: I97ee9b626f269abde3be7b2b9211d2bb5b7b3c26
2022-05-05 09:21:39 -07:00
Jakob Meng
a8589e9f4d Added description to RETURN doc of identity_user_info module
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I000a12df18c66816b2b2de177530ffc46f9dc9ae
2022-05-05 11:05:57 +02:00
Rafael Castillo
2df07f3523 Use proxy layer in identity_user_info
- Changes the module to get user through proxy layer
- Adds a role to test the module
- Renames the return value to drop openstack_ prefix

Change-Id: I99e98a529ce74ff2ca77a67d09f188228e6a0e37
2022-05-04 19:00:48 +00:00
Jakob Meng
c83e0e39b1 Removed job definitions for stable/1.0.0 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: Idb8720bd96843b7807dd5cb62b30c1edf3a7a37c
2022-05-04 10:17:09 +02:00
Jakob Meng
92566dedae Fixed return type of identity_role module
Change-Id: Ifcf55749919fd59c990611e8c4537de787ba4005
2022-05-04 09:25:59 +02:00
Rafael Castillo
cc1b5ecae8 Update identity_role to work with latest sdk
Also renames the test role to match the module name

Change-Id: Ie59da441d39fe2d0e49430662d853bc9628181e0
2022-05-03 10:54:13 +00:00
Jakob Meng
4a7330364e 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
2022-05-02 20:49:39 +02:00
Jakob Meng
cf5007d478 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
2022-05-02 11:50:32 +02:00
Jakob Meng
c10cc9dd8c 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
2022-04-28 13:19:05 +02:00
Jakob Meng
3ead86904a 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
2022-04-28 09:59:18 +02:00
Jakob Meng
9f60f0f26d 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
2022-04-28 08:36:12 +02:00
Jakob Meng
e85a0b809a Constrain filters in compute_service_info to SDK >= 0.53.0
Older releases of OpenStack SDK do not support filtering services.

Change-Id: I613c76b8f794ea2024939e07250a50edc5b9e49a
2022-04-27 18:16:55 +00:00
Jakob Meng
bba1da17c9 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
2022-04-27 09:30:21 +02:00
Jakob Meng
bc6622e0e7 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
2022-04-27 06:45:30 +00:00
Jakob Meng
e869564e3c 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
2022-04-26 13:14:14 +00:00
Arx Cruz
0c6e8bed69 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
2022-04-26 10:04:47 +00:00
Jakob Meng
5a43bdb873 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
2022-04-22 12:09:26 +02:00
Jakob Meng
bb25330ddc Renamed image property protected to is_protected
OpenStack SDK removed support for the deprecated image property
protected in commit afb49692 [1][2]. This replaces the usage of
protected with is_protected in openstack.cloud.image but adds
protected as an alias to not break backward compatibility for
user code. This breaks backward compatibility to older OpenStack
SDK releases though.

Ref.:
[1] afb49692f5
[2] https://review.opendev.org/c/openstack/openstacksdk/+/820926

Change-Id: I5044c927e90c650234fbc22375f44e6841a485a1
2022-04-22 11:38:14 +02:00
Jesper Schmitz Mouridsen
ecf4897a55 Support description in sg-rule creation
Change-Id: I7800a91682b143b29c30e97661e057c6c41f4663
Signed-off-by: Jesper Schmitz Mouridsen <jesper@schmitz.computer>
2022-04-20 08:24:40 +00:00
Jakob Meng
f09cccdb9e 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
2022-04-20 09:03:30 +02:00
Jakob Meng
2bf82c2669 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
2022-04-19 21:59:31 +02:00
Jakob Meng
5fc8fca06b 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
2022-04-13 12:28:49 +02:00
Zuul
411c2ddc8c Merge "Fix logic in routers_info" 2022-04-12 19:38:10 +00:00
Jakob Meng
41ad425d23 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:41 +00:00
Arx Cruz
c075126ebd 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-05 15:25:13 +02:00
Arx Cruz
1ec9afe2ca Changed compute_flavor_info module to use OpenStack SDK's proxy layer
Change-Id: Idad13228efe55b2dd35224cc37c61657590f9b8e
2022-04-05 13:53:06 +02:00
Arx Cruz
ffa826c0d0 Updated return value docs of compute_service_info module
We do no longer return computed values here. Note, this breaks backward
compatibility because we do no longer return the location attribute.
It was never documenteed anyway.

Change-Id: I11af9486a6a284d1756380548fca22435c43765a
2022-04-04 11:37:08 +02:00
Jakob Meng
4c3dfec59d 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 08:30:33 +00:00
Ümit Seren
453601bde2 Add subnet pool module
Change-Id: Ib8b5481a1e257490f2a9ff62659a70ea2e920304
2022-03-31 20:05:06 +00:00
Gaudenz Steinlin
bf2c20f590 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 13:48:59 +00:00
Jakob Meng
a03dd05465 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:35:16 +00:00
Sagi Shnaidman
b376e3e146 Fix ansible-lint issues for newest version
Change-Id: I8238b5d5e49c2a4a8ed3228de23349092c9e1220
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2022-03-29 18:51:04 +00:00
Jakob Meng
938abd0d84 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 13:20:41 +00:00
Jakob Meng
749f04bcfb 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 07:32:06 +00:00
Jakob Meng
27e113780f 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 11:56:38 +00:00
Jakob Meng
19b05f689c 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 09:11:06 +00:00
Jakob Meng
d44915caba Synchronized galaxy.yml and galaxy.yml.in files
Change-Id: Ic93a0d1f93e2d86358085c7442ad73d52b9a55ba
(cherry picked from commit 26bc8a0666)
2022-03-25 19:49:55 +00:00
Jakob Meng
e2ee2d0f5d 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 20:07:07 +00:00
Jakob Meng
771fb68f99 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
(cherry picked from commit 8708167b5f)
2022-03-24 15:46:20 +00:00
Kevin Carter
c6892c83c9 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 12:55:27 +00:00
Jakob Meng
5b53433348 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
2022-03-24 12:22:38 +01:00
Jakob Meng
7b26b82890 Synchronized Zuul CI configuration across all branches
A unified .zuul.yaml file allows for easier cherry-picking of
patches for Zuul CI jobs across branches.

Change-Id: Iafea23e6be3bbe82a6e71e52b78509a4908a4580
2022-03-23 15:18:24 +01:00
Jakob Meng
e28ab9acec Dropped redundant job *-new_sdk
Dropped job ansible-collections-openstack-functional-devstack-ansible-\
new_sdk because its a duplicate of job ansible-collections-openstack-\
functional-devstack-ansible-2.12.

Change-Id: Ide63ac659f07f90cc1663a8f6409f72eb0ae05fa
2022-03-22 11:50:13 +01:00
Zuul
cc604d354c Merge "Bump devel version to 2.0.0-dev in master" 2022-03-21 13:15:27 +00:00
Jakob Meng
7820d9ca60 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-21 11:19:52 +01:00
anbanerj
aae539ac8c 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:36 +00:00
Will Szumski
5f1ffe2b99 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-17 19:36:38 +00:00
Jakob Meng
a162a02536 Added warning about the upcoming release and its breaking changes
Change-Id: I729df817e9893abb483d7397359e23026adbb4ff
2022-03-15 15:30:12 +01:00
Zuul
2e89bbe609 Merge "Fix assertion after stack deletion" 2022-03-14 13:53:34 +00:00
Zuul
187a578842 Merge "Router: Remove unneeded 'filter' parameter" 2022-03-14 12:27:30 +00:00
Jakob Meng
61e20bb945 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:54:08 +01:00
Jakob Meng
879270aa47 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:13:35 +00:00
Sagi Shnaidman
5bc179a978 Bump devel version to 2.0.0-dev in master
Change-Id: Iea3b74d691e8d5c47ced9463560fb9546d7752b7
2022-03-10 13:44:26 +02:00
Zuul
8147294a7a Merge "Revert changes to Zuul config which accidentally got merged from stable branch" 2022-03-09 21:21:15 +00:00
Jakob Meng
002e55e269 Revert changes to Zuul config which accidentally got merged from stable branch
Change-Id: I83958370433e3fd5161170032e4adf08a812af72
2022-03-09 21:34:01 +01:00
Sagi Shnaidman
52246bb610 Fix docs for openstack fragment
Change-Id: I7fef01dbd11137e26d3ff0bd0088dc405559b272
2022-03-09 22:20:40 +02:00
Zuul
99e2e2cee6 Merge "Release 1.7.1 version" 2022-03-09 19:42:22 +00:00
Jakob Meng
b640e6207c Release 1.7.1 version
Change-Id: I958ba6890a54c59e0ccdb9249d959c745acfb8e9
2022-03-09 20:17:52 +01: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
Jan Weiher
ea2ee76a88 Router: Remove unneeded 'filter' parameter
Change-Id: If46916e3480fced3be919c6d39b82a6c64321065
2022-03-09 15:05:36 +01:00
Zuul
9d0e5dd1db Merge "[LB] Add support for setting monitor_address" 2022-03-09 13:57:41 +00:00
Zuul
08bbadedb0 Merge "Add support for system role in role assignment" 2022-03-08 19:35:48 +00:00
Sagi Shnaidman
3c7a8f39a2 Fix inventory plugin doc for new ansible
Change-Id: I8bd8767d2ac0117e03c9b23882494d45847b15cf
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2022-03-08 13:40:21 +02:00
James Kirsch
aa22867536 Add support for system role in role assignment
Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/826193
Change-Id: I831f98d9e8032624877cd4835a1698f948d75ee2
2022-03-07 11:05:22 -08:00
Jan Weiher
37a51ec6ad [LB] Add support for setting monitor_address
Change-Id: I4897c6343813519859bd19fa162829fe2a6dc573
2022-03-07 13:59:35 +01: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
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
340 changed files with 33044 additions and 15479 deletions

View File

@@ -1,45 +1,119 @@
# 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/.*
- contrib/.*
- .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-octavia
parent: ansible-collections-openstack-functional-devstack
name: ansible-collections-openstack-functional-devstack
parent: ansible-collections-openstack-functional-devstack-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
with Octavia plugin enabled, using releases of openstacksdk and latest
ansible release. Run it only on Load Balancer changes.
pre-run: ci/playbooks/get_amphora_tarball.yaml
using master of openstacksdk with latest ansible release
- 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
- name: github.com/ansible/ansible
override-checkout: stable-2.11
files:
- ^ci/roles/loadbalancer/.*$
- ^plugins/modules/lb_health_monitor.py
@@ -48,7 +122,12 @@
- ^plugins/modules/lb_pool.py
- ^plugins/modules/loadbalancer.py
vars:
tox_envlist: ansible
configure_swap_size: 4096
devstack_local_conf:
post-config:
$OCTAVIA_CONF:
controller_worker:
amphora_driver: amphora_noop_driver
devstack_plugins:
designate: https://opendev.org/openstack/designate
octavia: https://opendev.org/openstack/octavia
@@ -57,27 +136,37 @@
octavia: true
o-api: true
o-cw: true
o-hk: true
o-hm: true
devstack_localrc:
OCTAVIA_AMP_IMAGE_FILE: "/tmp/test-only-amphora-x64-haproxy-ubuntu-bionic.qcow2"
OCTAVIA_AMP_IMAGE_SIZE: 3
OCTAVIA_AMP_IMAGE_NAME: "test-only-amphora-x64-haproxy-ubuntu-bionic"
o-hk: true
neutron-dns: true
tox_extra_args: -vv --skip-missing-interpreters=false -- loadbalancer
tox_install_siblings: false
- job:
name: ansible-collections-openstack-functional-devstack-octavia
parent: ansible-collections-openstack-functional-devstack-octavia-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
with Octavia plugin enabled, using latest releases of openstacksdk
and latest ansible release. Run it only on Load Balancer changes.
- job:
name: ansible-collections-openstack-functional-devstack-releases
parent: ansible-collections-openstack-functional-devstack
parent: ansible-collections-openstack-functional-devstack-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
using releases of openstacksdk and latest ansible release
using latest releases of openstacksdk and latest ansible release
vars:
tox_envlist: ansible
tox_constraints_file: '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/constraints-openstacksdk-1.x.x.txt'
tox_install_siblings: false
# 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
parent: ansible-collections-openstack-functional-devstack-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk and stable 2.9 branch of ansible
@@ -85,214 +174,89 @@
- name: github.com/ansible/ansible
override-checkout: stable-2.9
vars:
tox_envlist: ansible-2.9
tox_envlist: ansible_2_9
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.11
parent: ansible-collections-openstack-functional-devstack
parent: ansible-collections-openstack-functional-devstack-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk and stable 2.11 branch of ansible
using master of openstacksdk and stable 2.12 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
vars:
tox_envlist: ansible
tox_envlist: ansible_2_11
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.12
parent: ansible-collections-openstack-functional-devstack-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk and stable 2.12 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.12
vars:
tox_envlist: ansible_2_12
- job:
name: ansible-collections-openstack-functional-devstack-ansible-devel
parent: ansible-collections-openstack-functional-devstack
parent: ansible-collections-openstack-functional-devstack-base
nodeset: openstack-single-node-jammy
branches: master
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk and devel branch of ansible
voting: false
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
vars:
tox_envlist: ansible-2.11
# Stable branches tests
- job:
name: ansible-collections-openstack-functional-devstack-wallaby-ansible-2.11
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a wallaby devstack
using wallaby brach of openstacksdk and stable 2.11 branch of ansible
voting: true
override-checkout: stable/wallaby
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- name: openstack/openstacksdk
override-checkout: stable/wallaby
vars:
tox_envlist: ansible
- job:
name: ansible-collections-openstack-functional-devstack-victoria-ansible-2.11
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a victoria devstack
using victoria brach of openstacksdk and stable 2.11 branch of ansible
voting: true
override-checkout: stable/victoria
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- name: openstack/openstacksdk
override-checkout: stable/victoria
vars:
tox_envlist: ansible
- job:
name: ansible-collections-openstack-functional-devstack-ussuri-ansible-2.11
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a ussuri devstack
using ussuri brach of openstacksdk and stable 2.11 branch of ansible
voting: true
override-checkout: stable/ussuri
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- name: openstack/openstacksdk
override-checkout: stable/ussuri
- name: openstack/os-client-config
override-checkout: stable/ussuri
vars:
tox_envlist: ansible
- job:
name: ansible-collections-openstack-functional-devstack-train-ansible-2.11
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.11 branch of ansible
override-checkout: stable/train
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- name: openstack/openstacksdk
override-checkout: stable/train
- name: openstack/os-client-config
override-checkout: stable/train
vars:
tox_envlist: ansible
- job:
name: ansible-collections-openstack-functional-devstack-queens-ansible-2.11
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a queens devstack
using master branch of openstacksdk and stable 2.11 branch of ansible
voting: true
override-checkout: stable/queens
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- name: openstack/openstacksdk
# Run queens with highest possible py2 version of SDK
override-checkout: stable/train
vars:
tox_envlist: ansible
- job:
name: ansible-collections-openstack-functional-devstack-queens-ansible-devel
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a queens devstack
using master branch of openstacksdk and devel branch of ansible
voting: false
override-checkout: stable/queens
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
- name: openstack/openstacksdk
# Run queens with highest possible py2 version of SDK
override-checkout: stable/train
vars:
tox_envlist: ansible-2.11
# Experimental pipeline jobs
- job:
name: ansible-collections-openstack-functional-devstack-stein-ansible-2.11
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.11 branch of ansible
voting: true
override-checkout: stable/stein
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- name: openstack/openstacksdk
override-checkout: stable/stein
- name: openstack/os-client-config
override-checkout: stable/stein
vars:
tox_envlist: ansible
- job:
name: ansible-collections-openstack-functional-devstack-rocky-ansible-2.11
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.11 branch of ansible
voting: true
override-checkout: stable/rocky
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- name: openstack/openstacksdk
override-checkout: stable/rocky
- name: openstack/os-client-config
override-checkout: stable/rocky
- name: openstack/shade
override-checkout: stable/rocky
vars:
tox_envlist: ansible
# Linters
- job:
name: openstack-tox-linters-ansible-devel
parent: openstack-tox-linters
nodeset: ubuntu-bionic
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:
tox_envlist: linters-2.11
# Linters
- job:
name: openstack-tox-linters-ansible-2.11
name: openstack-tox-linters-ansible
parent: openstack-tox-linters
nodeset: ubuntu-bionic
description: |
Run openstack collections linter tests using the 2.11 branch of ansible
voting: true
Run openstack collections linter tests using the devel branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
override-checkout: devel
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-2.9
parent: openstack-tox-linters
nodeset: ubuntu-bionic
name: openstack-tox-linters-ansible-devel
parent: openstack-tox-linters-ansible
nodeset: ubuntu-jammy
description: |
Run openstack collections linter tests using the 2.9 branch of ansible
voting: true
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
vars:
python_version: '3.10'
bindep_profile: test py310
- job:
name: openstack-tox-linters-ansible-2.12
parent: openstack-tox-linters-ansible
nodeset: ubuntu-focal
description: |
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:
tox_envlist: linters-2.9
ensure_tox_version: '<4'
tox_envlist: linters_2_12
python_version: 3.8
bindep_profile: test py38
# Cross-checks with other projects
- job:
@@ -300,159 +264,87 @@
parent: bifrost-integration-tinyipa-ubuntu-focal
required-projects:
- openstack/ansible-collections-openstack
- # always use master branch when collecting parent job variants, refer to git blame for rationale.
name: openstack/bifrost
override-checkout: master
- # always use master branch when collecting parent job variants
name: openstack/openstacksdk
override-checkout: master
- job:
name: bifrost-keystone-collections-src
parent: bifrost-integration-tinyipa-keystone-ubuntu-focal
required-projects:
- openstack/ansible-collections-openstack
- # always use master branch when collecting parent job variants, refer to git blame for rationale.
name: openstack/bifrost
override-checkout: master
- # always use master branch when collecting parent job variants
name: openstack/openstacksdk
override-checkout: master
# TripleO jobs
- job:
name: tripleo-ci-centos-8-standalone-osa
parent: tripleo-ci-centos-8-standalone
vars:
consumer_job: false
build_container_images: true
# Run only on files used in TripleO
files: &ooo_files
- ^plugins/modules/catalog_service.*$
- ^plugins/modules/endpoint.*$
- ^plugins/modules/identity_domain.*$
- ^plugins/modules/identity_domain_info.*$
- ^plugins/modules/identity_role.*$
- ^plugins/modules/identity_user.*$
- ^plugins/modules/keypair.*$
- ^plugins/modules/project.*$
- ^plugins/modules/role_assignment.*$
- ^plugins/modules/stack.*$
- ^plugins/module_utils/openstack.*$
- job:
name: tripleo-ci-centos-8-standalone-train-osa
parent: tripleo-ci-centos-8-standalone-osa
voting: false
override-checkout: stable/train
vars:
branch_override: stable/train
- job:
name: ansible-collections-openstack-release
parent: base
run: ci/publish/publish_collection.yml
secrets:
- ansible_galaxy_info
- secret:
name: ansible_galaxy_info
data:
url: https://galaxy.ansible.com
token: !encrypted/pkcs1-oaep
- lZFzfoCbuwqV1k6qRfl/VS7E+knUW7+zpg7BptrenK4n0g7UY0HtdVkYq0pV0Tj/LbhzG
jHD0mehcV1iS6B7ORKg4criJkdDfEx09BD8z8yv0EleiIMmhlrCoMcY593OZMBtVbGi0D
CwQtNO98QIsfZogChfLfvRNiBmUV98mEb/p6p3EtGx8J7qcAsqfWxc/CzB8GCleLAHHHT
FuikMM03ZnV0ew7E+TPkHbzzPhBZOqS5HYF0HtgttHwIXdfIWp/XdTuEEk7uRRgYZ2Iao
ifWRzoKaOQmhM++e1ydCqw9D4y9dZEFNMQLwSqcrvtb8cNwT1kl7SCFqYNE2lbutj4ne6
PTBQRsKegMB4Y3ena14fNF6tCynvJLPhF/cjPH2Jhs+B19XQhWkL3TgiOY02W24YHwRcP
+LdkM8inAvyVi3DEbEqdjBPO9OFJcBOKPlCdkGvuwdNCuEpEwctWs0gV3voflG2CDKzmJ
wu9JJOAWnq/0l1WpuDqWreKeQ/BUGZC2Gb4xRAqofulgvhs4WuYoEccjH4EJFIZ90S1EP
R/ZLadqZaEhmjwGM5sMWbBbjT23XsRgg0Tzt9m8DENYMuYDqkMdRbt2jYZa+32p4hyxVe
Y6H/pqYq5b9uOzumnShaK4WlmkQyXcNPkoSlMC1h4OGvqX/WUixpI38jyMA5Tc=
- project:
check:
jobs:
- tox-pep8
- openstack-tox-linters-ansible-devel
- openstack-tox-linters-ansible-2.11
- openstack-tox-linters-ansible-2.9
- ansible-collections-openstack-functional-devstack:
dependencies: &deps_unit_lint
- tox-pep8
- openstack-tox-linters-ansible-2.9
- openstack-tox-linters-ansible-2.11
# - openstack-tox-linters-ansible-devel
# - openstack-tox-linters-ansible-2.12
# - ansible-collections-openstack-functional-devstack:
# dependencies: &deps_unit_lint
# - tox-pep8
# - openstack-tox-linters-ansible-2.12
- ansible-collections-openstack-functional-devstack-releases:
dependencies: *deps_unit_lint
- ansible-collections-openstack-functional-devstack-ansible-2.9:
dependencies: *deps_unit_lint
- ansible-collections-openstack-functional-devstack-ansible-2.11:
dependencies: *deps_unit_lint
- ansible-collections-openstack-functional-devstack-ansible-devel:
dependencies: *deps_unit_lint
- ansible-collections-openstack-functional-devstack-wallaby-ansible-2.11:
dependencies: *deps_unit_lint
- ansible-collections-openstack-functional-devstack-victoria-ansible-2.11:
dependencies: *deps_unit_lint
- ansible-collections-openstack-functional-devstack-ussuri-ansible-2.11:
dependencies: *deps_unit_lint
- ansible-collections-openstack-functional-devstack-train-ansible-2.11:
dependencies: *deps_unit_lint
- ansible-collections-openstack-functional-devstack-queens-ansible-2.11:
dependencies: *deps_unit_lint
voting: false
- ansible-collections-openstack-functional-devstack-octavia:
dependencies: *deps_unit_lint
# - ansible-collections-openstack-functional-devstack-releases:
# dependencies: *deps_unit_lint
# - ansible-collections-openstack-functional-devstack-ansible-2.9:
# dependencies: *deps_unit_lint
# - ansible-collections-openstack-functional-devstack-ansible-2.12:
# dependencies: *deps_unit_lint
# - ansible-collections-openstack-functional-devstack-ansible-devel:
# dependencies: *deps_unit_lint
# - ansible-collections-openstack-functional-devstack-magnum:
# dependencies: *deps_unit_lint
# - ansible-collections-openstack-functional-devstack-octavia:
# dependencies: *deps_unit_lint
- bifrost-collections-src:
voting: false
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- bifrost-keystone-collections-src:
voting: false
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- tripleo-ci-centos-8-standalone-osa:
dependencies: *deps_unit_lint
- tripleo-ci-centos-8-standalone-train-osa:
voting: false
dependencies: *deps_unit_lint
# - bifrost-collections-src:
# voting: false
# dependencies: *deps_unit_lint
# irrelevant-files: *ignore_files
# - bifrost-keystone-collections-src:
# voting: false
# dependencies: *deps_unit_lint
# irrelevant-files: *ignore_files
gate:
jobs:
- tox-pep8
- openstack-tox-linters-ansible-2.11
- openstack-tox-linters-ansible-2.9
- ansible-collections-openstack-functional-devstack
- ansible-collections-openstack-functional-devstack-releases
- ansible-collections-openstack-functional-devstack-ansible-2.9
- ansible-collections-openstack-functional-devstack-ansible-2.11
- ansible-collections-openstack-functional-devstack-wallaby-ansible-2.11
- ansible-collections-openstack-functional-devstack-victoria-ansible-2.11
- ansible-collections-openstack-functional-devstack-ussuri-ansible-2.11
- ansible-collections-openstack-functional-devstack-train-ansible-2.11
# - ansible-collections-openstack-functional-devstack-queens-ansible-2.11
- ansible-collections-openstack-functional-devstack-octavia
- tripleo-ci-centos-8-standalone-osa
# - openstack-tox-linters-ansible-2.12
# - ansible-collections-openstack-functional-devstack
# - ansible-collections-openstack-functional-devstack-releases
# - ansible-collections-openstack-functional-devstack-ansible-2.9
# - ansible-collections-openstack-functional-devstack-ansible-2.12
# - ansible-collections-openstack-functional-devstack-magnum
# - ansible-collections-openstack-functional-devstack-octavia
periodic:
jobs:
- openstack-tox-linters-ansible-devel
- openstack-tox-linters-ansible-2.11
- openstack-tox-linters-ansible-2.9
- ansible-collections-openstack-functional-devstack
- ansible-collections-openstack-functional-devstack-releases
- ansible-collections-openstack-functional-devstack-ansible-2.9
- ansible-collections-openstack-functional-devstack-ansible-2.11
- ansible-collections-openstack-functional-devstack-ansible-devel
- ansible-collections-openstack-functional-devstack-wallaby-ansible-2.11
- ansible-collections-openstack-functional-devstack-victoria-ansible-2.11
- ansible-collections-openstack-functional-devstack-ussuri-ansible-2.11
- ansible-collections-openstack-functional-devstack-train-ansible-2.11
- ansible-collections-openstack-functional-devstack-queens-ansible-2.11
- ansible-collections-openstack-functional-devstack-queens-ansible-devel
- bifrost-collections-src
- bifrost-keystone-collections-src
- ansible-collections-openstack-functional-devstack-octavia
# periodic:
# jobs:
# - openstack-tox-linters-ansible-devel
# - openstack-tox-linters-ansible-2.12
# - ansible-collections-openstack-functional-devstack
# - ansible-collections-openstack-functional-devstack-releases
# - ansible-collections-openstack-functional-devstack-ansible-2.9
# - ansible-collections-openstack-functional-devstack-ansible-2.12
# - ansible-collections-openstack-functional-devstack-ansible-devel
# - 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-stein-ansible-2.11
- ansible-collections-openstack-functional-devstack-rocky-ansible-2.11
- ansible-collections-openstack-functional-devstack-queens-ansible-devel
# experimental:
# jobs:
# - ansible-collections-openstack-functional-devstack-ansible-2.11
pre-release:
jobs:
- ansible-collections-openstack-release
# tag:
# jobs:
# - ansible-collections-openstack-release

View File

@@ -1,10 +1,293 @@
=============================================
Openstack Cloud Ansilbe modules Release Notes
=============================================
==========================================
Ansible OpenStack Collection Release Notes
==========================================
.. contents:: Topics
v2.2.0
======
Release Summary
---------------
New module for volume_type and bugfixes
Minor Changes
-------------
- Add volume_encryption_type modules
- Add volume_type modules
Bugfixes
--------
- Fix image module filter
- Fix port module idempotency
- Fix router module idempotency
v2.1.0
======
Release Summary
---------------
New module for Ironic and bugfixes
Minor Changes
-------------
- Add baremetal_deploy_template module
- Highlight our mode of operation more prominently
Bugfixes
--------
- Change security group rules only when instructed to do so
- Fix for AttributeError: 'dict' object has no attribute 'status'
- Fix issue with multiple records in recordset
- Fix mistake in compute_flavor_access notes
- Fixed private option in inventory plugin
- Respect description option and delete security group rules first
- Use true and false instead of yes and no for boolean values
v2.0.0
======
Release Summary
---------------
Our new major release 2.0.0 of the Ansible collection for OpenStack clouds aka ``openstack.cloud`` is a complete overhaul of the code base and brings full compatibility with openstacksdk 1.0.0.
Highlights of this release are
* three new modules which for example provide a generic and uniform API for interacting with OpenStack cloud resources,
* a complete refactoring of all existing modules bringing dozens of bugfixes, new features as well as consistent
and properly documented module results and options,
* 100% compatibility with openstacksdk's first major release 1.0.0,
* new guides for contributors from devstack setup over coding guidelines to our release process and
* massively increased CI coverage with many new integration tests, now covering all modules and plugins.
Note, this ``2.0.0`` release *breaks backward compatibility* with previous ``1.x.x`` releases!
* ``2.x.x`` releases of this collection are compatible with openstacksdk ``1.x.x`` and later *only*,
* ``1.x.x`` releases of this collection are compatible with openstacksdk ``0.x.x`` prior to ``0.99.0`` *only*,
* ``2.x.x`` releases of are not backward compatible with ``1.x.x`` releases,
* ``1.x.x`` release series will be in maintenance mode now and receive bugfixes only.
However, this collection as well as openstacksdk continue to be backward compatible with clouds running on older OpenStack releases. For example, it is fine and a fully supported use case to use this 2.0.0 release with clouds based on OpenStack Train, Wallaby or Zed. Feel encouraged to always use the latest releases of this collection and openstacksdk regardless of which version of OpenStack is installed in your cloud.
This collection is compatible with and tested with Ansible 2.9 and later. However, support for old ``os_*`` short module names such as ``os_server`` have been dropped with this release. You have to call modules using their FQCN (Fully-Qualified Collection Name) such as ``openstack.cloud.server`` instead.
Many thanks to all contributors who made this release possible. Tens of thousands LOCs have been reviewed and changed and fixed and tested throughout last year. You rock!
Major Changes
-------------
- Many modules gained support for Ansible's check mode or have been fixed to properly implement a no change policy during check mode runs.
- Many modules gained support for updates. In the past, those modules allowed to create and delete OpenStack cloud resources but would ignore when module options had been changed.
- Many modules such as ``openstack.cloud.server``, ``openstack.cloud.baremetal_node`` and all load-balancer related modules now properly implement the ``wait`` option. For example, when ``wait`` is set to ``true`` then modules will not return until resources have reached its ``active`` or ``deleted`` state.
- Module ``openstack.cloud.resource`` has been added. It provides an generic and uniform interface to create, update and delete any OpenStack cloud resource which openstacksdk supports. This module unlocks a huge amount of functionality from OpenStack clouds to Ansible users which has been inaccessible with existing modules so far.
- Module ``openstack.cloud.resources`` has been added. It provides an generic and uniform interface to list any type of OpenStack cloud resources which openstacksdk supports. This module fetch any OpenStack cloud resource without having to implement a new Ansible ``*_info`` module for this type of resource first.
- Module ``openstack.cloud.subnet_pool`` has been added. It allows to create and delete subnet pools in OpenStack clouds.
- Module examples have been improved and updated for most modules.
- Module results have been properly documented for all modules.
- Options in all modules have been renamed to match openstacksdk's attribute names (if applicable). The previous option names have been added as aliases to keep module options backward compatible.
- Our CI integration tests have been massively expanded. Our test coverage spans across all modules and plugins now, including tests for our inventory plugin and our new ``openstack.cloud.resource`` and ``openstack.cloud.resources`` modules.
- Our contributors documentation has been heavily extended. In directory ``docs`` you will find the rationale for our branching strategy, a developer's guide on how to contribute to the collection, a tutorial to set up a DevStack environment for hacking on and testing the collection, a step-by-step guide for publishing new releases and a list of questions to ask when doing reviews or submitting patches for review.
Minor Changes
-------------
- Added generic module options ``sdk_log_path`` and ``sdk_log_level`` which allow to track openstacksdk activity.
- Many more options were added to modules but we stopped counting at one point...
- Module ``openstack.cloud.coe_cluster`` gained support for option ``is_floating_ip_enabled``.
- Module ``openstack.cloud.lb_listener`` gained options ``default_tls_container_ref`` and ``sni_container_refs`` which allow to specify TLS certificates when using the ``TERMINATED_HTTPS`` protocol.
- Module ``openstack.cloud.network`` gained support for updates, i.e. existing networks will be properly updated now when module options such as ``mtu`` or ``admin_state_up`` have been changed.
- Module ``openstack.cloud.port`` gained an ``description`` option.
- Module ``openstack.cloud.role_assignment`` gained an ``system`` option.
- Module ``openstack.cloud.security_group_rule`` gained an ``description`` option.
- Module ``openstack.cloud.server_action`` gained an option ``all_projects`` which allows to execute actions on servers outside of the current auth-scoped project (if the user has permission to do so).
- Module ``openstack.cloud.server_info`` gained an ``description`` option.
- Module ``openstack.cloud.server`` gained an ``description`` option.
- Module ``openstack.cloud.server`` gained support for updates. For example, options such as ``description`` and floating ip addresses can be updated now.
- Module ``openstack.cloud.subnet`` gained an ``subnet_pool`` option.
Breaking Changes / Porting Guide
--------------------------------
- 2.x.x releases of this collection are not backward compatible with 1.x.x releases. Backward compatibility is guaranteed within each release series only. Module options have been kept backward compatible across both release series, apart from a few exceptions noted below. However, module results have changed for most modules due to deep changes in openstacksdk. For easier porting and usage, we streamlined return values across modules and documented return values of all modules.
- Default value for option ``security_groups`` in ``openstack.cloud.server`` has been changed from ``['default']`` to ``[]`` because the latter is the default in python-openstackclient and the former behavior causes issues with existing servers.
- Dropped symbolic links with prefix ``os_`` and plugin routing for deprecated ``os_*`` module names. This means users have to call modules of the Ansible OpenStack collection using their FQCN (Fully Qualified Collection Name) such as ``openstack.cloud.server``. Short module names such as ``os_server`` will now raise an Ansible error.
- Module ``openstack.cloud.project_access`` has been split into two separate modules ``openstack.cloud.compute_flavor_access`` and ``openstack.cloud.volume_type_access``.
- Option ``availability_zone`` has been removed from the list of generic options available in all modules. Instead it has been inserted into the ``openstack.cloud.server`` and ``openstack.cloud.volume`` modules because it is relevant to those two modules only.
- Option ``name`` of module ``openstack.cloud.port`` is required now because it is used to find, update and delete ports and idempotency would break otherwise.
- Option ``policies`` has been replaced with option ``policy`` in module ``openstack.cloud.server_group``. The former is ancient and was superceded by ``policy`` a long time ago.
- Release series 2.x.x of this collection is compatible with openstacksdk 1.0.0 and later only. For compatibility with openstacksdk < 0.99.0 use release series 1.x.x of this collection. Ansible will raise an error when modules and plugins in this collection are used with an incompatible release of openstacksdk.
- Special value ``auto`` for option ``id`` in module ``openstack.cloud.compute_flavor`` has been deprecated to be consistent with our other modules and openstacksdk's behaviour.
Deprecated Features
-------------------
- Option ``is_public`` in module ``openstack.cloud.image`` has been deprecated and replaced with option ``visibility``.
- Option ``volume`` in module ``openstack.cloud.image`` has been deprecated and it should be replaced with module ``openstack.cloud.volume`` in user code.
Removed Features (previously deprecated)
----------------------------------------
- Dropped deprecated ``skip_update_of_driver_password`` option from module ``openstack.cloud.baremetal_node``.
- Dropped unmaintained, obsolete and broken inventory script ``scripts/inventory/openstack_inventory.py``. It had been replaced with a proper Ansible inventory plugin ``openstack.cloud.openstack`` during the 1.x.x life cycle.
- Module ``openstack.cloud.object`` no longer allows to create and delete containers, its sole purpose is managing an object in a container now. Use module ``openstack.cloud.object_container`` to managing Swift containers instead.
- Option ``listeners`` has been removed from module ``openstack.cloud.loadbalancer`` because it duplicates a subset of the functionality (and code) provided by our ``openstack.cloud.lb_{listener,member,pool}`` modules.
- Our outdated, undocumented, untested and bloated code templates in ``contrib`` directory which could be used to generate and develop new Ansible modules for this collection have been removed.
Bugfixes
--------
- Ansible check mode has been fixed in module ``openstack.cloud.compute_flavor``, it will no longer apply changes when check mode is enabled.
- Creating load-balancers with module ``openstack.cloud.loadbalancer`` properly handles situations where several provider networks exist. A floating ip address specified in option ``floating_ip_address`` will be allocated from Neutron external network specified in option ``floating_ip_network``.
- Default values for options ``shared``, ``admin_state_up`` and ``external`` in module ``openstack.cloud.network`` have been dropped because they cause failures for clouds which do not have those optional extensions installed.
- Dropped default values for options ``min_disk`` and ``min_ram`` in module ``openstack.cloud.image`` because it interferes with its update mechanism and Glance uses those values anyway. Fixed handling of options ``name``, ``id``, ``visibility`` and ``is_public``.
- Module ``openstack.cloud.baremetal_node_info`` will now properly return machine details when iterating over all available baremetal nodes.
- Module ``openstack.cloud.host_aggregate`` now correctly handles ``hosts`` not being set or being set to ``None``.
- Module ``openstack.cloud.identity_user`` will no longer fail when no password is supplied since Keystone allows to create a user without an password.
- Module ``openstack.cloud.keypair`` no longer removes trailing spaces when reading a public key because this broke idempotency when using openstackclient and this module at the same time.
- Module ``openstack.cloud.quota`` no longer sends invalid attributes such as ``project_id`` to OpenStack API when updating Nova, Neutron and Cinder quotas.
- Module ``openstack.cloud.server`` will no longer change security groups to ``['default']`` on existing servers when option ``security_groups`` has not been specified.
- Module ``openstack.cloud.subnet`` now properly handles updates, thus idempotency has been fixed and restored.
- Modules ``openstack.cloud.security_group`` and ``openstack.cloud.security_group_rule`` gained support for specifying string ``any`` as a valid protocol in security group rules.
- Option ``interfaces`` in module ``openstack.cloud.router`` no longer requires option ``network`` to be set, it is ``external_fixed_ips`` what requires ``network``.
- Option ``is_public`` in module ``openstack.cloud.image`` will now be handled as a boolean instead of a string to be compatible to Glance API and fix issues when interacting with Glance service.
- Option ``network`` in module ``openstack.cloud.router`` is now propery marked as required by options ``enable_snat`` and ``external_fixed_ips``.
- Option ``owner`` in module ``openstack.cloud.image`` is now respected when searching for and creating images.
- Our OpenStack inventory plugin now properly supports Ansible's cache feature.
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
======
@@ -74,9 +357,9 @@ Bugfixes
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
- openstack.cloud.address_scope - Create or delete address scopes from OpenStack
v1.4.0
======

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

228
README.md
View File

@@ -1,61 +1,84 @@
[![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.
**NOTE:** We need and value your contributions! Maintaining this collection is a community effort. We are all both users
and developers of this collection at the same time. If you find a bug, please report it. If you have fixed a bug, please
submit a patch. If you need new functionality which is not covered by this collection yet, please extend an existing
module or submit a new one. Our [Contributing](#contributing) section below has tons of docs to check out. Please get in
touch!
The collection includes the Openstack modules and plugins supported by Openstack community to help the management of Openstack infrastructure.
## Branches and Non Backward Compatibility ⚠️
## Installation and Usage
Our codebase has been split into two separate release series, `2.x.x` and `1.x.x`:
### Installing dependencies
* `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 ⚠️
For using the Openstack Cloud collection firstly you need to install `ansible` and `openstacksdk` Python modules on your Ansible controller.
For example with pip:
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!
```bash
pip install ansible openstacksdk
[openstacksdk]: https://opendev.org/openstack/openstacksdk
## Installation
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>=1.0.0"
```
OpenStackSDK has to be available to Ansible and to the Python interpreter on the host, where Ansible executes the module (target host).
Please note, that under some circumstances Ansible might invoke a non-standard Python interpreter on the target host.
Using Python version 3 is highly recommended for OpenstackSDK and strongly required from OpenstackSDK version 0.39.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.
#### NOTE
Before using this collection, you have to install it with `ansible-galaxy`:
OpenstackSDK is better to be the last stable version. It should NOT be installed on Openstack nodes,
but rather on operators host (aka "Ansible controller"). OpenstackSDK from last version supports
operations on all Openstack cloud versions. Therefore OpenstackSDK module version doesn't have to match
Openstack cloud version usually.
```sh
ansible-galaxy collection install openstack.cloud
```
---
### Installing the Collection from Ansible Galaxy
Before using the Openstack Cloud collection, you need to install the collection with the `ansible-galaxy` CLI:
`ansible-galaxy collection install openstack.cloud`
You can also include it in a `requirements.yml` file and install it through `ansible-galaxy collection install -r requirements.yml` using the format:
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 the Openstack Cloud collection, please reference the full namespace, collection name, and module name that you want to use:
```sh
ansible-galaxy collection install -r requirements.yml
```
## Usage
To use a module from the Ansible OpenStack collection, call them by their Fully Qualified Collection Name (FQCN),
composed of their namespace, collection name and module name:
```yaml
---
- name: Using Openstack Cloud collection
hosts: localhost
- hosts: localhost
tasks:
- openstack.cloud.server:
- name: Create server in an OpenStack cloud
openstack.cloud.server:
name: vm
state: present
cloud: openstack
@@ -70,12 +93,12 @@ Or you can add the full namespace and collection name in the `collections` eleme
```yaml
---
- name: Using Openstack Cloud collection
hosts: localhost
- hosts: localhost
collections:
- openstack.cloud
tasks:
- server_volume:
- name: Create server in an OpenStack cloud
server_volume:
state: present
cloud: openstack
server: Mysql-server
@@ -83,41 +106,126 @@ Or you can add the full namespace and collection name in the `collections` eleme
device: /dev/vdb
```
For powerful generic [CRUD][crud]-style resource management use Ansible module
[`openstack.cloud.resource`](plugins/modules/resource.py):
```yaml
---
- hosts: localhost
tasks:
- name: Create security group
openstack.cloud.resource:
cloud: openstack
service: network
type: security_group
attributes:
name: ansible_security_group
description: 'ansible security group'
- name: Update security group description
openstack.cloud.resource:
cloud: openstack
service: network
type: security_group
attributes:
name: ansible_security_group
description: 'ansible neutron security group'
- name: Delete security group
openstack.cloud.resource:
cloud: openstack
service: network
type: security_group
attributes:
name: ansible_security_group
state: absent
```
For generic resource listing use Ansible module [`openstack.cloud.resources`](plugins/modules/resources.py):
```yaml
---
- hosts: localhost
tasks:
- name: List images
openstack.cloud.resources:
cloud: openstack
service: image
type: image
- name: List compute flavors
openstack.cloud.resources:
cloud: openstack
service: compute
type: flavor
- name: List networks with name 'public'
openstack.cloud.resources:
cloud: openstack
service: network
type: network
parameters:
name: public
```
[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
[crud]: https://en.wikipedia.org/wiki/CRUD
## 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](https://storyboard.openstack.org/#!/project/openstack/ansible-collections-openstack), 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 [OFTC IRC](https://www.oftc.net/).
We have a Special Interest Group for the Ansible OpenStack collection. Join us in `#openstack-ansible-sig` on
[OFTC IRC](https://www.oftc.net/) 🍪
## 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.

View File

@@ -222,13 +222,307 @@ releases:
- 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: ''
- description: Create or delete address scopes from OpenStack
name: address_scope
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'
2.0.0:
changes:
breaking_changes:
- 2.x.x releases of this collection are not backward compatible with 1.x.x releases.
Backward compatibility is guaranteed within each release series only. Module
options have been kept backward compatible across both release series, apart
from a few exceptions noted below. However, module results have changed for
most modules due to deep changes in openstacksdk. For easier porting and usage,
we streamlined return values across modules and documented return values of
all modules.
- Default value for option ``security_groups`` in ``openstack.cloud.server``
has been changed from ``['default']`` to ``[]`` because the latter is the
default in python-openstackclient and the former behavior causes issues with
existing servers.
- Dropped symbolic links with prefix ``os_`` and plugin routing for deprecated
``os_*`` module names. This means users have to call modules of the Ansible
OpenStack collection using their FQCN (Fully Qualified Collection Name) such
as ``openstack.cloud.server``. Short module names such as ``os_server`` will
now raise an Ansible error.
- Module ``openstack.cloud.project_access`` has been split into two separate
modules ``openstack.cloud.compute_flavor_access`` and ``openstack.cloud.volume_type_access``.
- Option ``availability_zone`` has been removed from the list of generic options
available in all modules. Instead it has been inserted into the ``openstack.cloud.server``
and ``openstack.cloud.volume`` modules because it is relevant to those two
modules only.
- Option ``name`` of module ``openstack.cloud.port`` is required now because
it is used to find, update and delete ports and idempotency would break otherwise.
- Option ``policies`` has been replaced with option ``policy`` in module ``openstack.cloud.server_group``.
The former is ancient and was superceded by ``policy`` a long time ago.
- Release series 2.x.x of this collection is compatible with openstacksdk 1.0.0
and later only. For compatibility with openstacksdk < 0.99.0 use release series
1.x.x of this collection. Ansible will raise an error when modules and plugins
in this collection are used with an incompatible release of openstacksdk.
- Special value ``auto`` for option ``id`` in module ``openstack.cloud.compute_flavor``
has been deprecated to be consistent with our other modules and openstacksdk's
behaviour.
bugfixes:
- Ansible check mode has been fixed in module ``openstack.cloud.compute_flavor``,
it will no longer apply changes when check mode is enabled.
- Creating load-balancers with module ``openstack.cloud.loadbalancer`` properly
handles situations where several provider networks exist. A floating ip address
specified in option ``floating_ip_address`` will be allocated from Neutron
external network specified in option ``floating_ip_network``.
- Default values for options ``shared``, ``admin_state_up`` and ``external``
in module ``openstack.cloud.network`` have been dropped because they cause
failures for clouds which do not have those optional extensions installed.
- Dropped default values for options ``min_disk`` and ``min_ram`` in module
``openstack.cloud.image`` because it interferes with its update mechanism
and Glance uses those values anyway. Fixed handling of options ``name``, ``id``,
``visibility`` and ``is_public``.
- Module ``openstack.cloud.baremetal_node_info`` will now properly return machine
details when iterating over all available baremetal nodes.
- Module ``openstack.cloud.host_aggregate`` now correctly handles ``hosts``
not being set or being set to ``None``.
- Module ``openstack.cloud.identity_user`` will no longer fail when no password
is supplied since Keystone allows to create a user without an password.
- Module ``openstack.cloud.keypair`` no longer removes trailing spaces when
reading a public key because this broke idempotency when using openstackclient
and this module at the same time.
- Module ``openstack.cloud.quota`` no longer sends invalid attributes such as
``project_id`` to OpenStack API when updating Nova, Neutron and Cinder quotas.
- Module ``openstack.cloud.server`` will no longer change security groups to
``['default']`` on existing servers when option ``security_groups`` has not
been specified.
- Module ``openstack.cloud.subnet`` now properly handles updates, thus idempotency
has been fixed and restored.
- Modules ``openstack.cloud.security_group`` and ``openstack.cloud.security_group_rule``
gained support for specifying string ``any`` as a valid protocol in security
group rules.
- Option ``interfaces`` in module ``openstack.cloud.router`` no longer requires
option ``network`` to be set, it is ``external_fixed_ips`` what requires ``network``.
- Option ``is_public`` in module ``openstack.cloud.image`` will now be handled
as a boolean instead of a string to be compatible to Glance API and fix issues
when interacting with Glance service.
- Option ``network`` in module ``openstack.cloud.router`` is now propery marked
as required by options ``enable_snat`` and ``external_fixed_ips``.
- Option ``owner`` in module ``openstack.cloud.image`` is now respected when
searching for and creating images.
- Our OpenStack inventory plugin now properly supports Ansible's cache feature.
deprecated_features:
- Option ``is_public`` in module ``openstack.cloud.image`` has been deprecated
and replaced with option ``visibility``.
- Option ``volume`` in module ``openstack.cloud.image`` has been deprecated
and it should be replaced with module ``openstack.cloud.volume`` in user code.
major_changes:
- Many modules gained support for Ansible's check mode or have been fixed to
properly implement a no change policy during check mode runs.
- Many modules gained support for updates. In the past, those modules allowed
to create and delete OpenStack cloud resources but would ignore when module
options had been changed.
- Many modules such as ``openstack.cloud.server``, ``openstack.cloud.baremetal_node``
and all load-balancer related modules now properly implement the ``wait``
option. For example, when ``wait`` is set to ``true`` then modules will not
return until resources have reached its ``active`` or ``deleted`` state.
- Module ``openstack.cloud.resource`` has been added. It provides an generic
and uniform interface to create, update and delete any OpenStack cloud resource
which openstacksdk supports. This module unlocks a huge amount of functionality
from OpenStack clouds to Ansible users which has been inaccessible with existing
modules so far.
- Module ``openstack.cloud.resources`` has been added. It provides an generic
and uniform interface to list any type of OpenStack cloud resources which
openstacksdk supports. This module fetch any OpenStack cloud resource without
having to implement a new Ansible ``*_info`` module for this type of resource
first.
- Module ``openstack.cloud.subnet_pool`` has been added. It allows to create
and delete subnet pools in OpenStack clouds.
- Module examples have been improved and updated for most modules.
- Module results have been properly documented for all modules.
- Options in all modules have been renamed to match openstacksdk's attribute
names (if applicable). The previous option names have been added as aliases
to keep module options backward compatible.
- Our CI integration tests have been massively expanded. Our test coverage spans
across all modules and plugins now, including tests for our inventory plugin
and our new ``openstack.cloud.resource`` and ``openstack.cloud.resources``
modules.
- Our contributors documentation has been heavily extended. In directory ``docs``
you will find the rationale for our branching strategy, a developer's guide
on how to contribute to the collection, a tutorial to set up a DevStack environment
for hacking on and testing the collection, a step-by-step guide for publishing
new releases and a list of questions to ask when doing reviews or submitting
patches for review.
minor_changes:
- Added generic module options ``sdk_log_path`` and ``sdk_log_level`` which
allow to track openstacksdk activity.
- Many more options were added to modules but we stopped counting at one point...
- Module ``openstack.cloud.coe_cluster`` gained support for option ``is_floating_ip_enabled``.
- Module ``openstack.cloud.lb_listener`` gained options ``default_tls_container_ref``
and ``sni_container_refs`` which allow to specify TLS certificates when using
the ``TERMINATED_HTTPS`` protocol.
- Module ``openstack.cloud.network`` gained support for updates, i.e. existing
networks will be properly updated now when module options such as ``mtu``
or ``admin_state_up`` have been changed.
- Module ``openstack.cloud.port`` gained an ``description`` option.
- Module ``openstack.cloud.role_assignment`` gained an ``system`` option.
- Module ``openstack.cloud.security_group_rule`` gained an ``description`` option.
- Module ``openstack.cloud.server_action`` gained an option ``all_projects``
which allows to execute actions on servers outside of the current auth-scoped
project (if the user has permission to do so).
- Module ``openstack.cloud.server_info`` gained an ``description`` option.
- Module ``openstack.cloud.server`` gained an ``description`` option.
- Module ``openstack.cloud.server`` gained support for updates. For example,
options such as ``description`` and floating ip addresses can be updated now.
- Module ``openstack.cloud.subnet`` gained an ``subnet_pool`` option.
release_summary: "Our new major release 2.0.0 of the Ansible collection for
OpenStack clouds aka ``openstack.cloud`` is a complete overhaul of the code
base and brings full compatibility with openstacksdk 1.0.0.\n\nHighlights
of this release are\n* three new modules which for example provide a generic
and uniform API for interacting with OpenStack cloud resources,\n* a complete
refactoring of all existing modules bringing dozens of bugfixes, new features
as well as consistent\n and properly documented module results and options,\n*
100% compatibility with openstacksdk's first major release 1.0.0,\n* new guides
for contributors from devstack setup over coding guidelines to our release
process and\n* massively increased CI coverage with many new integration tests,
now covering all modules and plugins.\n\nNote, this ``2.0.0`` release *breaks
backward compatibility* with previous ``1.x.x`` releases!\n* ``2.x.x`` releases
of this collection are compatible with openstacksdk ``1.x.x`` and later *only*,\n*
``1.x.x`` releases of this collection are compatible with openstacksdk ``0.x.x``
prior to ``0.99.0`` *only*,\n* ``2.x.x`` releases of are not backward compatible
with ``1.x.x`` releases,\n* ``1.x.x`` release series will be in maintenance
mode now and receive bugfixes only.\n\nHowever, this collection as well as
openstacksdk continue to be backward compatible with clouds running on older
OpenStack releases. For example, it is fine and a fully supported use case
to use this 2.0.0 release with clouds based on OpenStack Train, Wallaby or
Zed. Feel encouraged to always use the latest releases of this collection
and openstacksdk regardless of which version of OpenStack is installed in
your cloud.\n\nThis collection is compatible with and tested with Ansible
2.9 and later. However, support for old ``os_*`` short module names such as
``os_server`` have been dropped with this release. You have to call modules
using their FQCN (Fully-Qualified Collection Name) such as ``openstack.cloud.server``
instead.\n\nMany thanks to all contributors who made this release possible.
Tens of thousands LOCs have been reviewed and changed and fixed and tested
throughout last year. You rock!"
removed_features:
- Dropped deprecated ``skip_update_of_driver_password`` option from module ``openstack.cloud.baremetal_node``.
- Dropped unmaintained, obsolete and broken inventory script ``scripts/inventory/openstack_inventory.py``.
It had been replaced with a proper Ansible inventory plugin ``openstack.cloud.openstack``
during the 1.x.x life cycle.
- Module ``openstack.cloud.object`` no longer allows to create and delete containers,
its sole purpose is managing an object in a container now. Use module ``openstack.cloud.object_container``
to managing Swift containers instead.
- Option ``listeners`` has been removed from module ``openstack.cloud.loadbalancer``
because it duplicates a subset of the functionality (and code) provided by
our ``openstack.cloud.lb_{listener,member,pool}`` modules.
- Our outdated, undocumented, untested and bloated code templates in ``contrib``
directory which could be used to generate and develop new Ansible modules
for this collection have been removed.
release_date: '2023-01-31'
2.1.0:
changes:
bugfixes:
- Change security group rules only when instructed to do so
- 'Fix for AttributeError: ''dict'' object has no attribute ''status'''
- Fix issue with multiple records in recordset
- Fix mistake in compute_flavor_access notes
- Fixed private option in inventory plugin
- Respect description option and delete security group rules first
- Use true and false instead of yes and no for boolean values
minor_changes:
- Add baremetal_deploy_template module
- Highlight our mode of operation more prominently
release_summary: New module for Ironic and bugfixes
release_date: '2023-04-19'
2.2.0:
changes:
bugfixes:
- Fix image module filter
- Fix port module idempotency
- Fix router module idempotency
minor_changes:
- Add volume_encryption_type modules
- Add volume_type modules
release_summary: New module for volume_type and bugfixes
release_date: '2023-12-01'

View File

@@ -6,9 +6,9 @@ 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
notes_dir: fragments
prelude_name: release_summary
prelude_title: Release Summary
sections:
- - major_changes
- Major Changes
@@ -26,6 +26,6 @@ sections:
- Bugfixes
- - known_issues
- Known Issues
title: Openstack Cloud Ansilbe modules
title: Ansible OpenStack Collection
trivial_section_name: trivial
use_fqcn: true

View File

@@ -1,6 +0,0 @@
- hosts: all
tasks:
- 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

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

@@ -1,7 +1,7 @@
---
- hosts: all
vars:
collection_path: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/ansible-collections-openstack'].src_dir }}"
collection_path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
build_collection_path: /tmp/collection_built/
ansible_galaxy_path: "~/.local/bin/ansible-galaxy"
@@ -63,12 +63,21 @@
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 }}/openstack-cloud-{{ version_tag }}.tar.gz
{{ build_collection_path }}/{{ galaxy_yaml.namespace }}-{{ galaxy_yaml.name }}-{{ version_tag }}.tar.gz
always:
- name: Shred ansible-galaxy credentials

8
ci/requirements.yml Normal file
View File

@@ -0,0 +1,8 @@
---
collections:
- ansible.posix
- ansible.utils
- name: community.general
version: 4.8.8
# 5.0.0 dropped compatibility with ansible 2.9 and ansible-base 2.10
# Ref.: https://github.com/ansible-collections/community.general/commit/1a9b3214fdf1eaccba5cc9ee210cbc5b5070fe4b

View File

@@ -1 +1,8 @@
address_scope_name: "adrdess_scope"
address_scope_name: "address_scope"
expected_fields:
- id
- ip_version
- is_shared
- name
- project_id
- tenant_id

View File

@@ -7,6 +7,12 @@
ip_version: "4"
register: create_address_scope
- name: Verify returned values
assert:
that:
- item in create_address_scope.address_scope
loop: "{{ expected_fields }}"
- name: Verify address scope
assert:
that:
@@ -37,4 +43,4 @@
openstack.cloud.address_scope:
cloud: "{{ cloud }}"
name: "{{ address_scope_name }}"
state: absent
state: absent

View File

@@ -0,0 +1,2 @@
expected_fields:
- auth_token

View File

@@ -2,5 +2,10 @@
- name: Authenticate to the cloud
openstack.cloud.auth:
cloud={{ cloud }}
register: auth
- debug: var=service_catalog
- name: Assert return values of auth module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(auth.keys())|length == 0

View File

@@ -0,0 +1,7 @@
expected_fields:
- created_at
- extra
- id
- name
- steps
- updated_at

View File

@@ -0,0 +1,58 @@
---
# TODO: Actually run this role in CI. Atm we do not have DevStack's ironic plugin enabled.
- name: Create baremetal deploy template
openstack.cloud.baremetal_deploy_template:
cloud: "{{ cloud }}"
state: present
name: CUSTOM_ANSIBLE_DEPLOY_TEMPLATE
steps:
- interface: bios
step: apply_configuration
args:
settings:
- name: some-setting
value: some-value
priority: 110
register: template
- debug: var=template
- name: Assert return values of baremetal_deploy_template module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(template.template.keys())|length == 0
- name: Update baremetal deploy template
openstack.cloud.baremetal_deploy_template:
cloud: "{{ cloud }}"
state: present
id: "{{ template.template.id }}"
extra:
foo: bar
register: updated_template
- name: Assert return values of updated baremetal deploy template
assert:
that:
- updated_template is changed
- updated_template.template.id == template.template.id
- name: Update baremetal deploy template again
openstack.cloud.baremetal_deploy_template:
cloud: "{{ cloud }}"
state: present
id: "{{ template.template.id }}"
register: updated_template
- name: Assert return values of updated baremetal deploy template
assert:
that:
- updated_template is not changed
- updated_template.template.id == template.template.id
- name: Delete Bare Metal deploy template
openstack.cloud.baremetal_deploy_template:
cloud: "{{ cloud }}"
state: absent
id: "{{ template.template.id }}"

View File

@@ -0,0 +1,56 @@
expected_fields:
- allocation_id
- bios_interface
- boot_interface
- boot_mode
- chassis_id
- clean_step
- conductor
- conductor_group
- console_interface
- created_at
- deploy_interface
- deploy_step
- driver
- driver_info
- driver_internal_info
- extra
- fault
- id
- inspect_interface
- instance_id
- instance_info
- is_automated_clean_enabled
- is_console_enabled
- is_maintenance
- is_protected
- is_retired
- is_secure_boot
- last_error
- links
- maintenance_reason
- management_interface
- name
- network_interface
- owner
- port_groups
- ports
- power_interface
- power_state
- properties
- protected_reason
- provision_state
- raid_config
- raid_interface
- rescue_interface
- reservation
- resource_class
- retired_reason
- states
- storage_interface
- target_power_state
- target_provision_state
- target_raid_config
- traits
- updated_at
- vendor_interface

View File

@@ -0,0 +1,15 @@
---
# TODO: Actually run this role in CI. Atm we do not have DevStack's ironic plugin enabled.
- name: Introspect node
openstack.cloud.baremetal_inspect:
cloud: "{{ cloud }}"
name: node-1
register: inspect
- debug: var=inspect
- name: assert return values of baremetal_inspect module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(inspect.node.keys())|length == 0

View File

@@ -0,0 +1,56 @@
expected_fields:
- allocation_id
- bios_interface
- boot_interface
- boot_mode
- chassis_id
- clean_step
- conductor
- conductor_group
- console_interface
- created_at
- deploy_interface
- deploy_step
- driver
- driver_info
- driver_internal_info
- extra
- fault
- id
- inspect_interface
- instance_id
- instance_info
- is_automated_clean_enabled
- is_console_enabled
- is_maintenance
- is_protected
- is_retired
- is_secure_boot
- last_error
- links
- maintenance_reason
- management_interface
- name
- network_interface
- owner
- port_groups
- ports
- power_interface
- power_state
- properties
- protected_reason
- provision_state
- raid_config
- raid_interface
- rescue_interface
- reservation
- resource_class
- retired_reason
- states
- storage_interface
- target_power_state
- target_provision_state
- target_raid_config
- traits
- updated_at
- vendor_interface

View File

@@ -0,0 +1,74 @@
---
# TODO: Actually run this role in CI. Atm we do not have DevStack's ironic plugin enabled.
- name: Create baremetal node
openstack.cloud.baremetal_node:
cloud: "{{ cloud }}"
driver_info:
ipmi_address: "1.2.3.4"
ipmi_username: "admin"
ipmi_password: "secret"
name: ansible_baremetal_node
nics:
- mac: "aa:bb:cc:aa:bb:cc"
state: present
register: node
- debug: var=node
- name: assert return values of baremetal_node module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(node.node.keys())|length == 0
- name: Fetch baremetal nodes
openstack.cloud.baremetal_node_info:
cloud: "{{ cloud }}"
register: nodes
- name: assert module results of baremetal_node_info module
assert:
that:
- nodes.nodes|list|length > 0
- name: assert return values of baremetal_node_info module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(nodes.nodes.0.keys())|length == 0
- name: Fetch baremetal node by name
openstack.cloud.baremetal_node_info:
cloud: "{{ cloud }}"
name: ansible_baremetal_node
register: nodes
- name: assert module results of baremetal_node_info module
assert:
that:
- nodes.nodes|list|length == 1
- nodes.nodes.0.id == node.node.id
- nodes.nodes.0.name == "ansible_baremetal_node"
- name: Delete baremetal node
openstack.cloud.baremetal_node:
cloud: "{{ cloud }}"
driver_info:
ipmi_address: "1.2.3.4"
ipmi_username: "admin"
ipmi_password: "secret"
name: ansible_baremetal_node
nics:
- mac: "aa:bb:cc:aa:bb:cc"
state: absent
- name: Fetch baremetal node by name
openstack.cloud.baremetal_node_info:
cloud: "{{ cloud }}"
name: ansible_baremetal_node
register: nodes
- name: Assert that baremetal node has been deleted
assert:
that:
- nodes.nodes|list|length == 0

View File

@@ -0,0 +1,14 @@
expected_fields:
- address
- created_at
- extra
- id
- internal_info
- is_pxe_enabled
- links
- local_link_connection
- name
- node_id
- physical_network
- port_group_id
- updated_at

View File

@@ -0,0 +1,112 @@
---
# TODO: Actually run this role in CI. Atm we do not have DevStack's ironic plugin enabled.
- name: Create baremetal node
openstack.cloud.baremetal_node:
cloud: "{{ cloud }}"
driver_info:
ipmi_address: "1.2.3.4"
ipmi_username: "admin"
ipmi_password: "secret"
name: ansible_baremetal_node
nics:
- mac: "aa:bb:cc:aa:bb:cc"
state: present
register: node
- name: Create baremetal port
openstack.cloud.baremetal_port:
cloud: "{{ cloud }}"
state: present
node: ansible_baremetal_node
address: fa:16:3e:aa:aa:aa
is_pxe_enabled: False
register: port
- debug: var=port
- name: Assert return values of baremetal_port module
assert:
that:
- not port.port.is_pxe_enabled
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(port.port.keys())|length == 0
- name: Fetch baremetal ports
openstack.cloud.baremetal_port_info:
cloud: "{{ cloud }}"
register: ports
- name: Assert module results of baremetal_port_info module
assert:
that:
- ports.ports|list|length > 0
- name: assert return values of baremetal_port_info module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(ports.ports.0.keys())|length == 0
- name: Fetch baremetal port by id
openstack.cloud.baremetal_port_info:
cloud: "{{ cloud }}"
id: "{{ port.port.id }}"
register: ports
- name: assert module results of baremetal_port_info module
assert:
that:
- ports.ports|list|length == 1
- ports.ports.0.id == port.port.id
- name: Update baremetal port
openstack.cloud.baremetal_port:
cloud: "{{ cloud }}"
state: present
id: "{{ port.port.id }}"
is_pxe_enabled: True
register: updated_port
- name: Assert return values of updated baremetal port
assert:
that:
- update_port is changed
- update_port.port.id == port.port.id
- update_port.port.address == port.port.address
- update_port.port.is_pxe_enabled
- name: Update baremetal port again
openstack.cloud.baremetal_port:
cloud: "{{ cloud }}"
state: present
id: "{{ port.port.id }}"
is_pxe_enabled: True
register: updated_port
- name: Assert return values of updated baremetal port
assert:
that:
- update_port is not changed
- update_port.port.id == port.port.id
- name: Delete Bare Metal port
openstack.cloud.baremetal_port:
cloud: "{{ cloud }}"
state: absent
id: "{{ port.port.id }}"
- name: Fetch baremetal ports
openstack.cloud.baremetal_port_info:
cloud: "{{ cloud }}"
register: ports
- name: Assert no baremetal port is left
assert:
that:
- ports.ports|list|length == 0
- name: Delete baremetal node
openstack.cloud.baremetal_node:
cloud: "{{ cloud }}"
name: ansible_baremetal_node
state: absent

View File

@@ -0,0 +1,7 @@
expected_fields:
- description
- id
- is_enabled
- links
- name
- type

View File

@@ -0,0 +1,103 @@
---
- 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: "{{ expected_fields }}"
- 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: "{{ expected_fields }}"
- 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 is_enabled were updated
assert:
that:
- service_test.service.description == "A new description"
- not (service_test.service.is_enabled|bool)
- name: Get all services
openstack.cloud.catalog_service_info:
cloud: "{{ cloud }}"
register: services
- name: Assert return values of catalog_service_info module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(services.services[0].keys())|length == 0
- name: Get service by name
openstack.cloud.catalog_service_info:
cloud: "{{ cloud }}"
name: test
register: services
- name: Assert services returned by catalog_service_info module
assert:
that:
- services.services|length == 1
- services.services[0].id == service_test.service.id
- 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

@@ -1,7 +0,0 @@
---
- name: List all profiles
openstack.cloud.config:
register: list
# WARNING: This will output sensitive authentication information!!!!
- debug: var=list

View File

@@ -0,0 +1,26 @@
expected_fields:
- api_address
- cluster_template_id
- coe_version
- create_timeout
- created_at
- discovery_url
- fixed_network
- fixed_subnet
- flavor_id
- id
- is_floating_ip_enabled
- is_master_lb_enabled
- keypair
- labels
- master_addresses
- master_count
- master_flavor_id
- name
- node_addresses
- node_count
- stack_id
- status
- status_reason
- updated_at
- 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
image_id: '{{ image_id }}'
is_floating_ip_enabled: true
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:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|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,33 @@
expected_fields:
- apiserver_port
- cluster_distro
- coe
- created_at
- dns_nameserver
- docker_storage_driver
- docker_volume_size
- external_network_id
- fixed_network
- fixed_subnet
- flavor_id
- http_proxy
- https_proxy
- id
- image_id
- insecure_registry
- is_floating_ip_enabled
- is_hidden
- is_master_lb_enabled
- is_public
- is_registry_enabled
- is_tls_disabled
- keypair_id
- labels
- master_flavor_id
- name
- network_driver
- no_proxy
- server_type
- 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
is_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
is_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,14 @@
expected_fields:
- description
- disk
- ephemeral
- extra_specs
- id
- is_disabled
- is_public
- name
- original_name
- ram
- rxtx_factor
- swap
- vcpus

View File

@@ -0,0 +1,254 @@
---
- name: Delete resources before tests
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: absent
name: "{{ item }}"
loop:
- ansible_public_flavor
- ansible_private_flavor
- ansible_extra_specs_flavor
- ansible_defaults_flavor
- name: Create public flavor
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_public_flavor
is_public: True
ram: 1024
vcpus: 1
disk: 10
ephemeral: 10
swap: 1
id: 12345
register: result
- assert:
that: item in result.flavor
loop: "{{ expected_fields }}"
- name: Assert changed
assert:
that: result is changed
- name: Create public flavor again
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_public_flavor
is_public: True
ram: 1024
vcpus: 1
disk: 10
ephemeral: 10
swap: 1
id: 12345
register: result
- name: Assert not changed
assert:
that: result is not changed
- name: Delete public flavor
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: absent
name: ansible_public_flavor
register: result
- name: Assert changed
assert:
that: result is changed
- name: Delete public flavor again
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: absent
name: ansible_public_flavor
register: result
- name: Assert not changed
assert:
that: result is not changed
- name: Create private flavor
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_private_flavor
is_public: False
ram: 1024
vcpus: 1
disk: 10
ephemeral: 10
swap: 1
id: 12345
- name: Delete private flavor
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: absent
name: ansible_private_flavor
- name: Create flavor (defaults)
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_defaults_flavor
ram: 1024
vcpus: 1
disk: 10
register: result
- name: Assert changed
assert:
that: result is changed
- name: Create flavor (defaults) again
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_defaults_flavor
ram: 1024
vcpus: 1
disk: 10
register: result
- name: Assert not changed
assert:
that: result is not changed
- name: Delete flavor (defaults)
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: absent
name: ansible_defaults_flavor
- name: Create flavor (extra_specs)
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_extra_specs_flavor
ram: 1024
vcpus: 1
disk: 10
extra_specs:
"os:secure_boot": "required"
register: result
- name: Assert returned value
assert:
that:
- result is changed
- result.flavor.extra_specs['os:secure_boot'] == 'required'
- name: Create flavor (extra_specs) again
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_extra_specs_flavor
ram: 1024
vcpus: 1
disk: 10
extra_specs:
"os:secure_boot": "required"
register: result
- name: Assert not changed
assert:
that: result is not changed
- name: Change extra_specs value
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_extra_specs_flavor
ram: 1024
vcpus: 1
disk: 10
extra_specs:
"os:secure_boot": "disabled"
register: result
- name: Assert returned value
assert:
that:
- result is changed
- result.flavor.extra_specs['os:secure_boot'] == 'disabled'
- name: Append extra_specs value
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_extra_specs_flavor
ram: 1024
vcpus: 1
disk: 10
extra_specs:
"os:secure_boot": "disabled"
"hw_video:ram_max_mb": 200
register: result
- name: Assert returned value
assert:
that:
- result is changed
- result.flavor.extra_specs | length == 2
- "'os:secure_boot' in result.flavor.extra_specs"
- "'hw_video:ram_max_mb' in result.flavor.extra_specs"
- name: Drop extra_specs value
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_extra_specs_flavor
ram: 1024
vcpus: 1
disk: 10
extra_specs:
"hw_video:ram_max_mb": 200
register: result
- name: Assert returned value
assert:
that:
- result is changed
- result.flavor.extra_specs | length == 1
- "'hw_video:ram_max_mb' in result.flavor.extra_specs"
- name: Assert changed
assert:
that: result is changed
- name: Clean up
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: absent
name: "{{ item }}"
loop:
- ansible_public_flavor
- ansible_private_flavor
- ansible_extra_specs_flavor
- ansible_defaults_flavor
- name: List flavors
openstack.cloud.compute_flavor_info:
cloud: "{{ cloud }}"
register: flavor_info
- assert:
that: item in flavor_info.flavors[0]
loop: "{{ expected_fields }}"
- 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.flavors | length == 1
- flavor.flavors.0.name == "m1.tiny"

View File

@@ -0,0 +1,96 @@
---
- name: Create flavor
openstack.cloud.compute_flavor:
cloud: devstack-admin
state: present
name: ansible_flavor
is_public: False
ram: 1024
vcpus: 1
disk: 10
ephemeral: 10
swap: 1
register: flavor
- name: Fetch demo project
openstack.cloud.project_info:
cloud: devstack-admin
name: demo
register: projects
- name: Verify demo project
assert:
that:
- projects.projects|length == 1
- projects.projects.0.name == "demo"
- name: Grant access to flavor
openstack.cloud.compute_flavor_access:
cloud: devstack-admin
name: ansible_flavor
project: demo
state: present
register: access
- name: Verify access
assert:
that:
- access is changed
- access.flavor.id == flavor.flavor.id
# TODO: Replace with appropriate Ansible module once available
- name: Get compute flavor
command: openstack --os-cloud=devstack-admin flavor show ansible_flavor -f json
register: flavor_show
- name: Verify volume type access
assert:
that:
- (flavor_show.stdout | from_json).name == 'ansible_flavor'
- projects.projects.0.id in (flavor_show.stdout | from_json).access_project_ids
- name: Grant access to flavor again
openstack.cloud.compute_flavor_access:
cloud: devstack-admin
name: ansible_flavor
project: demo
state: present
register: access
- name: Verify access did not change
assert:
that:
- access is not changed
- name: Revoke access to flavor
openstack.cloud.compute_flavor_access:
cloud: devstack-admin
name: ansible_flavor
project: demo
state: absent
register: access
- name: Verify revoked access
assert:
that:
- access is changed
- access.flavor.id == flavor.flavor.id
- name: Revoke access to flavor again
openstack.cloud.compute_flavor_access:
cloud: devstack-admin
name: ansible_flavor
project: demo
state: absent
register: access
- name: Verify access did not change
assert:
that:
- access is not changed
- name: Delete flavor
openstack.cloud.compute_flavor:
cloud: devstack-admin
state: absent
name: ansible_flavor

View File

@@ -0,0 +1,11 @@
expected_fields:
- availability_zone
- binary
- disabled_reason
- host
- id
- is_forced_down
- name
- state
- status
- updated_at

View File

@@ -0,0 +1,23 @@
---
- name: Fetch compute services
openstack.cloud.compute_service_info:
cloud: "{{ cloud }}"
register: compute_services
- name: Assert return values of compute_service_info module
assert:
that:
- compute_services.compute_services | length > 0
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(compute_services.compute_services[0].keys())|length == 0
- name: Fetch compute services with filters
openstack.cloud.compute_service_info:
cloud: "{{ cloud }}"
binary: "nova-compute"
register: compute_services
- name: Assert return values of compute_service_info module
assert:
that:
- compute_services.compute_services | length > 0

View File

@@ -0,0 +1,10 @@
---
- name: List all cloud profiles
openstack.cloud.config:
register: config
# WARNING: This will output sensitive authentication information!!!!
- name: Assert config module
assert:
that:
- cloud in (config.clouds | map(attribute='name') | list)

View File

@@ -1,4 +0,0 @@
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

@@ -1,79 +0,0 @@
---
- 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: Create a recordset
openstack.cloud.recordset:
cloud: "{{ cloud }}"
zone: "{{ updated_dns_zone.zone.name }}"
name: "{{ recordset_name }}"
recordset_type: "a"
records: "{{ records }}"
register: recordset
- name: Verify recordset info
assert:
that:
- recordset["recordset"].name == recordset_name
- recordset["recordset"].zone_name == dns_zone.zone.name
- recordset["recordset"].records == records
- name: Update a recordset
openstack.cloud.recordset:
cloud: "{{ cloud }}"
zone: "{{ updated_dns_zone.zone.name }}"
name: "{{ recordset_name }}"
recordset_type: "a"
records: "{{ updated_records }}"
description: "new test recordset"
register: updated_recordset
- name: Verify recordset info
assert:
that:
- updated_recordset["recordset"].zone_name == dns_zone.zone.name
- updated_recordset["recordset"].name == recordset_name
- updated_recordset["recordset"].records == updated_records
- name: Delete recordset
openstack.cloud.recordset:
cloud: "{{ cloud }}"
zone: "{{ updated_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 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,17 @@
expected_fields:
- action
- attributes
- created_at
- description
- email
- id
- links
- masters
- name
- pool_id
- project_id
- serial
- status
- ttl
- type
- updated_at

View File

@@ -0,0 +1,67 @@
---
- name: Create dns zone
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: ansible.test.zone.
type: primary
email: test@example.net
register: dns_zone
- name: Assert return values of dns_zone module
assert:
that:
- dns_zone.zone.name == "ansible.test.zone."
- dns_zone.zone.type|lower == "primary"
- dns_zone.zone.email == "test@example.net"
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(dns_zone.zone.keys())|length == 0
- name: Update dns zone
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: ansible.test.zone.
description: "Another description"
register: dns_zone
- name: Assert return values of dns_zone module
assert:
that:
- dns_zone.zone.description == "Another description"
- name: Fetch all dns zones
openstack.cloud.dns_zone_info:
cloud: "{{ cloud }}"
register: dns_zones
- name: Assert return values of dns_zone_info module
assert:
that:
- dns_zones is not changed
- dns_zones | length > 0
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(dns_zones.zones[0].keys())|length == 0
- name: Fetch a dns zone by name
openstack.cloud.dns_zone_info:
cloud: "{{ cloud }}"
name: ansible.test.zone.
register: dns_zones
- name: Assert return values of dns_zone_info module
assert:
that:
- dns_zones is not changed
- dns_zones.zones | length == 1
- dns_zones.zones[0].id == dns_zone.zone.id
- name: Delete dns zone
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: ansible.test.zone.
state: absent
register: dns_zone
- name: Verify dns zone
assert:
that:
- dns_zone is changed

View File

@@ -1,41 +0,0 @@
---
- 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: Drop created dns zone
openstack.cloud.dns_zone:
cloud: "{{ cloud }}"
name: "{{ (prefix + '.test.zone.') }}"
state: absent

View File

@@ -0,0 +1,9 @@
expected_fields:
- id
- interface
- is_enabled
- links
- name
- region_id
- service_id
- url

View File

@@ -0,0 +1,68 @@
---
- name: Create a service endpoint for compute
openstack.cloud.endpoint:
cloud: "{{ cloud }}"
service: nova
endpoint_interface: internal
url: http://controller:9292
region: RegionOne
state: present
register: endpoint_test
- debug: var=endpoint_test
- name: Assert return values of endpoint module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(endpoint_test.endpoint.keys())|length == 0
- name: Ensure service have the proper endpoint
assert:
that:
- endpoint_test.endpoint.url == "http://controller:9292"
- name: Create service endpoint 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 service 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 service endpoint was updated
assert:
that:
- endpoint_updated.endpoint.url == "http://controller:9393"
- name: Delete service endpoint
openstack.cloud.endpoint:
cloud: "{{ cloud }}"
service: nova
endpoint_interface: internal
url: http://controller:9393
region: RegionOne
state: absent
register: endpoint_deleted
- name: Ensure service endpoint was deleted
assert:
that:
- endpoint_deleted.changed

View File

@@ -1,3 +1,7 @@
expected_fields:
- id
- name
- rules
mapping_name: 'ansible-test-mapping'
mapping_name_2: 'ansible-test-mapping-2'
mapping_rules_1:

View File

@@ -1,8 +1,8 @@
---
- module_defaults:
# meta/action_groups.yml glue seems to be missing
# group/os:
# cloud: "{{ cloud }}"
group/openstack.cloud.openstack:
cloud: "{{ cloud }}"
# Backward compatibility with Ansible 2.9
openstack.cloud.federation_mapping:
cloud: "{{ cloud }}"
openstack.cloud.federation_mapping_info:
@@ -12,10 +12,6 @@
openstack.cloud.federation_mapping:
state: 'absent'
name: '{{ mapping_name }}'
register: delete_mapping
- assert:
that:
- delete_mapping is successful
- name: 'Create mapping - CHECK_MODE'
openstack.cloud.federation_mapping:
@@ -23,20 +19,20 @@
name: '{{ mapping_name }}'
rules: '{{ mapping_rules_1 }}'
register: create_mapping
check_mode: yes
check_mode: true
- assert:
that:
- create_mapping is successful
- create_mapping is changed
- name: 'Fetch mapping info (mapping should be absent)'
openstack.cloud.federation_mapping_info:
name: '{{ mapping_name }}'
register: mapping_info
ignore_errors: yes
- assert:
that:
- mapping_info is failed
- mapping_info.mappings | length == 0
- name: 'Create mapping'
openstack.cloud.federation_mapping:
@@ -44,52 +40,50 @@
name: '{{ mapping_name }}'
rules: '{{ mapping_rules_1 }}'
register: create_mapping
- assert:
that:
- create_mapping is successful
- create_mapping is changed
- '"id" in create_mapping.mapping'
- '"name" in create_mapping.mapping'
- '"rules" in create_mapping.mapping'
- create_mapping.mapping.id == mapping_name
- create_mapping.mapping.name == mapping_name
- create_mapping.mapping.rules | length == 1
- name: assert return values of federation_mapping module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(create_mapping.mapping.keys())|length == 0
- name: 'Fetch mapping info - with name'
openstack.cloud.federation_mapping_info:
name: '{{ mapping_name }}'
register: mapping_info
- assert:
that:
- mapping_info is successful
- '"mappings" in mapping_info'
- mapping_info.mappings | length == 1
- '"id" in mapping_0'
- '"name" in mapping_0'
- '"rules" in mapping_0'
- mapping_0.id == mapping_name
- mapping_0.name == mapping_name
- mapping_0.rules | length == 1
vars:
mapping_0: '{{ mapping_info.mappings[0] }}'
- mapping_info.mappings[0].id == mapping_name
- mapping_info.mappings[0].name == mapping_name
- mapping_info.mappings[0].rules | length == 1
- name: Check info about mappings
assert:
that:
- mapping_info.mappings|length > 0
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(mapping_info.mappings[0].keys())|length == 0
- name: 'Fetch mapping info - without name'
openstack.cloud.federation_mapping_info: {}
register: mapping_info
- assert:
that:
- mapping_info is successful
- '"mappings" in mapping_info'
# In CI we generally have a clean slate, but this might
# not be true for everyone...
- mapping_info.mappings | length >= 1
- '"id" in mapping_0'
- '"name" in mapping_0'
- '"rules" in mapping_0'
- mapping_name in (mapping_info.mappings | map(attribute='id'))
- mapping_name in (mapping_info.mappings | map(attribute='name'))
vars:
mapping_0: '{{ mapping_info.mappings[0] }}'
- name: 'Create mapping (retry - no change) - CHECK_MODE'
openstack.cloud.federation_mapping:
@@ -97,10 +91,10 @@
name: '{{ mapping_name }}'
rules: '{{ mapping_rules_1 }}'
register: create_mapping
check_mode: yes
check_mode: true
- assert:
that:
- create_mapping is successful
- create_mapping is not changed
- name: 'Create mapping (retry - no change)'
@@ -109,13 +103,10 @@
name: '{{ mapping_name }}'
rules: '{{ mapping_rules_1 }}'
register: create_mapping
- assert:
that:
- create_mapping is successful
- create_mapping is not changed
- '"id" in create_mapping.mapping'
- '"name" in create_mapping.mapping'
- '"rules" in create_mapping.mapping'
- create_mapping.mapping.id == mapping_name
- create_mapping.mapping.name == mapping_name
- create_mapping.mapping.rules | length == 1
@@ -126,10 +117,10 @@
name: '{{ mapping_name }}'
rules: '{{ mapping_rules_2 }}'
register: update_mapping
check_mode: yes
check_mode: true
- assert:
that:
- update_mapping is successful
- update_mapping is changed
- name: 'Update mapping'
@@ -138,13 +129,10 @@
name: '{{ mapping_name }}'
rules: '{{ mapping_rules_2 }}'
register: update_mapping
- assert:
that:
- update_mapping is successful
- update_mapping is changed
- '"id" in update_mapping.mapping'
- '"name" in update_mapping.mapping'
- '"rules" in update_mapping.mapping'
- update_mapping.mapping.id == mapping_name
- update_mapping.mapping.name == mapping_name
- update_mapping.mapping.rules | length == 1
@@ -155,13 +143,10 @@
name: '{{ mapping_name }}'
rules: '{{ mapping_rules_2 }}'
register: update_mapping
- assert:
that:
- update_mapping is successful
- update_mapping is not changed
- '"id" in update_mapping.mapping'
- '"name" in update_mapping.mapping'
- '"rules" in update_mapping.mapping'
- update_mapping.mapping.id == mapping_name
- update_mapping.mapping.name == mapping_name
- update_mapping.mapping.rules | length == 1
@@ -172,13 +157,10 @@
name: '{{ mapping_name_2 }}'
rules: '{{ mapping_rules_1 }}'
register: create_mapping
- assert:
that:
- create_mapping is successful
- create_mapping is changed
- '"id" in create_mapping.mapping'
- '"name" in create_mapping.mapping'
- '"rules" in create_mapping.mapping'
- create_mapping.mapping.id == mapping_name_2
- create_mapping.mapping.name == mapping_name_2
- create_mapping.mapping.rules | length == 1
@@ -187,53 +169,37 @@
openstack.cloud.federation_mapping_info:
name: '{{ mapping_name_2 }}'
register: mapping_info
- assert:
that:
- mapping_info is successful
- '"mappings" in mapping_info'
- mapping_info.mappings | length == 1
- '"id" in mapping_0'
- '"name" in mapping_0'
- '"rules" in mapping_0'
- mapping_0.id == mapping_name_2
- mapping_0.name == mapping_name_2
- mapping_0.rules | length == 1
vars:
mapping_0: '{{ mapping_info.mappings[0] }}'
- mapping_info.mappings[0].id == mapping_name_2
- mapping_info.mappings[0].name == mapping_name_2
- mapping_info.mappings[0].rules | length == 1
- name: 'Fetch mapping info - without name'
openstack.cloud.federation_mapping_info: {}
register: mapping_info
- assert:
that:
- mapping_info is successful
- '"mappings" in mapping_info'
# In CI we generally have a clean slate, but this might
# not be true for everyone...
- mapping_info.mappings | length >= 2
- '"id" in mapping_0'
- '"name" in mapping_0'
- '"rules" in mapping_0'
- '"id" in mapping_1'
- '"name" in mapping_1'
- '"rules" in mapping_1'
- mapping_name in (mapping_info.mappings | map(attribute='id'))
- mapping_name in (mapping_info.mappings | map(attribute='name'))
- mapping_name_2 in (mapping_info.mappings | map(attribute='id'))
- mapping_name_2 in (mapping_info.mappings | map(attribute='name'))
vars:
mapping_0: '{{ mapping_info.mappings[0] }}'
mapping_1: '{{ mapping_info.mappings[1] }}'
- name: 'Delete mapping - CHECK_MODE'
openstack.cloud.federation_mapping:
state: 'absent'
name: '{{ mapping_name }}'
register: delete_mapping
check_mode: yes
check_mode: true
- assert:
that:
- delete_mapping is successful
- delete_mapping is changed
- name: 'Delete mapping'
@@ -241,9 +207,9 @@
state: 'absent'
name: '{{ mapping_name }}'
register: delete_mapping
- assert:
that:
- delete_mapping is successful
- delete_mapping is changed
- name: 'Delete mapping (retry - no change) - CHECK_MODE'
@@ -251,10 +217,10 @@
state: 'absent'
name: '{{ mapping_name }}'
register: delete_mapping
check_mode: yes
check_mode: true
- assert:
that:
- delete_mapping is successful
- delete_mapping is not changed
- name: 'Delete mapping (retry - no change) '
@@ -262,28 +228,28 @@
state: 'absent'
name: '{{ mapping_name }}'
register: delete_mapping
- assert:
that:
- delete_mapping is successful
- delete_mapping is not changed
- name: 'Fetch mapping info after deletion'
openstack.cloud.federation_mapping_info:
name: '{{ mapping_name }}'
register: mapping_info
ignore_errors: True
- assert:
that:
- mapping_info is failed
- mapping_info.mappings | length == 0
- name: 'Delete second mapping'
openstack.cloud.federation_mapping:
state: 'absent'
name: '{{ mapping_name_2 }}'
register: delete_mapping
- assert:
that:
- delete_mapping is successful
- delete_mapping is changed
always:
@@ -291,10 +257,10 @@
openstack.cloud.federation_mapping:
state: 'absent'
name: '{{ mapping_name }}'
ignore_errors: yes
ignore_errors: true
- name: 'Delete second mapping'
openstack.cloud.federation_mapping:
state: 'absent'
name: '{{ mapping_name_2 }}'
ignore_errors: yes
ignore_errors: true

View File

@@ -0,0 +1,21 @@
---
expected_fields:
- 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

View File

@@ -0,0 +1,533 @@
---
- name: List all images
openstack.cloud.image_info:
cloud: "{{ cloud }}"
register: images
- name: Identify CirrOS image name
set_fact:
image_name: "{{ images.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.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
register: port1
- 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
register: port2
- 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
register: port3
- 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.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 1 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
register: server1
- name: Get server 1 ports
openstack.cloud.port_info:
cloud: "{{ cloud }}"
filters:
device_id: "{{ server1.server.id }}"
register: server1_ports
- name: Assert one fixed ip 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:
- server1_ports.ports|length == 1
- server1_ports.ports|sum(attribute='fixed_ips', start=[])|map(attribute='ip_address')|sort|list ==
["10.7.7.100"]
- name: Create server 2 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
register: server2
- name: Get server 2 ports
openstack.cloud.port_info:
cloud: "{{ cloud }}"
filters:
device_id: "{{ server2.server.id }}"
register: server2_ports
- name: Assert two fixed ips on server 2
assert:
that:
- server2_ports.ports|length == 2
- server2_ports.ports|sum(attribute='fixed_ips', start=[])|map(attribute='ip_address')|sort|list ==
["10.7.7.101", "10.7.7.102"]
- 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 floating ip attached to server 1
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
port: "{{ port1.port.id }}"
register: server1_fips
# openstacksdk has issues with waiting hence we simply retry
retries: 10
delay: 3
until: server1_fips.floating_ips|length == 1
- name: Assert fixed ip and floating ip attached to server 1
assert:
that:
- server1_ports.ports|length == 1
- server1_ports.ports|sum(attribute='fixed_ips', start=[])|map(attribute='ip_address')|sort|list ==
["10.7.7.100"]
- server1_fips.floating_ips|length == 1
- server1_fips.floating_ips|map(attribute='fixed_ip_address')|sort|list ==
["10.7.7.100"]
- name: Assert return values of floating_ip_info module
assert:
that:
- server1_fips is success
- server1_fips is not changed
- server1_fips.floating_ips
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(server1_fips.floating_ips[0].keys())|length == 0
- name: Assign floating ip to server 1 again
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: present
server: ansible_server1
wait: true
register: floating_ip
- name: Assert floating ip on server 1 has not changed
assert:
that: floating_ip is not changed
- name: Assert return values of floating_ip module
assert:
that:
- floating_ip.floating_ip
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(floating_ip.floating_ip.keys())|length == 0
- name: Detach floating ip from server 1
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: absent
server: ansible_server1
network: public
floating_ip_address: "{{ server1_fips.floating_ips.0.floating_ip_address }}"
- name: Wait until floating ip is detached from server 1
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
port: "{{ port1.port.id }}"
register: server1_fips
# When detaching a floating ip from an instance there might be a delay until it is not listed anymore
retries: 10
delay: 3
until: server1_fips.floating_ips|length == 0
- name: Find all floating ips for debugging
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
register: fips
- name: Print all floating ips for debugging
debug: var=fips
- name: Find all servers for debugging
openstack.cloud.server_info:
cloud: "{{ cloud }}"
register: servers
- name: Print all servers for debugging
debug: var=servers
- name: Assign floating ip to server 2
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: present
reuse: false # else fixed_address will be ignored
server: ansible_server2
network: public
fixed_address: "{{ port2.port.fixed_ips[0].ip_address }}"
wait: true
register: server2_fip
- name: Assert floating ip attached to server 2
assert:
that:
- server2_fip.floating_ip
- name: Find all floating ips for debugging
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
register: fips
- name: Print all floating ips for debugging
debug: var=fips
- name: Find all servers for debugging
openstack.cloud.server_info:
cloud: "{{ cloud }}"
register: servers
- name: Print all servers for debugging
debug: var=servers
- name: Get floating ip attached to server 2
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
port: "{{ port2.port.id }}"
register: server2_fips
- name: Assert floating ip attached to server 2
assert:
that:
- server2_fips.floating_ips|length == 1
- server2_fips.floating_ips|map(attribute='fixed_ip_address')|sort|list ==
["10.7.7.101"]
- name: Assign a second, specific floating ip to server 2
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: present
reuse: false # else fixed_address will be ignored
server: ansible_server2
network: ansible_external
fixed_address: "{{ port3.port.fixed_ips[0].ip_address }}"
floating_ip_address: "10.6.6.150"
wait: false # does not work anyway and causes issues in local testing
- name: Get floating ip attached to server 2
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
port: "{{ port3.port.id }}"
register: server2_fips
# 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
retries: 10
delay: 3
until: server2_fips.floating_ips|length == 1
- name: Assert second floating ip attached to server 2
assert:
that:
- server2_fips.floating_ips|length == 1
- server2_fips.floating_ips|map(attribute='fixed_ip_address')|sort|list ==
["10.7.7.102"]
- name: Detach second floating ip from server 2
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: absent
server: ansible_server2
network: ansible_external
floating_ip_address: "10.6.6.150"
- name: Wait until second floating ip is detached from server 2
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
port: "{{ port3.port.id }}"
register: server2_fips
# When detaching a floating ip from an instance there might be a delay until it is not listed anymore
retries: 10
delay: 3
until: server2_fips.floating_ips|length == 0
- name: Get first floating ip attached to server 2
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
port: "{{ port2.port.id }}"
register: server2_fips
- name: Detach remaining floating ip from server 2
openstack.cloud.floating_ip:
cloud: "{{ cloud }}"
state: absent
server: ansible_server2
network: public
floating_ip_address: "{{ server2_fips.floating_ips.0.floating_ip_address }}"
- name: Wait until first floating ip is detached from server 2
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
port: "{{ port2.port.id }}"
register: server2_fips
# When detaching a floating ip from an instance there might be a delay until it is not listed anymore
retries: 10
delay: 3
until: server2_fips.floating_ips|length == 0
- 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.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

@@ -1,11 +0,0 @@
---
- 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

View File

@@ -1 +0,0 @@
group_name: ansible_group

View File

@@ -1,19 +0,0 @@
---
- name: Create group
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: present
name: "{{ group_name }}"
- name: Update group
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: present
name: "{{ group_name }}"
description: "updated description"
- name: Delete group
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: absent
name: "{{ group_name }}"

View File

@@ -0,0 +1,68 @@
---
- 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
- name: Assign user to nonadmins group
openstack.cloud.group_assignment:
cloud: "{{ cloud }}"
state: present
user: ansible_user
group: nonadmins
register: group_assignment
- name: Assert group assignment
assert:
that:
- group_assignment is changed
- name: Assign user to nonadmins group again
openstack.cloud.group_assignment:
cloud: "{{ cloud }}"
state: present
user: ansible_user
group: nonadmins
register: group_assignment
- name: Assert group assignment
assert:
that:
- group_assignment is not changed
- name: Remove user from nonadmins group
openstack.cloud.group_assignment:
cloud: "{{ cloud }}"
state: absent
user: ansible_user
group: nonadmins
register: group_assignment
- name: Assert group assignment
assert:
that:
- group_assignment is changed
- name: Remove user from nonadmins group again
openstack.cloud.group_assignment:
cloud: "{{ cloud }}"
state: absent
user: ansible_user
group: nonadmins
register: group_assignment
- name: Assert group assignment
assert:
that:
- group_assignment is not changed
- name: Delete user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: absent
name: ansible_user

View File

@@ -0,0 +1,11 @@
expected_fields:
- availability_zone
- created_at
- deleted_at
- hosts
- id
- is_deleted
- metadata
- name
- updated_at
- uuid

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,6 @@
expected_fields:
- description
- id
- is_enabled
- name
- links

View File

@@ -0,0 +1,123 @@
---
- name: Create keystone domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: present
name: ansible_domain
description: "test description"
register: domain
- name: Assert return values of identity_domain module
assert:
that:
- domain.domain.name == 'ansible_domain'
- domain.domain.description == "test description"
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(domain.domain.keys())|length == 0
- name: Update keystone domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
name: ansible_domain
description: "updated description"
register: domain
- name: Assert updated domain
assert:
that:
- domain.domain.description == "updated description"
- name: Fetch domains
openstack.cloud.identity_domain_info:
cloud: "{{ cloud }}"
register: domains
- name: Assert return values of identity_domain_info module
assert:
that:
- domains.domains | length > 0
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(domains.domains.0.keys())|length == 0
- name: Fetch domain by name
openstack.cloud.identity_domain_info:
cloud: "{{ cloud }}"
name: ansible_domain
register: domains
- name: Assert named domain
assert:
that:
- domains.domains | length == 1
- name: Create disabled domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: present
name: ansible_domain_disabled
is_enabled: false
description: "test description"
register: domain
- name: Fetch all domains
openstack.cloud.identity_domain_info:
cloud: "{{ cloud }}"
register: domains
- name: Assert both ansible domains exist
assert:
that:
- domains.domains | length >= 2
- name: Fetch disabled domains
openstack.cloud.identity_domain_info:
cloud: "{{ cloud }}"
filters:
is_enabled: false
register: domains
- name: Assert at least one disabled domain exists
assert:
that:
- domains.domains | length >= 1
- name: Fetch enabled domains
openstack.cloud.identity_domain_info:
cloud: "{{ cloud }}"
filters:
is_enabled: true
register: domains
- name: Assert returned value
assert:
that:
- item.is_enabled
loop: "{{ domains.domains }}"
- name: Delete disabled domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: absent
name: ansible_domain_disabled
- name: Assert domain is disabled
assert:
that:
- not domain.domain.is_enabled
- name: Delete domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: absent
name: ansible_domain
- name: Get non-existing domain
openstack.cloud.identity_domain_info:
cloud: "{{ cloud }}"
name: ansible_domain
register: domains
- name: Assert no results returned
assert:
that:
- domains.domains | length == 0

View File

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

View File

@@ -0,0 +1,220 @@
---
- name: Create group
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: present
description: "ansible group"
name: ansible_group
register: group
- name: Assert return values of identity_group module
assert:
that:
- group.group.name == 'ansible_group'
- group.group.description == "ansible group"
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(group.group.keys())|length == 0
- name: Create group again
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: present
description: "ansible group"
name: ansible_group
register: group
- name: Assert group did not change
assert:
that:
- group is not changed
- name: Update group
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: present
name: ansible_group
description: "updated description"
register: group
- name: Assert changed
assert:
that:
- group is changed
- group.group.description == "updated description"
- name: Fetch all groups
openstack.cloud.identity_group_info:
cloud: "{{ cloud }}"
register: _groups
- name: Assert return values of identity_group_info module
assert:
that:
- _groups.groups | length > 0
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(_groups.groups.0.keys())|length == 0
- name: List group with filters
openstack.cloud.identity_group_info:
cloud: "{{ cloud }}"
domain: default
filters:
name: ansible_group
register: _groups
- name: Assert group with filters
assert:
that:
- _groups.groups | length == 1
- _groups.groups.0.id == group.group.id
- name: Create domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: present
name: ansible_domain
register: domain
- name: Create group in specific domain
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: present
name: ansible_group
domain_id: "{{ domain.domain.id }}"
register: group
- name: Assert results
assert:
that:
- group is changed
- group.group.domain_id == domain.domain.id
- name: List group by group name
openstack.cloud.identity_group_info:
cloud: "{{ cloud }}"
name: ansible_group
register: _groups
- name: Assert groups by group name
assert:
that:
- _groups.groups | length == 2
- name: List group by domain_id
openstack.cloud.identity_group_info:
cloud: "{{ cloud }}"
domain: ansible_domain
register: _groups
- name: Assert groups by domain_id
assert:
that:
- _groups.groups | length == 1
- _groups.groups.0.id == group.group.id
- _groups.groups.0.domain_id == domain.domain.id
- name: List group by domain_id and group name
openstack.cloud.identity_group_info:
cloud: "{{ cloud }}"
domain: ansible_domain
name: ansible_group
register: _groups
- name: Assert groups by domain_id and group name
assert:
that:
- _groups.groups | length == 1
- _groups.groups.0.id == group.group.id
- name: Create group in specific domain again
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: present
name: ansible_group
domain_id: "{{ domain.domain.id }}"
register: group
- name: Assert not changed
assert:
that:
- group is not changed
- name: Delete ambiguous group
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: absent
name: ansible_group
ignore_errors: true
register: group
- name: Assert failed
assert:
that:
- group is failed
- name: Delete group in specific domain
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: absent
name: ansible_group
domain_id: "{{ domain.domain.id }}"
register: group
- name: Assert changed
assert:
that:
- group is changed
- name: Delete group in specific domain again
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: absent
name: ansible_group
domain_id: "{{ domain.domain.id }}"
register: group
- name: Assert not changed
assert:
that:
- group is not changed
- name: Delete domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: absent
name: ansible_domain
- name: Delete group
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: absent
name: ansible_group
register: group
- name: Assert changed
assert:
that:
- group is changed
- name: Delete group again
openstack.cloud.identity_group:
cloud: "{{ cloud }}"
state: absent
name: ansible_group
register: group
- name: Assert not changed
assert:
that:
- group is not changed
- name: List group
openstack.cloud.identity_group_info:
cloud: "{{ cloud }}"
name: ansible_group
register: _groups
- name: Assert group does not exist
assert:
that:
- _groups.groups | length == 0

View File

@@ -0,0 +1,6 @@
expected_fields:
- description
- domain_id
- id
- links
- name

View File

@@ -0,0 +1,88 @@
---
- name: Create identity role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: present
name: ansible_role
description: "ansible role"
register: role
- name: Assert return values of identity_role module
assert:
that:
- role.role.name == 'ansible_role'
- role.role.description == "ansible role"
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(role.role.keys())|length == 0
- name: Try to get role
openstack.cloud.identity_role_info:
cloud: "{{ cloud }}"
name: ansible_role
register: roles
- name: Assert role found
assert:
that:
- roles.roles | length == 1
- roles.roles.0.name == 'ansible_role'
- name: Fetch all roles
openstack.cloud.identity_role_info:
cloud: "{{ cloud }}"
register: roles
- name: Assert return values of identity_role_info module
assert:
that:
- roles.roles | length > 0
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(roles.roles.0.keys())|length == 0
- name: Create identity role again
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: present
name: ansible_role
description: "ansible role"
register: role
- name: Assert role did not change
assert:
that:
- role is not changed
- name: Delete identity role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: absent
name: ansible_role
register: role
- name: Assert role changed
assert:
that:
- role is changed
- name: Try to get role
openstack.cloud.identity_role_info:
cloud: "{{ cloud }}"
name: ansible_role
register: roles
- name: Assert no role found
assert:
that:
- roles.roles | length == 0
- name: Delete role again
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: absent
name: ansible_role
register: role
- name: Assert role did not change
assert:
that:
- role is not changed

View File

@@ -0,0 +1,11 @@
expected_fields:
- default_project_id
- description
- domain_id
- email
- id
- is_enabled
- links
- name
- password
- password_expires_at

View File

@@ -0,0 +1,218 @@
---
- 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
description: "ansible user"
default_project: demo
register: user
- name: Assert return values of identity_user module
assert:
that:
- user.user.name == 'ansible_user'
- user.user.description == 'ansible user'
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(user.user.keys())|length == 0
- 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: true
- name: Assert that update failed
assert:
that:
- user is failed
- user.msg == "update_password is 'always' but password is missing"
- name: Delete user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: absent
name: ansible_user
- 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
- name: Create user with a password again
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: 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: Update user without password and update_password set to always
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: present
name: ansible_user
update_password: always
email: updated.ansible.user@nowhere.net
register: user
ignore_errors: true
- name: Assert user update failed
assert:
that:
- user is failed
- user.msg == "update_password is 'always' but password is missing"
- 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
- 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
- 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: Fetch users
openstack.cloud.identity_user_info:
cloud: "{{ cloud }}"
register: users
- name: Assert return values of identity_user_info module
assert:
that:
- users.users | length > 0
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(users.users.0.keys())|length == 0
- name: Fetch user by name
openstack.cloud.identity_user_info:
cloud: "{{ cloud }}"
name: ansible_user
register: users
- name: Assert named user
assert:
that:
- users.users | length == 1
- name: Delete user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: absent
name: ansible_user2
- name: Delete user
openstack.cloud.identity_user:
cloud: "{{ cloud }}"
state: absent
name: ansible_user
- name: Ensure user was changed
assert:
that:
- user is changed
- name: Delete user again
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
- name: Fetch ansible_user
openstack.cloud.identity_user_info:
cloud: "{{ cloud }}"
name: ansible_user
register: users
- name: Assert ansible_user does not exist
assert:
that:
- users.users | length == 0
- name: Fetch ansible_user2
openstack.cloud.identity_user_info:
cloud: "{{ cloud }}"
name: ansible_user2
register: users
- name: Assert ansible_user2 does not exist
assert:
that:
- users.users | length == 0

View File

@@ -1,4 +1,65 @@
image_name: ansible_image
image_tags:
- test
- ansible
expected_fields:
- architecture
- checksum
- container_format
- created_at
- direct_url
- disk_format
- file
- has_auto_disk_config
- hash_algo
- hash_value
- hw_cpu_cores
- hw_cpu_policy
- hw_cpu_sockets
- hw_cpu_thread_policy
- hw_cpu_threads
- hw_disk_bus
- hw_machine_type
- hw_qemu_guest_agent
- hw_rng_model
- hw_scsi_model
- hw_serial_port_count
- hw_video_model
- hw_video_ram
- hw_vif_model
- hw_watchdog_action
- hypervisor_type
- id
- instance_type_rxtx_factor
- instance_uuid
- is_hidden
- is_hw_boot_menu_enabled
- is_hw_vif_multiqueue_enabled
- is_protected
- kernel_id
- locations
- metadata
- min_disk
- min_ram
- name
- needs_config_drive
- needs_secure_boot
- os_admin_user
- os_command_line
- os_distro
- os_require_quiesce
- os_shutdown_timeout
- os_type
- os_version
- owner
- owner_id
- properties
- ramdisk_id
- schema
- size
- status
- store
- tags
- updated_at
- url
- virtual_size
- visibility
- vm_mode
- vmware_adaptertype
- vmware_ostype

View File

@@ -1,74 +1,348 @@
---
- name: Create a test image file
shell: mktemp
register: tmp_file
- name: Test images
block:
- name: List all images
openstack.cloud.image_info:
cloud: "{{ cloud }}"
register: images
- name: Fill test image file to 1MB
shell: truncate -s 1048576 {{ tmp_file.stdout }}
- name: Assert existence of CirrOS image
assert:
that:
- images.images | length > 0
- name: Create raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
filename: "{{ tmp_file.stdout }}"
disk_format: raw
tags: "{{ image_tags }}"
register: image
- name: Ensure clean environment
ansible.builtin.set_fact:
tmp_file: !!null
- name: Get details of created image
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: "{{ image_name }}"
register: image_info_result
- name: Create a test image file
ansible.builtin.tempfile:
register: tmp_file
- name: Verify image info
assert:
that:
- "image_info_result.openstack_image.name == image_name"
- "image_info_result.openstack_image.tags | sort == image_tags | sort"
- name: Fill test image file to 1MB
community.general.filesize:
path: '{{ tmp_file.path }}'
size: 1M
- name: Delete raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
- name: Calculating file checksum
ansible.builtin.stat:
path: "{{ tmp_file.path }}"
checksum_algorithm: sha512
get_checksum: true
register: image_details
- name: Create raw image (complex)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
filename: "{{ tmp_file.stdout }}"
disk_format: raw
is_public: True
min_disk: 10
min_ram: 1024
kernel: cirros-vmlinuz
ramdisk: cirros-initrd
properties:
cpu_arch: x86_64
distro: ubuntu
register: image
- name: Ensure mock kernel and ramdisk images (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: "{{ item }}"
filename: "{{ tmp_file.path }}"
disk_format: raw
loop:
- cirros-vmlinuz
- cirros-initrd
- name: Delete raw image (complex)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
- name: Create raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: ansible_image
filename: "{{ tmp_file.path }}"
is_protected: true
checksum: "{{ image_details.stat.checksum }}"
disk_format: raw
tags:
- test
- ansible
register: image
- name: Delete test image file
file:
name: "{{ tmp_file.stdout }}"
state: absent
- name: Assert changed
assert:
that:
- image is changed
- name: Try to get details of deleted image
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: "{{ image_name }}"
register: deleted_image_info_result
- name: Assert return values of image module
assert:
that:
- image is changed
- image.image.name == 'ansible_image'
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(image.image.keys())|length == 0
- name: Verify image is deleted
assert:
that:
- not deleted_image_info_result.openstack_image
- name: Get details of created image
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: ansible_image
register: images
- name: Assert return values of image_info module
assert:
that:
- images.images | length > 0
- images.images.0.name == "ansible_image"
- images.images.0.tags | sort == ['test', 'ansible'] | sort
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(images.images.0.keys())|length == 0
- name: Create raw image again (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: ansible_image
filename: "{{ tmp_file.path }}"
is_protected: true
disk_format: raw
tags:
- test
- ansible
register: image
- name: Assert not changed
assert:
that:
- image is not changed
- name: Update is_protected on raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: ansible_image
is_protected: false
register: image
- name: Assert changed
assert:
that:
- image is changed
- image.image.is_protected == false
- name: Assert changed
assert:
that:
- image is changed
- name: Update visibility on raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: ansible_image
is_public: false
register: image
- name: Assert changed
assert:
that:
- image.image.visibility == 'private'
- name: Update again visibility on raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: ansible_image
is_public: true
register: image
- name: Assert changed
assert:
that:
- image is changed
- image.image.visibility == 'public'
- name: Define visibility on raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: ansible_image
visibility: shared
register: image
- name: Assert changed
assert:
that:
- image is changed
- image.image.visibility == 'shared'
- name: Rename raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
id: "{{ image.image.id }}"
name: 'ansible_image-changed'
register: image
- name: Assert changed
assert:
that:
- image is changed
- image.image.name == 'ansible_image-changed'
- name: Rename back raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
id: "{{ image.image.id }}"
name: ansible_image
register: image
- name: Delete raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: ansible_image
register: image
- name: assert image changed
assert:
that:
- image is changed
- name: Delete raw image again (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: ansible_image
register: image
- name: assert image not changed
assert:
that:
- image is not changed
- name: Create raw image (complex)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: ansible_image
filename: "{{ tmp_file.path }}"
disk_format: raw
is_public: True
min_disk: 10
min_ram: 1024
# TODO(rcastillo): upload cirros-vmlinuz, cirros-initrd in test setup
kernel: cirros-vmlinuz
ramdisk: cirros-initrd
properties:
cpu_arch: x86_64
distro: ubuntu
register: image
- name: Assert visibility
assert:
that:
- image.image.visibility == 'public'
- name: Delete raw image (complex)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: ansible_image
- name: Try to get details of deleted image
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: ansible_image
register: images
- name: Verify image is deleted
assert:
that:
- images.images | length == 0
- name: Create owner project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: Project owning test image
domain: default
is_enabled: True
register: project
- name: Create raw image (owner by project name)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: ansible_image
filename: "{{ tmp_file.path }}"
disk_format: raw
tags:
- test
- ansible
project: ansible_project
register: image
- name: Get details of created image (owner by project name)
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: ansible_image
register: images
- name: Verify image owner (owner by project name)
assert:
that:
- images.images.0.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.path }}"
disk_format: raw
tags:
- test
- ansible
project: ansible_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: images
- name: Verify image owner (owner by project name and domain name)
assert:
that:
- images.images.0.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: ansible_project
domain: default
- name: Delete mock kernel and ramdisk images
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: "{{ item }}"
loop:
- cirros-vmlinuz
- cirros-initrd
- name: Delete test image file
file:
name: "{{ tmp_file.path }}"
state: absent
always:
- name: Remove temporary image file
ansible.builtin.file:
path: "{{ tmp_file.path }}"
state: absent
when: tmp_file is defined and 'path' in tmp_file

View File

@@ -0,0 +1,2 @@
[inventory]
enable_plugins=openstack.cloud.openstack

View File

@@ -0,0 +1,406 @@
---
- module_defaults:
group/openstack.cloud.openstack:
cloud: "{{ cloud }}"
# Listing modules individually is required for
# backward compatibility with Ansible 2.9 only
openstack.cloud.resource:
cloud: "{{ cloud }}"
openstack.cloud.resources:
cloud: "{{ cloud }}"
openstack.cloud.router:
cloud: "{{ cloud }}"
block:
- name: Create external network
openstack.cloud.resource:
service: network
type: network
attributes:
name: ansible_network_external
is_router_external: true
wait: true
register: network_external
- name: Create external subnet
openstack.cloud.resource:
service: network
type: subnet
attributes:
cidr: 10.6.6.0/24
ip_version: 4
name: ansible_external_subnet
network_id: "{{ network_external.resource.id }}"
register: subnet_external
- name: Create external port
openstack.cloud.resource:
service: network
type: port
attributes:
name: ansible_port_external
network_id: "{{ network_external.resource.id }}"
fixed_ips:
- ip_address: 10.6.6.50
non_updateable_attributes:
- fixed_ips
register: port_external
- name: Create internal network
openstack.cloud.resource:
service: network
type: network
attributes:
name: ansible_network_internal
is_router_external: false
wait: true
register: network_internal
- name: Create internal subnet
openstack.cloud.resource:
service: network
type: subnet
attributes:
cidr: 10.7.7.0/24
ip_version: 4
name: ansible_internal_subnet
network_id: "{{ network_internal.resource.id }}"
register: subnet_internal
- name: Create internal port 1
openstack.cloud.resource:
service: network
type: port
attributes:
name: ansible_port_internal1
network_id: "{{ network_internal.resource.id }}"
fixed_ips:
- ip_address: 10.7.7.100
subnet_id: "{{ subnet_internal.resource.id }}"
register: port_internal1
- name: Create internal port 2
openstack.cloud.resource:
service: network
type: port
attributes:
name: ansible_port_internal2
network_id: "{{ network_internal.resource.id }}"
fixed_ips:
- ip_address: 10.7.7.101
subnet_id: "{{ subnet_internal.resource.id }}"
register: port_internal2
- name: Create router
openstack.cloud.resource:
service: network
type: router
attributes:
name: ansible_router
external_gateway_info:
enable_snat: true
external_fixed_ips:
- ip_address: 10.6.6.10
subnet_id: "{{ subnet_external.resource.id }}"
network_id: "{{ network_external.resource.id }}"
wait: true
register: router
- name: Attach router to internal subnet
openstack.cloud.router:
name: ansible_router
network: "{{ network_external.resource.id }}"
external_fixed_ips:
- ip: 10.6.6.10
subnet: "{{ subnet_external.resource.id }}"
interfaces:
- net: "{{ network_internal.resource.id }}"
subnet: "{{ subnet_internal.resource.id }}"
portip: 10.7.7.1
- name: Create floating ip address 1
openstack.cloud.resource:
service: network
type: ip
attributes:
name: 10.6.6.150
floating_ip_address: 10.6.6.150
floating_network_id: "{{ network_external.resource.id }}"
port_id: "{{ port_internal1.resource.id }}"
register: ip1
- name: List images
openstack.cloud.resources:
service: image
type: image
register: images
- name: Identify CirrOS image id
set_fact:
image_id: "{{ images.resources|community.general.json_query(query)|first }}"
vars:
query: "[?starts_with(name, 'cirros')].id"
- name: List compute flavors
openstack.cloud.resources:
service: compute
type: flavor
register: flavors
- name: Identify m1.tiny flavor id
set_fact:
flavor_id: "{{ flavors.resources|community.general.json_query(query)|first }}"
vars:
query: "[?name == 'm1.tiny'].id"
- name: Create server 1
openstack.cloud.resource:
service: compute
type: server
attributes:
name: ansible_server1
image_id: "{{ image_id }}"
flavor_id: "{{ flavor_id }}"
networks:
- uuid: "{{ network_internal.resource.id }}"
port: "{{ port_internal1.resource.id }}"
- uuid: "{{ network_internal.resource.id }}"
port: "{{ port_internal2.resource.id }}"
non_updateable_attributes:
- name
- image_id
- flavor_id
- networks
wait: true
register: server1
- name: Create server 2
openstack.cloud.resource:
service: compute
type: server
attributes:
name: ansible_server2
image_id: "{{ image_id }}"
flavor_id: "{{ flavor_id }}"
networks:
- uuid: "{{ network_internal.resource.id }}"
non_updateable_attributes:
- name
- image_id
- flavor_id
- networks
wait: true
register: server2
- name: Run inventory plugin tests
always:
- name: Remove temporary inventory directory after block execution
ansible.builtin.file:
path: "{{ tmp_dir.path }}"
state: absent
when: tmp_dir is defined and 'path' in tmp_dir
block:
- name: Ensure clean environment
ansible.builtin.set_fact:
tmp_dir: !!null
- name: Create temporary inventory directory
ansible.builtin.tempfile:
state: directory
register: tmp_dir
- name: Copy ansible.cfg file
ansible.builtin.copy:
src: ansible.cfg
dest: '{{ tmp_dir.path }}/'
mode: '0644'
- name: Create inventory config file
ansible.builtin.template:
src: openstack.yaml.j2
dest: '{{ tmp_dir.path }}/openstack.yaml'
mode: '0644'
- name: List servers with inventory plugin
ansible.builtin.command:
cmd: ansible-inventory --list --yaml --inventory-file openstack.yaml
chdir: "{{ tmp_dir.path }}"
environment:
ANSIBLE_INVENTORY_CACHE: "True"
ANSIBLE_INVENTORY_CACHE_PLUGIN: "jsonfile"
ANSIBLE_CACHE_PLUGIN_CONNECTION: "{{ tmp_dir.path }}/.cache/"
register: inventory
- name: Read YAML output from inventory plugin
ansible.builtin.set_fact:
inventory: "{{ inventory.stdout | from_yaml }}"
- name: Check YAML output from inventory plugin
assert:
that:
- inventory.all.children.RegionOne.hosts.keys() | sort == ['ansible_server1', 'ansible_server2'] | sort
- ansible_server1.ansible_host == '10.6.6.150'
- "'10.7.7.' in ansible_server2.ansible_host"
- ansible_server1.ci_compose_id == ansible_server1.openstack.id
- ansible_server1.ci_compose_project_id == ansible_server1.openstack.project_id
vars:
ansible_server1: "{{
(inventory.all.children.values()
| map(attribute='hosts', default={})
| map(attribute='ansible_server1', default={})
| reject('equalto', {})
| list
)[0] }}"
ansible_server2: "{{
(inventory.all.children.values()
| map(attribute='hosts', default={})
| map(attribute='ansible_server2', default={})
| reject('equalto', {})
| list
)[0] }}"
- name: Find Ansible's cache file
ansible.builtin.find:
paths: "{{ tmp_dir.path }}/.cache/"
patterns: 'ansible_inventory_*'
register: files
- name: Assert a single cache file only
assert:
that:
- files.files | length == 1
- name: Read Ansible's cache file
ansible.builtin.slurp:
src: "{{ files.files.0.path }}"
register: cache
- name: Process Ansible cache
ansible.builtin.set_fact:
cache: "{{ cache.content | b64decode | from_yaml }}"
- name: Check Ansible's cache
assert:
that:
- cache | map(attribute='name') | list | sort == ['ansible_server1', 'ansible_server2'] | sort
- name: List servers with inventory plugin again
ansible.builtin.command:
cmd: ansible-inventory --list --yaml --inventory-file openstack.yaml
chdir: "{{ tmp_dir.path }}"
environment:
ANSIBLE_INVENTORY_CACHE: "True"
ANSIBLE_INVENTORY_CACHE_PLUGIN: "jsonfile"
ANSIBLE_CACHE_PLUGIN_CONNECTION: "{{ tmp_dir.path }}/.cache/"
register: inventory
- name: Read YAML output from inventory plugin again
ansible.builtin.set_fact:
inventory: "{{ inventory.stdout | from_yaml }}"
- name: Check YAML output from inventory plugin again
assert:
that:
- inventory.all.children.RegionOne.hosts.keys() | sort == ['ansible_server1', 'ansible_server2'] | sort
- name: Delete server 2
openstack.cloud.resource:
service: compute
type: server
attributes:
name: ansible_server2
state: absent
wait: true
- name: Delete server 1
openstack.cloud.resource:
service: compute
type: server
attributes:
name: ansible_server1
state: absent
wait: true
- name: Delete floating ip address 1
openstack.cloud.resource:
service: network
type: ip
attributes:
floating_ip_address: 10.6.6.150
state: absent
- name: Detach router from internal subnet
openstack.cloud.router:
name: ansible_router
network: "{{ network_external.resource.id }}"
external_fixed_ips:
- ip: 10.6.6.10
subnet: "{{ subnet_external.resource.id }}"
interfaces: []
- name: Delete router
openstack.cloud.resource:
service: network
type: router
attributes:
name: ansible_router
state: absent
wait: true
- name: Delete internal port 2
openstack.cloud.resource:
service: network
type: port
attributes:
name: ansible_port_internal2
state: absent
- name: Delete internal port 1
openstack.cloud.resource:
service: network
type: port
attributes:
name: ansible_port_internal1
state: absent
- name: Delete internal subnet
openstack.cloud.resource:
service: network
type: subnet
attributes:
name: ansible_internal_subnet
state: absent
- name: Delete internal network
openstack.cloud.resource:
service: network
type: network
attributes:
name: ansible_network_internal
state: absent
wait: true
- name: Delete external port
openstack.cloud.resource:
service: network
type: port
attributes:
name: ansible_port_external
state: absent
- name: Delete external subnet
openstack.cloud.resource:
service: network
type: subnet
attributes:
name: ansible_external_subnet
state: absent
- name: Delete external network
openstack.cloud.resource:
service: network
type: network
attributes:
name: ansible_network_external
state: absent
wait: true

View File

@@ -0,0 +1,11 @@
plugin: openstack.cloud.openstack
all_projects: true
compose:
ci_compose_id: openstack.id
ci_compose_project_id: openstack.project_id
expand_hostvars: true
fail_on_errors: true
only_clouds:
- "{{ cloud }}"
strict: true

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,13 +1,23 @@
---
- 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 keypairs
- name: Assert fields
assert:
that:
- item in keypair.keypair
loop: "{{ expected_fields }}"
- 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 }}"
@@ -16,19 +26,37 @@
- name: Ensure that list of keypairs contains single element
assert:
that:
- keypairs['openstack_keypairs']|length == 1
- keypairs['keypairs']|length == 1
# This assert verifies that Ansible is capable serializing data returned by SDK
- name: Ensure private key is returned
- name: Assert fields
assert:
that:
- keypair.key.public_key is defined and keypair.key.public_key
- item in keypairs.keypairs.0.keys()
loop: "{{ expected_fields }}"
# This assert verifies that Ansible is capable serializing data returned by SDK
- name: Ensure public key is returned
assert:
that:
- keypair.keypair.public_key is defined and keypair.keypair.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:
@@ -39,20 +67,26 @@
- name: Ensure that list of keypairs is empty
assert:
that:
- keypairs['openstack_keypairs']|length == 0
- keypairs['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: true
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:
@@ -63,13 +97,13 @@
- name: Ensure that list of keypairs contains single element
assert:
that:
- keypairs['openstack_keypairs']|length == 1
- keypairs['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:
@@ -80,14 +114,14 @@
- name: Ensure that list of keypairs is empty
assert:
that:
- keypairs['openstack_keypairs']|length == 0
- keypairs['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:
@@ -98,13 +132,13 @@
- name: Ensure that list of keypairs contains single element
assert:
that:
- keypairs['openstack_keypairs']|length == 1
- keypairs['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:
@@ -115,14 +149,14 @@
- name: Ensure that list of keypairs is empty
assert:
that:
- keypairs['openstack_keypairs']|length == 0
- keypairs['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 +0,0 @@
domain_name: ansible_domain

View File

@@ -1,19 +0,0 @@
---
- name: Create keystone domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: present
name: "{{ domain_name }}"
description: "test description"
- name: Update keystone domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
name: "{{ domain_name }}"
description: "updated description"
- name: Delete keystone domain
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
state: absent
name: "{{ domain_name }}"

View File

@@ -1,35 +1,4 @@
protocol_name: 'test-protocol'
protocol_name_2: 'test-protocol-2'
# Minimal IDP definition
idp_name: 'test-idp'
idp_remote_ids:
- 'https://auth.example.com/auth/realms/ExampleRealm'
# Minimal Domain definition
domain_name: 'test-domain'
# Minimal Mapping definition
mapping_name_1: 'ansible-test-mapping-1'
mapping_name_2: 'ansible-test-mapping-2'
mapping_rules_1:
- local:
- group:
domain:
name: example_domain
name: example-group
remote:
- type: HTTP_OIDC_GROUPS
any_one_of:
- group1
- group2
mapping_rules_2:
- local:
- group:
domain:
name: example_domain
name: example_group
remote:
- type: HTTP_OIDC_GROUPS
any_one_of:
- group1
expected_fields:
- id
- mapping_id
- name

View File

@@ -6,388 +6,336 @@
# - Retry change (noop)
#
- module_defaults:
# meta/action_groups.yml glue seems to be missing
# group/os:
# cloud: "{{ cloud }}"
group/openstack.cloud.openstack:
cloud: "{{ cloud }}"
openstack.cloud.keystone_federation_protocol:
cloud: "{{ cloud }}" # Backward compatibility with Ansible 2.9
idp_id: ansible_idp
openstack.cloud.keystone_federation_protocol_info:
cloud: "{{ cloud }}" # Backward compatibility with Ansible 2.9
idp_id: ansible_idp
# Backward compatibility with Ansible 2.9
openstack.cloud.identity_domain:
cloud: "{{ cloud }}"
openstack.cloud.federation_idp:
cloud: "{{ cloud }}"
openstack.cloud.federation_mapping:
cloud: "{{ cloud }}"
openstack.cloud.keystone_federation_protocol:
cloud: "{{ cloud }}"
idp_id: "{{ idp_name }}"
openstack.cloud.keystone_federation_protocol_info:
cloud: "{{ cloud }}"
idp_id: "{{ idp_name }}"
block:
# ========================================================================
# Initial setup
- name: 'Create test Domain'
- name: Create test Domain
openstack.cloud.identity_domain:
name: '{{ domain_name }}'
register: create_domain
- assert:
that:
- create_domain is successful
- '"id" in create_domain'
- name: 'Store domain ID as fact'
set_fact:
domain_id: '{{ create_domain.id }}'
name: ansible_domain
register: domain
- name: 'Create test Identity Provider'
- name: Create test Identity Provider
openstack.cloud.federation_idp:
state: 'present'
name: '{{ idp_name }}'
domain_id: '{{ domain_id }}'
register: create_idp
- assert:
that:
- create_idp is successful
state: present
name: ansible_idp
domain_id: '{{ domain.domain.id }}'
- name: 'Create test mapping (1)'
- name: Create test mapping (1)
openstack.cloud.federation_mapping:
state: 'present'
name: '{{ mapping_name_1 }}'
rules: '{{ mapping_rules_1 }}'
register: create_mapping
- assert:
that:
- create_mapping is successful
- name: 'Create test mapping (2)'
state: present
name: ansible_mapping1
rules:
- local:
- group:
domain:
name: example_domain
name: example-group
remote:
- type: HTTP_OIDC_GROUPS
any_one_of:
- group1
- group2
- name: Create test mapping (2)
openstack.cloud.federation_mapping:
state: 'present'
name: '{{ mapping_name_2 }}'
rules: '{{ mapping_rules_2 }}'
register: create_mapping
- assert:
that:
- create_mapping is successful
state: present
name: ansible_mapping2
rules:
- local:
- group:
domain:
name: example_domain
name: example_group
remote:
- type: HTTP_OIDC_GROUPS
any_one_of:
- group1
# We *should* have a blank slate to start with, but we also shouldn't
# explode if I(state=absent) and the IDP doesn't exist
- name: "Ensure Protocol doesn't exist to start"
- name: Ensure Protocol does not exist to start
openstack.cloud.keystone_federation_protocol:
state: 'absent'
name: '{{ protocol_name }}'
register: delete_protocol
- assert:
that:
- delete_protocol is successful
state: absent
name: ansible_protocol1
# ========================================================================
# Creation
- name: 'Create protocol - CHECK MODE'
check_mode: yes
- name: Create protocol - CHECK MODE
check_mode: true
openstack.cloud.keystone_federation_protocol:
state: 'present'
name: '{{ protocol_name }}'
mapping_id: '{{ mapping_name_1 }}'
register: create_protocol
state: present
name: ansible_protocol1
mapping_id: ansible_mapping1
register: protocol
- assert:
that:
- create_protocol is successful
- create_protocol is changed
- protocol is changed
- name: 'Fetch Protocol info (should be absent)'
- name: Fetch Protocol info (should be absent)
openstack.cloud.keystone_federation_protocol_info:
name: '{{ protocol_name }}'
register: protocol_info
ignore_errors: yes
- assert:
that:
- protocol_info is failed
name: ansible_protocol1
register: protocols
- name: 'Create protocol'
openstack.cloud.keystone_federation_protocol:
state: 'present'
name: '{{ protocol_name }}'
mapping_id: '{{ mapping_name_1 }}'
register: create_protocol
- assert:
that:
- create_protocol is successful
- create_protocol is changed
- '"protocol" in create_protocol'
- '"id" in protocol'
- '"name" in protocol'
- '"idp_id" in protocol'
- '"mapping_id" in protocol'
- protocol.id == protocol_name
- protocol.name == protocol_name
- protocol.idp_id == idp_name
- protocol.mapping_id == mapping_name_1
vars:
protocol: '{{ create_protocol.protocol }}'
- protocols.protocols | length == 0
- name: 'Create protocol (retry - no change) - CHECK MODE'
check_mode: yes
- name: Create protocol
openstack.cloud.keystone_federation_protocol:
state: 'present'
name: '{{ protocol_name }}'
mapping_id: '{{ mapping_name_1 }}'
register: create_protocol
- assert:
that:
- create_protocol is successful
- create_protocol is not changed
state: present
name: ansible_protocol1
mapping_id: ansible_mapping1
register: protocol
- name: 'Create protocol (retry - no change)'
openstack.cloud.keystone_federation_protocol:
state: 'present'
name: '{{ protocol_name }}'
mapping_id: '{{ mapping_name_1 }}'
register: create_protocol
- assert:
that:
- create_protocol is successful
- create_protocol is not changed
- '"protocol" in create_protocol'
- '"id" in protocol'
- '"name" in protocol'
- '"idp_id" in protocol'
- '"mapping_id" in protocol'
- protocol.id == protocol_name
- protocol.name == protocol_name
- protocol.idp_id == idp_name
- protocol.mapping_id == mapping_name_1
vars:
protocol: '{{ create_protocol.protocol }}'
- protocol is changed
- protocol.protocol.id == 'ansible_protocol1'
- protocol.protocol.name == 'ansible_protocol1'
- protocol.protocol.mapping_id == 'ansible_mapping1'
- name: assert return values of keystone_federation_protocol module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(protocol.protocol.keys())|length == 0
- name: Create protocol (retry - no change) - CHECK MODE
check_mode: true
openstack.cloud.keystone_federation_protocol:
state: present
name: ansible_protocol1
mapping_id: ansible_mapping1
register: protocol
- assert:
that:
- protocol is not changed
- name: Create protocol (retry - no change)
openstack.cloud.keystone_federation_protocol:
state: present
name: ansible_protocol1
mapping_id: ansible_mapping1
register: protocol
- assert:
that:
- protocol is not changed
- protocol.protocol.id == 'ansible_protocol1'
- protocol.protocol.name == 'ansible_protocol1'
- protocol.protocol.mapping_id == 'ansible_mapping1'
# ========================================================================
# Update
- name: 'Update protocol - CHECK MODE'
check_mode: yes
- name: Update protocol - CHECK MODE
check_mode: true
openstack.cloud.keystone_federation_protocol:
state: 'present'
name: '{{ protocol_name }}'
mapping_id: '{{ mapping_name_2 }}'
register: update_protocol
- assert:
that:
- update_protocol is successful
- update_protocol is changed
state: present
name: ansible_protocol1
mapping_id: ansible_mapping2
register: protocol
- name: 'Update protocol'
openstack.cloud.keystone_federation_protocol:
state: 'present'
name: '{{ protocol_name }}'
mapping_id: '{{ mapping_name_2 }}'
register: update_protocol
- assert:
that:
- update_protocol is successful
- update_protocol is changed
- '"protocol" in update_protocol'
- '"id" in protocol'
- '"name" in protocol'
- '"idp_id" in protocol'
- '"mapping_id" in protocol'
- protocol.id == protocol_name
- protocol.name == protocol_name
- protocol.idp_id == idp_name
- protocol.mapping_id == mapping_name_2
vars:
protocol: '{{ update_protocol.protocol }}'
- protocol is changed
- name: 'Update protocol (retry - no change) - CHECK MODE'
check_mode: yes
- name: Update protocol
openstack.cloud.keystone_federation_protocol:
state: 'present'
name: '{{ protocol_name }}'
mapping_id: '{{ mapping_name_2 }}'
register: update_protocol
- assert:
that:
- update_protocol is successful
- update_protocol is not changed
state: present
name: ansible_protocol1
mapping_id: ansible_mapping2
register: protocol
- name: 'Update protocol (retry - no change)'
openstack.cloud.keystone_federation_protocol:
state: 'present'
name: '{{ protocol_name }}'
mapping_id: '{{ mapping_name_2 }}'
register: update_protocol
- assert:
that:
- update_protocol is successful
- update_protocol is not changed
- '"protocol" in update_protocol'
- '"id" in protocol'
- '"name" in protocol'
- '"idp_id" in protocol'
- '"mapping_id" in protocol'
- protocol.id == protocol_name
- protocol.name == protocol_name
- protocol.idp_id == idp_name
- protocol.mapping_id == mapping_name_2
vars:
protocol: '{{ update_protocol.protocol }}'
- protocol is changed
- protocol.protocol.id == 'ansible_protocol1'
- protocol.protocol.name == 'ansible_protocol1'
- protocol.protocol.mapping_id == 'ansible_mapping2'
- name: Update protocol (retry - no change) - CHECK MODE
check_mode: true
openstack.cloud.keystone_federation_protocol:
state: present
name: ansible_protocol1
mapping_id: ansible_mapping2
register: protocol
- assert:
that:
- protocol is not changed
- name: Update protocol (retry - no change)
openstack.cloud.keystone_federation_protocol:
state: present
name: ansible_protocol1
mapping_id: ansible_mapping2
register: protocol
- assert:
that:
- protocol is not changed
- protocol.protocol.id == 'ansible_protocol1'
- protocol.protocol.name == 'ansible_protocol1'
- protocol.protocol.mapping_id == 'ansible_mapping2'
# ========================================================================
# Create second protocol to test openstack.cloud.keystone_federation_protocol_info
- name: 'Create protocol (2)'
- name: Create protocol (2)
openstack.cloud.keystone_federation_protocol:
state: 'present'
name: '{{ protocol_name_2 }}'
mapping_id: '{{ mapping_name_1 }}'
register: create_protocol_2
state: present
name: ansible_protocol2
mapping_id: ansible_mapping1
register: protocol
- assert:
that:
- create_protocol_2 is successful
- create_protocol_2 is changed
- '"protocol" in create_protocol_2'
- '"id" in protocol'
- '"name" in protocol'
- '"idp_id" in protocol'
- '"mapping_id" in protocol'
- protocol.id == protocol_name_2
- protocol.name == protocol_name_2
- protocol.idp_id == idp_name
- protocol.mapping_id == mapping_name_1
vars:
protocol: '{{ create_protocol_2.protocol }}'
- protocol is changed
- protocol.protocol.id == 'ansible_protocol2'
- protocol.protocol.name == 'ansible_protocol2'
- protocol.protocol.mapping_id == 'ansible_mapping1'
# ========================================================================
# Basic tests of openstack.cloud.keystone_federation_protocol_info
- name: 'Fetch Protocol info (a specific protocol)'
- name: Fetch Protocol info (a specific protocol)
openstack.cloud.keystone_federation_protocol_info:
name: '{{ protocol_name }}'
register: protocol_info
name: ansible_protocol1
register: protocols
- name: Check info about protocols
assert:
that:
- protocols.protocols|length > 0
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(protocols.protocols[0].keys())|length == 0
- assert:
that:
- protocol_info is successful
- '"protocols" in protocol_info'
- protocol_info.protocols | length == 1
- '"id" in protocol'
- '"name" in protocol'
- '"idp_id" in protocol'
- '"mapping_id" in protocol'
- protocol.id == protocol_name
- protocol.name == protocol_name
- protocol.idp_id == idp_name
- protocol.mapping_id == mapping_name_2
vars:
protocol: '{{ protocol_info.protocols[0] }}'
- protocols.protocols[0].id == 'ansible_protocol1'
- protocols.protocols[0].name == 'ansible_protocol1'
- protocols.protocols[0].mapping_id == 'ansible_mapping2'
- name: 'Fetch Protocol info (all protocols on our test IDP)'
- name: Fetch Protocol info (all protocols on our test IDP)
openstack.cloud.keystone_federation_protocol_info: {}
# idp_id defined in defaults at the start
register: protocol_info
register: protocols
- assert:
that:
- protocol_info is successful
- '"protocols" in protocol_info'
# We created the IDP, and we're going to delete it:
# we should be able to trust what's attached to it
- protocol_info.protocols | length == 2
- '"id" in protocol_1'
- '"name" in protocol_1'
- '"idp_id" in protocol_1'
- '"mapping_id" in protocol_1'
- '"id" in protocol_2'
- '"name" in protocol_2'
- '"idp_id" in protocol_2'
- '"mapping_id" in protocol_2'
- protocol_name in (protocol_info.protocols | map(attribute='id'))
- protocol_name in (protocol_info.protocols | map(attribute='id'))
- protocol_name_2 in (protocol_info.protocols | map(attribute='name'))
- protocol_name_2 in (protocol_info.protocols | map(attribute='name'))
- mapping_name_1 in (protocol_info.protocols | map(attribute='mapping_id'))
- mapping_name_2 in (protocol_info.protocols | map(attribute='mapping_id'))
- protocol_1.idp_id == idp_name
- protocol_2.idp_id == idp_name
vars:
protocol_1: '{{ protocol_info.protocols[0] }}'
protocol_2: '{{ protocol_info.protocols[1] }}'
# We created the IDP, and we're going to delete it:
# we should be able to trust what's attached to it
- protocols.protocols | length == 2
- "'ansible_protocol1' in (protocols.protocols | map(attribute='id'))"
- "'ansible_protocol1' in (protocols.protocols | map(attribute='id'))"
- "'ansible_protocol2' in (protocols.protocols | map(attribute='name'))"
- "'ansible_protocol2' in (protocols.protocols | map(attribute='name'))"
- "'ansible_mapping1' in (protocols.protocols | map(attribute='mapping_id'))"
- "'ansible_mapping2' in (protocols.protocols | map(attribute='mapping_id'))"
# ========================================================================
# Deletion
- name: 'Delete protocol - CHECK MODE'
check_mode: yes
- name: Delete protocol - CHECK MODE
check_mode: true
openstack.cloud.keystone_federation_protocol:
state: 'absent'
name: '{{ protocol_name }}'
register: update_protocol
- assert:
that:
- update_protocol is successful
- update_protocol is changed
state: absent
name: ansible_protocol1
register: protocol
- name: 'Delete protocol'
openstack.cloud.keystone_federation_protocol:
state: 'absent'
name: '{{ protocol_name }}'
register: update_protocol
- assert:
that:
- update_protocol is successful
- update_protocol is changed
- protocol is changed
- name: 'Delete protocol (retry - no change) - CHECK MODE'
check_mode: yes
- name: Delete protocol
openstack.cloud.keystone_federation_protocol:
state: 'absent'
name: '{{ protocol_name }}'
register: update_protocol
- assert:
that:
- update_protocol is successful
- update_protocol is not changed
state: absent
name: ansible_protocol1
register: protocol
- name: 'Delete protocol (retry - no change)'
openstack.cloud.keystone_federation_protocol:
state: 'absent'
name: '{{ protocol_name }}'
register: update_protocol
- assert:
that:
- update_protocol is successful
- update_protocol is not changed
- protocol is changed
- name: Delete protocol (retry - no change) - CHECK MODE
check_mode: true
openstack.cloud.keystone_federation_protocol:
state: absent
name: ansible_protocol1
register: protocol
- assert:
that:
- protocol is not changed
- name: Delete protocol (retry - no change)
openstack.cloud.keystone_federation_protocol:
state: absent
name: ansible_protocol1
register: protocol
- assert:
that:
- protocol is not changed
# ========================================================================
# Clean up after ourselves
always:
- name: 'Delete protocol'
- name: Delete protocol
openstack.cloud.keystone_federation_protocol:
state: 'absent'
name: '{{ protocol_name }}'
idp_id: '{{ idp_name }}'
ignore_errors: yes
state: absent
name: ansible_protocol1
idp_id: ansible_idp
ignore_errors: true
- name: 'Delete protocol (2)'
- name: Delete protocol (2)
openstack.cloud.keystone_federation_protocol:
state: 'absent'
name: '{{ protocol_name_2 }}'
idp_id: '{{ idp_name }}'
ignore_errors: yes
state: absent
name: ansible_protocol2
idp_id: ansible_idp
ignore_errors: true
- name: 'Delete mapping 1'
- name: Delete mapping 1
openstack.cloud.federation_mapping:
state: 'absent'
name: '{{ mapping_name_1 }}'
ignore_errors: yes
state: absent
name: ansible_mapping1
ignore_errors: true
- name: 'Delete mapping 2'
- name: Delete mapping 2
openstack.cloud.federation_mapping:
state: 'absent'
name: '{{ mapping_name_2 }}'
ignore_errors: yes
state: absent
name: ansible_mapping2
ignore_errors: true
- name: 'Delete idp'
- name: Delete idp
openstack.cloud.federation_idp:
state: 'absent'
name: '{{ idp_name }}'
ignore_errors: yes
state: absent
name: ansible_idp
ignore_errors: true
- name: 'Delete domain'
- name: Delete domain
openstack.cloud.identity_domain:
state: 'absent'
name: '{{ domain_name }}'
ignore_errors: yes
state: absent
name: ansible_domain
ignore_errors: true

View File

@@ -1,13 +1,14 @@
idp_name: 'test-idp'
idp_name_2: 'test-idp-2'
idp_description: 'My example IDP'
idp_description_2: 'My example Identity Provider'
domain_name: 'test-domain'
expected_fields:
- description
- domain_id
- id
- is_enabled
- name
- remote_ids
remote_ids_1:
- 'https://auth.example.com/auth/realms/ExampleRealm'
- 'https://auth.stage.example.com/auth/realms/ExampleRealm'
- 'https://auth.example.com/auth/realms/ExampleRealm'
- 'https://auth.stage.example.com/auth/realms/ExampleRealm'
remote_ids_2:
- 'https://auth.example.com/auth/realms/ExampleRealm'
- 'https://auth.example.com/auth/realms/ExampleRealm'
remote_ids_3:
- 'https://auth.stage.example.com/auth/realms/ExampleRealm'
- 'https://auth.stage.example.com/auth/realms/ExampleRealm'

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -1,35 +0,0 @@
---
- name: Create keystone role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: present
name: "{{ role_name }}"
- name: List keystone roles
openstack.cloud.identity_role_info:
cloud: "{{ cloud }}"
register: roles
- name: Check roles
assert:
that:
- roles.openstack_roles | length > 0
- "'{{ role_name }}' in (roles.openstack_roles | map(attribute='name') | list)"
- name: List keystone roles by name
openstack.cloud.identity_role_info:
cloud: "{{ cloud }}"
name: "{{ role_name}}"
register: roles1
- name: Check roles
assert:
that:
- roles1.openstack_roles | length == 1
- roles1.openstack_roles[0]['name'] == role_name
- name: Delete keystone role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: absent
name: "{{ role_name }}"

View File

@@ -1,3 +1,22 @@
network_name: network_lb
subnet_name: subnet_lb
lb_name: test_lb
expected_fields:
- additional_vips
- availability_zone
- created_at
- description
- flavor_id
- id
- is_admin_state_up
- listeners
- name
- operating_status
- pools
- project_id
- provider
- provisioning_status
- tags
- updated_at
- vip_address
- vip_network_id
- vip_port_id
- vip_qos_policy_id
- vip_subnet_id

View File

@@ -0,0 +1,322 @@
---
- name: Create external network
openstack.cloud.network:
cloud: "{{ cloud }}"
external: true
name: ansible_external_network
state: present
- 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 }}"
name: ansible_internal_network
state: present
- 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 load-balancer
openstack.cloud.loadbalancer:
assign_floating_ip: true
cloud: "{{ cloud }}"
floating_ip_network: ansible_external_network
name: ansible_lb
state: present
timeout: 450
vip_subnet: ansible_internal_subnet
register: load_balancer
- name: Create load-balancer listener
openstack.cloud.lb_listener:
cloud: "{{ cloud }}"
load_balancer: ansible_lb
name: ansible_listener
protocol: HTTP
protocol_port: 8080
state: present
register: listener
- name: Assert return values of lb_listener module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- "['allowed_cidrs', 'alpn_protocols', 'connection_limit', 'created_at', 'default_pool', 'default_pool_id',
'default_tls_container_ref', 'description', 'id', 'insert_headers', 'is_admin_state_up', 'l7_policies',
'load_balancer_id', 'load_balancers', 'name', 'operating_status', 'project_id', 'protocol', 'protocol_port',
'provisioning_status', 'sni_container_refs', 'tags', 'timeout_client_data', 'timeout_member_connect',
'timeout_member_data', 'timeout_tcp_inspect', 'tls_ciphers', 'tls_versions', 'updated_at'
]|difference(listener.listener.keys())|length == 0"
- name: Create load-balancer listener again
openstack.cloud.lb_listener:
cloud: "{{ cloud }}"
load_balancer: ansible_lb
name: ansible_listener
protocol: HTTP
protocol_port: 8080
state: present
register: listener
- name: Assert return values of lb_listener module
assert:
that:
- listener is not changed
- name: Update load-balancer listener description
openstack.cloud.lb_listener:
cloud: "{{ cloud }}"
description: "Ansible load-balancer listener"
load_balancer: ansible_lb
name: ansible_listener
protocol: HTTP
protocol_port: 8080
state: present
register: listener
- name: Assert return values of lb_listener module
assert:
that:
- listener.listener.description == "Ansible load-balancer listener"
- name: Create load-balancer pool
openstack.cloud.lb_pool:
cloud: "{{ cloud }}"
lb_algorithm: ROUND_ROBIN
listener: "{{ listener.listener.id }}"
name: ansible_pool
protocol: HTTP
state: present
register: pool
- name: Assert return values of lb_pool module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- "['alpn_protocols', 'created_at', 'description', 'health_monitor_id', 'id', 'is_admin_state_up', 'lb_algorithm',
'listener_id', 'listeners', 'loadbalancer_id', 'loadbalancers', 'members','name', 'operating_status',
'project_id', 'protocol', 'provisioning_status', 'session_persistence', 'tags', 'tls_ciphers', 'tls_enabled',
'tls_versions', 'updated_at'
]|difference(pool.pool.keys())|length == 0"
- name: Create load-balancer pool again
openstack.cloud.lb_pool:
cloud: "{{ cloud }}"
lb_algorithm: ROUND_ROBIN
listener: "{{ listener.listener.id }}"
name: ansible_pool
protocol: HTTP
state: present
register: pool
- name: Assert return values of lb_pool module
assert:
that:
- pool is not changed
- name: Update load-balancer pool description
openstack.cloud.lb_pool:
cloud: "{{ cloud }}"
description: "Ansible load-balancer pool"
lb_algorithm: ROUND_ROBIN
listener: "{{ listener.listener.id }}"
name: ansible_pool
protocol: HTTP
state: present
register: pool
- name: Assert return values of lb_pool module
assert:
that:
- pool.pool.description == "Ansible load-balancer pool"
- name: Create load-balancer pool member
openstack.cloud.lb_member:
address: 10.7.7.42
cloud: "{{ cloud }}"
name: ansible_member
pool: ansible_pool
protocol_port: 8080
state: present
register: member
- name: Assert return values of lb_member module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- "['address', 'backup', 'created_at', 'id', 'is_admin_state_up', 'monitor_address', 'monitor_port', 'name',
'operating_status', 'project_id', 'protocol_port', 'provisioning_status', 'subnet_id', 'tags', 'updated_at',
'weight'
]|difference(member.member.keys())|length == 0"
- name: Create load-balancer pool member again
openstack.cloud.lb_member:
address: 10.7.7.42
cloud: "{{ cloud }}"
name: ansible_member
pool: ansible_pool
protocol_port: 8080
state: present
register: member
- name: Assert return values of lb_member module
assert:
that:
- member is not changed
- name: Update load-balancer pool member weight
openstack.cloud.lb_member:
address: 10.7.7.42
cloud: "{{ cloud }}"
name: ansible_member
pool: ansible_pool
protocol_port: 8080
state: present
weight: 42
register: member
- name: Assert return values of lb_member module
assert:
that:
- member.member.weight == 42
- name: Create load-balancer health monitor
openstack.cloud.lb_health_monitor:
cloud: "{{ cloud }}"
delay: 10
health_monitor_timeout: 5
max_retries: 3
name: ansible_health_monitor
pool: ansible_pool
state: present
register: health_monitor
- name: Assert return values of lb_health_monitor module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- "['created_at', 'delay', 'expected_codes', 'http_method', 'id', 'is_admin_state_up', 'max_retries',
'max_retries_down', 'name', 'operating_status', 'pool_id', 'pools', 'project_id', 'provisioning_status',
'tags', 'timeout', 'type', 'updated_at', 'url_path'
]|difference(health_monitor.health_monitor.keys())|length == 0"
- name: Create load-balancer health monitor again
openstack.cloud.lb_health_monitor:
cloud: "{{ cloud }}"
delay: 10
health_monitor_timeout: 5
max_retries: 3
name: ansible_health_monitor
pool: ansible_pool
state: present
register: health_monitor
- name: Assert return values of lb_health_monitor module
assert:
that:
- health_monitor is not changed
- name: Update load-balancer health monitor delay
openstack.cloud.lb_health_monitor:
cloud: "{{ cloud }}"
delay: 1337
health_monitor_timeout: 5
max_retries: 3
name: ansible_health_monitor
pool: ansible_pool
state: present
register: health_monitor
- name: Assert return values of lb_health_monitor module
assert:
that:
- health_monitor.health_monitor.delay == 1337
- name: Delete load-balancer health monitor
openstack.cloud.lb_health_monitor:
cloud: "{{ cloud }}"
name: ansible_health_monitor
state: absent
- name: Delete load-balancer pool member
openstack.cloud.lb_member:
cloud: "{{ cloud }}"
name: ansible_member
pool: ansible_pool
state: absent
- name: Delete load-balancer pool
openstack.cloud.lb_pool:
cloud: "{{ cloud }}"
name: ansible_pool
state: absent
- name: Delete load-balancer listener
openstack.cloud.lb_listener:
cloud: "{{ cloud }}"
name: ansible_listener
state: absent
- name: Delete load-balancer
openstack.cloud.loadbalancer:
cloud: "{{ cloud }}"
delete_floating_ip: true
name: ansible_lb
state: absent
timeout: 150
- name: Delete router
openstack.cloud.router:
cloud: "{{ cloud }}"
name: ansible_router
state: absent
- name: Delete internal subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
name: ansible_internal_subnet
state: absent
- name: Delete internal network
openstack.cloud.network:
cloud: "{{ cloud }}"
name: ansible_internal_network
state: absent
- 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

View File

@@ -1,16 +1,52 @@
---
- name: Create network {{ network_name }} for LB
- 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 external network
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
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 subnet {{ subnet_name }} on network {{ network_name }} for LB
- name: Create internal network
openstack.cloud.network:
cloud: "{{ cloud }}"
name: ansible_internal_network
state: present
- name: Create internal subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
network_name: "{{ network_name }}"
name: "{{ subnet_name }}"
network_name: ansible_internal_network
name: ansible_internal_subnet
state: present
enable_dhcp: true
dns_nameservers:
@@ -21,30 +57,230 @@
allocation_pool_start: 192.168.0.2
allocation_pool_end: 192.168.0.254
- name: Create loadbalancer - generic
- name: Create router 1
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: 192.168.0.1
name: ansible_router1
network: ansible_external_network
state: present
- name: Create load-balancer
openstack.cloud.loadbalancer:
cloud: "{{ cloud }}"
state: present
name: "{{ lb_name }}"
vip_subnet: "{{ subnet_name }}"
timeout: 450
name: ansible_lb
vip_subnet: ansible_internal_subnet
timeout: 1200
register: load_balancer
- name: Delete loadbalancer
- name: Assert return values of loadbalancer module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(load_balancer.load_balancer.keys())|length == 0
- name: Create load-balancer again
openstack.cloud.loadbalancer:
cloud: "{{ cloud }}"
state: present
name: ansible_lb
vip_subnet: ansible_internal_subnet
timeout: 1200
register: load_balancer
- name: Assert return values of loadbalancer module
assert:
that:
- load_balancer is not changed
- name: Update load-balancer description
openstack.cloud.loadbalancer:
cloud: "{{ cloud }}"
description: "Ansible load-balancer"
state: present
name: ansible_lb
vip_subnet: ansible_internal_subnet
timeout: 1200
register: load_balancer
- name: Assert return values of loadbalancer module
assert:
that:
- load_balancer.load_balancer.description == "Ansible load-balancer"
- name: Delete load-balancer
openstack.cloud.loadbalancer:
cloud: "{{ cloud }}"
name: ansible_lb
state: absent
name: "{{ lb_name }}"
timeout: 150
- name: Delete subnet {{ subnet_name }} on network {{ network_name }}
openstack.cloud.subnet:
- name: Create load-balancer with floating ip address
openstack.cloud.loadbalancer:
assign_floating_ip: true
cloud: "{{ cloud }}"
network_name: "{{ network_name }}"
name: "{{ subnet_name }}"
# Help Octavia to find a external network which is connected to ansible_internal_subnet via a router
floating_ip_network: ansible_external_network
name: ansible_lb
state: present
timeout: 1200
vip_subnet: ansible_internal_subnet
register: load_balancer
- name: Assert return values of loadbalancer module
assert:
that:
- "'floating_ip' in load_balancer.keys()"
- load_balancer.load_balancer.vip_address == load_balancer.floating_ip.fixed_ip_address
- name: Delete load-balancer with floating ip address
openstack.cloud.loadbalancer:
cloud: "{{ cloud }}"
delete_floating_ip: true
name: ansible_lb
state: absent
timeout: 150
- name: List all floating ips
openstack.cloud.floating_ip_info:
cloud: "{{ cloud }}"
register: floating_ips
- name: Assert load-balancer's floating ip has been deleted
assert:
that:
- load_balancer.floating_ip.floating_ip_address not in
floating_ips.floating_ips|map(attribute='floating_ip_address')|sort|list
- name: Create load-balancer with floating ip address from specific network
openstack.cloud.loadbalancer:
assign_floating_ip: true
cloud: "{{ cloud }}"
floating_ip_network: ansible_external_network
name: ansible_lb
state: present
timeout: 1200
vip_subnet: ansible_internal_subnet
register: load_balancer
- name: Assert return values of loadbalancer module
assert:
that:
- load_balancer.floating_ip.floating_network_id == external_network.network.id
- name: Create load-balancer with floating ip address from specific network again
openstack.cloud.loadbalancer:
assign_floating_ip: true
cloud: "{{ cloud }}"
floating_ip_network: ansible_external_network
name: ansible_lb
state: present
timeout: 1200
vip_subnet: ansible_internal_subnet
register: load_balancer
- name: Assert return values of loadbalancer module
assert:
that:
- load_balancer is not changed
# TODO: Replace with appropriate Ansible module once available
- name: Disassociate floating ip from load-balancer
command: >
openstack --os-cloud={{ cloud }} floating ip unset --port {{ load_balancer.floating_ip.floating_ip_address }}
- name: Reassign floating ip address to load-balancer
openstack.cloud.loadbalancer:
assign_floating_ip: true
cloud: "{{ cloud }}"
floating_ip_network: ansible_external_network
name: ansible_lb
state: present
timeout: 1200
vip_subnet: ansible_internal_subnet
register: load_balancer2
- name: Assert return values of loadbalancer module
assert:
that:
- load_balancer2.floating_ip.floating_network_id == external_network.network.id
- load_balancer.floating_ip.floating_ip_address == load_balancer2.floating_ip.floating_ip_address
- name: Reassign specific floating ip address to load-balancer
openstack.cloud.loadbalancer:
assign_floating_ip: true
cloud: "{{ cloud }}"
floating_ip_address: 10.6.6.42
floating_ip_network: ansible_external_network
name: ansible_lb
state: present
timeout: 1200
vip_subnet: ansible_internal_subnet
register: load_balancer
- name: Assert return values of loadbalancer module
assert:
that:
- load_balancer.floating_ip.floating_network_id == external_network.network.id
- load_balancer.floating_ip.floating_ip_address == '10.6.6.42'
- name: Disassociate floating ip address with load-balancer
openstack.cloud.loadbalancer:
cloud: "{{ cloud }}"
name: ansible_lb
state: present
timeout: 1200
vip_subnet: ansible_internal_subnet
register: load_balancer
- name: Assert return values of loadbalancer module
assert:
that:
- "'floating_ip' not in load_balancer.keys()"
- name: Delete load-balancer
openstack.cloud.loadbalancer:
cloud: "{{ cloud }}"
delete_floating_ip: true
name: ansible_lb
state: absent
timeout: 150
- name: Delete router 1
openstack.cloud.router:
cloud: "{{ cloud }}"
name: ansible_router1
state: absent
- name: Delete network {{ network_name }} of LB
- name: Delete internal subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
name: ansible_internal_subnet
state: absent
- name: Delete internal network
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
name: ansible_internal_network
state: absent
- 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
- import_tasks: lb_modules.yml

View File

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

View File

@@ -0,0 +1,15 @@
---
- name: Trigger flavor listing to create logs
openstack.cloud.compute_flavor_info:
cloud: "{{ cloud }}"
sdk_log_path: "{{ sdk_log_file_path }}"
sdk_log_level: "DEBUG"
- name: Read openstacksdk's log file
ansible.builtin.slurp:
src: "{{ sdk_log_file_path }}"
register: log
- name: Print contents of openstacksdk's log
ansible.builtin.debug:
msg: "{{ log['content'] | b64decode }}"

View File

@@ -1,7 +1,35 @@
network_name: shade_network
network_name_newparams: newparams_network
network_shared: false
network_external: false
expected_fields:
- availability_zone_hints
- availability_zones
- created_at
- description
- dns_domain
- id
- ipv4_address_scope_id
- ipv6_address_scope_id
- is_admin_state_up
- is_default
- is_port_security_enabled
- is_router_external
- is_shared
- is_vlan_transparent
- mtu
- name
- project_id
- provider_network_type
- provider_physical_network
- provider_segmentation_id
- qos_policy_id
- revision_number
- segments
- status
- subnet_ids
- tags
- updated_at
dns_domain: example.opendev.org
mtu: 1250
network_name: shade_network
network_name_newparams: newparams_network
network_name_updates: update_network
network_shared: false
port_security_enabled: false

View File

@@ -5,7 +5,29 @@
name: "{{ network_name }}"
state: present
shared: "{{ network_shared }}"
external: "{{ network_external }}"
external: false
register: infonet
- name: Check output of creating network
assert:
that:
- infonet.network
- item in infonet.network
loop: "{{ expected_fields }}"
- name: Gather networks info
openstack.cloud.networks_info:
cloud: "{{ cloud }}"
name: "{{ infonet.network.id }}"
register: result
- name: Check output of network info
# TODO: Remove ignore_errors once SDK's search_networks() (re)implemented searching by id
ignore_errors: true
assert:
that:
- result.networks|length == 1
- infonet.network.id == result.networks[0].id
- name: Gather networks info - generic
openstack.cloud.networks_info:
@@ -15,12 +37,28 @@
shared: "{{ network_shared|string|capitalize }}"
register: result
- name: Check output of network info
assert:
that:
- item in result.networks[0]
loop: "{{ expected_fields }}"
- name: Gather networks info
openstack.cloud.networks_info:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
filters:
shared: "False"
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 }}
- result.networks.0.name == network_name
- "'is_shared' in result.networks.0"
- result.networks.0['is_shared']|lower == network_shared|lower
- "'is_router_external' in result.networks.0"
- not (result.networks[0]['is_router_external'] | bool)
- name: Create network - with new SDK params
openstack.cloud.network:
@@ -28,33 +66,25 @@
name: "{{ network_name_newparams }}"
state: present
shared: "{{ network_shared }}"
external: "{{ network_external }}"
external: false
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', '<')
ignore_errors: true
- 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', '>=')
- result_newparams.networks.0.name == network_name_newparams
- result_newparams.networks.0.mtu == mtu
- "'is_port_security_enabled' in result_newparams.networks.0"
- result_newparams.networks.0['is_port_security_enabled'] == port_security_enabled
- name: Delete network - generic and with new SDK params
openstack.cloud.network:
@@ -74,4 +104,67 @@
- name: Verify networks info - deleted
assert:
that:
- result_nonet.openstack_networks == []
- result_nonet.networks == []
- name: Create network - updates
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name_updates }}"
state: present
shared: "{{ network_shared }}"
external: false
mtu: "{{ mtu }}"
port_security_enabled: "{{ port_security_enabled }}"
register: result_create_nw_for_updates
- name: Update network - update failure
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name_updates }}"
state: present
shared: "{{ network_shared }}"
external: false
mtu: "{{ mtu }}"
port_security_enabled: "{{ port_security_enabled }}"
# You cannot update this property.
provider_physical_network: cannot_be_updated
ignore_errors: true
register: result_nw_update_failure
- name: Verify networks info - update fail
assert:
that:
- result_nw_update_failure is failed
- name: Update network - update success
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name_updates }}"
state: present
shared: "{{ network_shared }}"
external: false
# NOTE: This property should be updated
mtu: "{{ mtu - 50 }}"
# NOTE: This property should be updated
port_security_enabled: "{{ not port_security_enabled }}"
register: result_nw_update_success
- name: Gather networks info - updates
openstack.cloud.networks_info:
cloud: "{{ cloud }}"
name: "{{ network_name_updates }}"
register: result_network_updates_info
- name: Verify networks info - update success
assert:
that:
- result_nw_update_success is changed
- result_network_updates_info.networks.0.name == network_name_updates
- result_network_updates_info.networks.0.mtu == mtu - 50
- result_network_updates_info.networks.0['is_port_security_enabled'] == (not port_security_enabled)
- name: Delete network - updates
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name_updates }}"
state: absent

View File

@@ -0,0 +1,9 @@
expected_fields:
- action
- id
- name
- object_id
- object_type
- project_id
- target_project_id
- tenant_id

View File

@@ -0,0 +1,100 @@
---
- name: Create source project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_source_project
description: Source project for network RBAC test
domain: default
is_enabled: True
register: source_project
- name: Create network
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "ansible_network"
state: present
project: "{{ source_project.project.id }}"
shared: false
external: true
register: network
- name: Create target project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_target_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: Assert return values of neutron_rbac_policy module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(rbac_policy.rbac_policy.keys())|length == 0
- name: Get all rbac policies for {{ source_project.project.name }} - after creation
openstack.cloud.neutron_rbac_policies_info:
cloud: "{{ cloud }}"
project: "{{ source_project.project.id }}"
register: rbac_policies
- name: Assert return values of neutron_rbac_policy_info module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(rbac_policies.rbac_policies[0].keys())|length == 0
- name: Verify policy exists - after creation
assert:
that:
- rbac_policy.rbac_policy.id in
( rbac_policies.rbac_policies | map(attribute='id') | list )
- name: Delete RBAC policy
openstack.cloud.neutron_rbac_policy:
cloud: "{{ cloud }}"
id: "{{ rbac_policy.rbac_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: "{{ source_project.project.id }}"
register: rbac_policies_remaining
- name: Verify policy does not exist - after deletion
assert:
that:
- rbac_policy.rbac_policy.id not in
( rbac_policies_remaining.rbac_policies | map(attribute='id') | list )
- name: Delete target project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: absent
name: ansible_target_project
- name: Delete network
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "ansible_network"
state: absent
- name: Delete source project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: absent
name: ansible_source_project

View File

@@ -1,53 +0,0 @@
---
- name: Create public flavor
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_public_flavor
is_public: True
ram: 1024
vcpus: 1
disk: 10
ephemeral: 10
swap: 1
flavorid: 12345
- name: Delete public flavor
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: absent
name: ansible_public_flavor
- name: Create private flavor
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_private_flavor
is_public: False
ram: 1024
vcpus: 1
disk: 10
ephemeral: 10
swap: 1
flavorid: 12345
- name: Delete private flavor
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: absent
name: ansible_private_flavor
- name: Create flavor (defaults)
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: present
name: ansible_defaults_flavor
ram: 1024
vcpus: 1
disk: 10
- name: Delete flavor (defaults)
openstack.cloud.compute_flavor:
cloud: "{{ cloud }}"
state: absent
name: ansible_defaults_flavor

View File

@@ -0,0 +1,32 @@
expected_fields:
- accept_ranges
- access_control_allow_origin
- content_disposition
- content_encoding
- content_length
- content_type
- copy_from
- delete_after
- delete_at
- etag
- expires_at
- id
- if_match
- if_modified_since
- if_none_match
- if_unmodified_since
- is_content_type_detected
- is_newest
- is_static_large_object
- last_modified_at
- manifest
- metadata
- multipart_manifest
- name
- object_manifest
- range
- signature
- symlink_target
- symlink_target_account
- timestamp
- transfer_encoding

View File

@@ -1,37 +1,35 @@
---
- name: Create a test object file
shell: mktemp
register: tmp_file
- name: Create container
openstack.cloud.object:
cloud: "{{ cloud }}"
state: present
container: ansible_container
container_access: private
openstack.cloud.object_container:
cloud: "{{ cloud }}"
state: present
name: ansible_container
- name: Put object
- name: Create object
openstack.cloud.object:
cloud: "{{ cloud }}"
state: present
name: ansible_object
filename: "{{ tmp_file.stdout }}"
container: ansible_container
cloud: "{{ cloud }}"
state: present
name: ansible_object
data: "this is a test"
container: ansible_container
register: object
- name: Assert return values of object module
assert:
that:
- object.object.id == "ansible_object"
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(object.object.keys())|length == 0
- name: Delete object
openstack.cloud.object:
cloud: "{{ cloud }}"
state: absent
name: ansible_object
container: ansible_container
cloud: "{{ cloud }}"
state: absent
name: ansible_object
container: ansible_container
- name: Delete container
openstack.cloud.object:
cloud: "{{ cloud }}"
state: absent
container: ansible_container
- name: Delete test object file
file:
name: "{{ tmp_file.stdout }}"
state: absent
openstack.cloud.object_container:
cloud: "{{ cloud }}"
state: absent
name: ansible_container

View File

@@ -1 +1,22 @@
container_name: "test-container"
expected_fields:
- bytes
- bytes_used
- content_type
- count
- history_location
- id
- if_none_match
- is_content_type_detected
- is_newest
- meta_temp_url_key
- meta_temp_url_key_2
- metadata
- name
- object_count
- read_ACL
- storage_policy
- sync_key
- sync_to
- timestamp
- versions_location
- write_ACL

View File

@@ -1,60 +1,93 @@
---
- module_defaults:
openstack.cloud.object_container:
cloud: "{{ cloud }}"
block:
- name: Create an empty container
openstack.cloud.object_container:
container: "{{ container_name }}"
register: container
- name: Create an empty container with public access
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: ansible_container
read_ACL: ".r:*,.rlistings"
register: container
- name: Verify container was created
assert:
that:
- container is success
- container is changed
- container.container.name == container_name
- name: Assert return values of container module
assert:
that:
- container is changed
- container.container.name == "ansible_container"
- container.container.read_ACL == ".r:*,.rlistings"
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(container.container.keys())|length == 0
- name: Set metadata for a container
openstack.cloud.object_container:
container: "{{ container_name }}"
metadata: "Cache-Control='no-cache'"
register: set_meta
- name: Set container metadata aka container properties
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: ansible_container
metadata:
'Cache-Control': 'no-cache'
'foo': 'bar'
register: container
- name: Verify container metadata was set
assert:
that:
- set_meta is success
- set_meta is changed
- name: Verify container metadata was set
assert:
that:
- container is changed
- ('cache-control' in container.container.metadata.keys()|map('lower'))
- container.container.metadata['foo'] == 'bar'
- name: Delete some keys from container metadata
openstack.cloud.object_container:
container: "{{ container_name }}"
keys:
- Cache-Control
register: delete_meta
- name: Update a container
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: ansible_container
delete_metadata_keys:
- 'Cache-Control'
read_ACL: ""
register: container
- name: Verify some keys from container metadata was deleted
assert:
that:
- delete_meta is success
- delete_meta is changed
- name: Verify updated container
assert:
that:
- container is changed
- ('cache-control' not in container.container.metadata.keys()|map('lower'))
- "container.container.metadata == {'foo': 'bar'}"
- container.container.read_ACL is none or container.container.read_ACL == ""
- name: Delete container
openstack.cloud.object_container:
container: "{{ container_name }}"
state: absent
register: deleted
- name: Delete container
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: ansible_container
state: absent
register: container
- name: Verify container was deleted
assert:
that:
- deleted is success
- deleted is changed
- name: Verify container was deleted
assert:
that:
- container is changed
always:
- name: Delete container
openstack.cloud.object_container:
container: "{{ container_name }}"
state: absent
ignore_errors: yes
- name: Delete container again
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: ansible_container
state: absent
register: container
- name: Verify container was not deleted again
assert:
that:
- container is not changed
- name: Create another container for recursive deletion
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: ansible_container2
- name: Load an object into container
openstack.cloud.object:
cloud: "{{ cloud }}"
state: present
name: ansible_object
data: "this is another test"
container: ansible_container2
- name: Delete container recursively
openstack.cloud.object_container:
cloud: "{{ cloud }}"
state: absent
name: ansible_container2
delete_with_all_objects: true

View File

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

View File

@@ -1,44 +0,0 @@
---
- 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

View File

@@ -1,9 +1,45 @@
network_name: ansible_port_network
network_external: true
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"
expected_fields:
- allowed_address_pairs
- binding_host_id
- binding_profile
- binding_vif_details
- binding_vif_type
- binding_vnic_type
- created_at
- data_plane_status
- description
- device_id
- device_owner
- device_profile
- dns_assignment
- dns_domain
- dns_name
- extra_dhcp_opts
- fixed_ips
- id
- ip_allocation
- is_admin_state_up
- is_port_security_enabled
- mac_address
- name
- network_id
- numa_affinity_policy
- project_id
- propagate_uplink_status
- qos_network_policy_id
- qos_policy_id
- resource_request
- revision_number
- security_group_ids
- status
- tags
- tenant_id
- trunk_details
- updated_at
network_name: ansible_port_network
no_security_groups: True
port_name: ansible_port
subnet_name: ansible_port_subnet

View File

@@ -1,125 +1,290 @@
---
- name: Create network
openstack.cloud.network:
cloud: "{{ cloud }}"
state: present
name: "{{ network_name }}"
external: "{{ network_external }}"
cloud: "{{ cloud }}"
state: present
name: "{{ network_name }}"
external: true
register: network
- name: Create subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: present
name: "{{ subnet_name }}"
network_name: "{{ network_name }}"
cidr: 10.5.5.0/24
cloud: "{{ cloud }}"
state: present
name: "{{ subnet_name }}"
network_name: "{{ network_name }}"
cidr: 10.5.5.0/24
register: subnet
- name: Create port (no security group or default security group)
openstack.cloud.port:
cloud: "{{ cloud }}"
state: present
name: "{{ port_name }}"
network: "{{ network_name }}"
no_security_groups: "{{ no_security_groups }}"
fixed_ips:
- ip_address: 10.5.5.69
cloud: "{{ cloud }}"
state: present
name: "{{ port_name }}"
network: "{{ network_name }}"
no_security_groups: "{{ no_security_groups }}"
fixed_ips:
- ip_address: 10.5.5.69
register: port
- debug: var=port
- name: assert return values of port module
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(port.port.keys())|length == 0
- name: List all ports
openstack.cloud.port_info:
cloud: "{{ cloud }}"
register: info
- name: Get info about all ports
openstack.cloud.port_info:
cloud: "{{ cloud }}"
register: info
- name: Check info about ports
assert:
that:
- info.ports|length > 0
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(info.ports[0].keys())|length == 0
- name: Get port by id
openstack.cloud.port_info:
cloud: "{{ cloud }}"
name: "{{ info.ports[0].id }}"
register: info_id
- name: Assert infos by id
assert:
that:
- info_id.ports|length == 1
- info_id.ports[0].id == info.ports[0].id
- name: List port with device_id filter
openstack.cloud.port_info:
cloud: "{{ cloud }}"
filters:
device_id: "{{ info.ports[0].device_id }}"
register: info_filter
- name: Assert port was returned
assert:
that:
- info_filter.ports | length >= 1
- name: Delete port (no security group or default security group)
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: "{{ port_name }}"
cloud: "{{ cloud }}"
state: absent
name: "{{ port_name }}"
- name: Create security group
openstack.cloud.security_group:
cloud: "{{ cloud }}"
state: present
name: "{{ secgroup_name }}"
description: Test group
cloud: "{{ cloud }}"
state: present
name: ansible_security_group
description: Test group
register: security_group
- name: Create port (with security group)
openstack.cloud.port:
cloud: "{{ cloud }}"
state: present
name: "{{ port_name }}"
network: "{{ network_name }}"
fixed_ips:
- ip_address: 10.5.5.69
security_groups:
- "{{ secgroup_name }}"
cloud: "{{ cloud }}"
state: present
name: "{{ port_name }}"
network: "{{ network_name }}"
fixed_ips:
- ip_address: 10.5.5.69
security_groups:
- ansible_security_group
register: port
- debug: var=port
- name: Delete port (with security group)
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: "{{ port_name }}"
cloud: "{{ cloud }}"
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 }}"
state: present
name: "{{ port_name }}"
network: "{{ network_name }}"
no_security_groups: "{{ no_security_groups }}"
allowed_address_pairs:
- ip_address: 10.6.7.0/24
extra_dhcp_opts:
- opt_name: "bootfile-name"
opt_value: "testfile.1"
cloud: "{{ cloud }}"
state: present
name: "{{ port_name }}"
network: "{{ network_name }}"
no_security_groups: "{{ no_security_groups }}"
allowed_address_pairs:
- ip_address: 10.6.7.0/24
extra_dhcp_opts:
- opt_name: "bootfile-name"
opt_value: "testfile.1"
register: port
- debug: var=port
- name: Delete port (with allowed_address_pairs and extra_dhcp_opts)
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: "{{ port_name }}"
cloud: "{{ cloud }}"
state: absent
name: "{{ port_name }}"
- name: Create port which will be updated
openstack.cloud.port:
allowed_address_pairs:
- ip_address: 10.6.7.0/24
mac_address: "aa:bb:cc:dd:ee:ff"
cloud: "{{ cloud }}"
description: "What a great port"
extra_dhcp_opts:
- ip_version: 4
opt_name: "bootfile-name"
opt_value: "testfile.1"
dns_name: "dns-port-name"
dns_domain: "example.com."
fixed_ips:
- ip_address: 10.5.5.69
name: "{{ port_name }}"
network: "{{ network_name }}"
no_security_groups: true
state: present
register: port
- name: Create port which will be updated (again)
openstack.cloud.port:
allowed_address_pairs:
- ip_address: 10.6.7.0/24
mac_address: "aa:bb:cc:dd:ee:ff"
cloud: "{{ cloud }}"
description: "What a great port"
extra_dhcp_opts:
- ip_version: 4
opt_name: "bootfile-name"
opt_value: "testfile.1"
# We have no valid dns name configured
#dns_name: "dns-port-name"
#dns_domain: "example.com."
fixed_ips:
- ip_address: 10.5.5.69
subnet_id: "{{ subnet.subnet.id }}"
name: "{{ port_name }}"
network: "{{ network_name }}"
no_security_groups: true
state: present
register: port_again
- name: Assert port did not change
assert:
that:
- port.port.id == port_again.port.id
- port_again is not changed
- name: Update port
openstack.cloud.port:
allowed_address_pairs:
- ip_address: 11.9.9.0/24
mac_address: "aa:aa:aa:bb:bb:bb"
cloud: "{{ cloud }}"
description: "This port got updated"
extra_dhcp_opts:
- opt_name: "bootfile-name"
opt_value: "testfile.2"
# We have no valid dns name configured
#dns_name: "dns-port-name-2"
#dns_domain: "another.example.com."
fixed_ips:
- ip_address: 10.5.5.70
subnet_id: "{{ subnet.subnet.id }}"
name: "{{ port_name }}"
network: "{{ network_name }}"
security_groups:
- ansible_security_group
state: present
register: port_updated
- name: Assert updated port
assert:
that:
- port_updated.port.id == port.port.id
- port_updated.port.allowed_address_pairs|length == 1
- port_updated.port.allowed_address_pairs[0].ip_address == "11.9.9.0/24"
- port_updated.port.allowed_address_pairs[0].mac_address == "aa:aa:aa:bb:bb:bb"
- port_updated.port.description == "This port got updated"
- port_updated.port.extra_dhcp_opts|length == 1
- port_updated.port.extra_dhcp_opts[0].opt_value == "testfile.2"
# We have no valid dns name configured
#- port_updated.port.dns_name == "dns-port-name-2"
#- port_updated.port.dns_domain == "another.example.com."
- port_updated.port.fixed_ips|length == 1
- port_updated.port.fixed_ips[0].ip_address == "10.5.5.70"
- port_updated.port.fixed_ips[0].subnet_id == subnet.subnet.id
- port_updated.port.security_group_ids|length == 1
- port_updated.port.security_group_ids[0] == security_group.security_group.id
- name: Delete updated port
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: "{{ port_name }}"
- name: Delete security group
openstack.cloud.security_group:
cloud: "{{ cloud }}"
state: absent
name: "{{ secgroup_name }}"
cloud: "{{ cloud }}"
state: absent
name: ansible_security_group
- name: Test port binding config (runs from train release sdk > 0.28)
block:
- name: Create port (with binding profile)
openstack.cloud.port:
cloud: "{{ cloud }}"
state: present
name: "{{ port_name }}"
network: "{{ network_name }}"
binding_profile: "{{ binding_profile }}"
register: port
- name: Create port (with binding profile)
openstack.cloud.port:
cloud: "{{ cloud }}"
state: present
name: "{{ port_name }}"
network: "{{ network_name }}"
binding_profile: "{{ binding_profile }}"
register: port
- name: Assert binding:profile exists in created port
assert:
that: "port.port['binding:profile']"
- name: Assert binding_profile exists in created port
assert:
that: "port.port['binding_profile']"
- debug: var=port
- debug: var=port
- name: Delete port (with binding profile)
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: "{{ port_name }}"
when: sdk_version is version(0.28, '>')
- name: Delete port (with binding profile)
openstack.cloud.port:
cloud: "{{ cloud }}"
state: absent
name: "{{ port_name }}"
- name: Delete subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
state: absent
name: "{{ subnet_name }}"
cloud: "{{ cloud }}"
state: absent
name: "{{ subnet_name }}"
- name: Delete network
openstack.cloud.network:
cloud: "{{ cloud }}"
state: absent
name: "{{ network_name }}"
cloud: "{{ cloud }}"
state: absent
name: "{{ network_name }}"

View File

@@ -0,0 +1,10 @@
expected_fields:
- description
- domain_id
- id
- is_domain
- is_enabled
- name
- options
- parent_id
- tags

View File

@@ -1,25 +1,178 @@
---
- name: Create project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: dummy description
domain_id: default
enabled: True
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: dummy description
domain: default
is_enabled: True
register: project
- debug: var=project
- name: Assert return values of project module
assert:
that:
- project is changed
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(project.project.keys())|length == 0
- name: Fetch project
openstack.cloud.project_info:
cloud: "{{ cloud }}"
name: ansible_project
register: project
- name: Assert project
assert:
that:
- project.projects | length == 1
- project.projects.0.name == 'ansible_project'
- project.projects.0.description == 'dummy description'
- name: Create project again
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: dummy description
domain: default
is_enabled: True
register: project
- name: Assert return values of project module
assert:
that:
- project is not changed
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(project.project.keys())|length == 0
- name: Update project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: new description
register: updatedproject
cloud: "{{ cloud }}"
state: present
name: ansible_project
description: new description
extra_specs:
tags:
- example_tag
register: project
- debug: var=updatedproject
- name: Assert project changed
assert:
that:
- project is changed
- project.project.description == 'new description'
- name: Fetch all projects
openstack.cloud.project_info:
cloud: "{{ cloud }}"
register: projects
- name: Assert return values of project_info module
assert:
that:
- projects.projects | length > 0
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(projects.projects.0.keys())|length == 0
- name: Fetch project by name
openstack.cloud.project_info:
cloud: "{{ cloud }}"
name: 'ansible_project'
register: projects
- name: Assert return values of project_info module
assert:
that:
- projects.projects | length == 1
- projects.projects.0.name == 'ansible_project'
- name: Fetch projects with filter
openstack.cloud.project_info:
cloud: "{{ cloud }}"
filters:
name: 'ansible_project'
register: projects
- name: Assert return values of project_info module
assert:
that:
- projects.projects | length == 1
- projects.projects.0.name == 'ansible_project'
- name: Fetch project by name and domain
openstack.cloud.project_info:
cloud: "{{ cloud }}"
name: 'ansible_project'
domain: 'default'
register: projects
- name: Assert return values of project_info module
assert:
that:
- projects.projects | length == 1
- projects.projects.0.name == 'ansible_project'
- name: Delete project
openstack.cloud.project:
cloud: "{{ cloud }}"
state: absent
name: ansible_project
register: project
- name: Assert project changed
assert:
that: project is changed
- name: Get project
openstack.cloud.project_info:
cloud: "{{ cloud }}"
name: ansible_project
register: project_info
- name: Assert project deleted
assert:
that:
- project_info.projects | length == 0
- name: Delete project again
openstack.cloud.project:
cloud: "{{ cloud }}"
state: absent
name: ansible_project
register: project
- name: Assert project not changed
assert:
that: project is not changed
- name: Create project with extra_specs
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
extra_specs:
is_enabled: False
register: project
- name: Assert return values of project module
assert:
that:
- project.project.is_enabled == False
- name: Update project with extra_specs
openstack.cloud.project:
cloud: "{{ cloud }}"
state: present
name: ansible_project
extra_specs:
is_enabled: True
register: project
- name: Assert return values of project module
assert:
that:
- project.project.is_enabled == True
- name: Delete project
openstack.cloud.project:

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,30 @@
test_project: ansible_project
test_network_quota:
floating_ips: 5
networks: 50
ports: 300
rbac_policies: 5
routers: 5
security_group_rules: 5
security_groups: 5
subnet_pools: 5
subnets: 5
test_volume_quota:
backup_gigabytes: 500
backups: 5
gigabytes: 500
groups: 1
per_volume_gigabytes: 10
snapshots: 5
volumes: 5
test_compute_quota:
cores: 5
injected_file_content_bytes: 5
injected_file_path_bytes: 5
injected_files: 5
instances: 5
key_pairs: 5
metadata_items: 5
ram: 5
server_group_members: 5
server_groups: 5

View File

@@ -0,0 +1,131 @@
---
- module_defaults:
group/openstack.cloud.openstack:
cloud: "{{ cloud }}"
name: "{{ test_project }}"
# Backward compatibility with Ansible 2.9
openstack.cloud.project:
cloud: "{{ cloud }}"
name: "{{ test_project }}"
openstack.cloud.quota:
cloud: "{{ cloud }}"
name: "{{ test_project }}"
block:
- name: Create test project
openstack.cloud.project:
state: present
- name: Clear quotas before tests
openstack.cloud.quota:
state: absent
register: default_quotas
- name: Set network quota
openstack.cloud.quota: "{{ test_network_quota }}"
register: quotas
- name: Assert changed
assert:
that: quotas is changed
- name: Assert field values
assert:
that: quotas.quotas.network[item.key] == item.value
loop: "{{ test_network_quota | dict2items }}"
- name: Set network quota again
openstack.cloud.quota: "{{ test_network_quota }}"
register: quotas
- name: Assert not changed
assert:
that: quotas is not changed
- name: Set volume quotas
openstack.cloud.quota: "{{ test_volume_quota }}"
register: quotas
- name: Assert changed
assert:
that: quotas is changed
- name: Assert field values
assert:
that: quotas.quotas.volume[item.key] == item.value
loop: "{{ test_volume_quota | dict2items }}"
- name: Set volume quotas again
openstack.cloud.quota: "{{ test_volume_quota }}"
register: quotas
- name: Assert not changed
assert:
that: quotas is not changed
- name: Set compute quotas
openstack.cloud.quota: "{{ test_compute_quota }}"
register: quotas
- name: Assert changed
assert:
that: quotas is changed
- name: Assert field values
assert:
that: quotas.quotas.compute[item.key] == item.value
loop: "{{ test_compute_quota | dict2items }}"
- name: Set compute quotas again
openstack.cloud.quota: "{{ test_compute_quota }}"
register: quotas
- name: Unset all quotas
openstack.cloud.quota:
state: absent
register: quotas
- name: Assert defaults restore
assert:
that: quotas.quotas == default_quotas.quotas
- name: Set all quotas at once
openstack.cloud.quota:
"{{ [test_network_quota, test_volume_quota, test_compute_quota] | combine }}"
register: quotas
- name: Assert changed
assert:
that: quotas is changed
- name: Assert volume values
assert:
that: quotas.quotas.volume[item.key] == item.value
loop: "{{ test_volume_quota | dict2items }}"
- name: Assert network values
assert:
that: quotas.quotas.network[item.key] == item.value
loop: "{{ test_network_quota | dict2items }}"
- name: Assert compute values
assert:
that: quotas.quotas.compute[item.key] == item.value
loop: "{{ test_compute_quota | dict2items }}"
- name: Set all quotas at once again
openstack.cloud.quota:
"{{ [test_network_quota, test_volume_quota, test_compute_quota] | combine }}"
register: quotas
- name: Assert not changed
assert:
that: quotas is not changed
- name: Unset all quotas
openstack.cloud.quota:
state: absent
register: quotas
- name: Delete test project
openstack.cloud.project:
state: absent

View File

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

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