653 Commits
1.2.0 ... 2.5.0

Author SHA1 Message Date
Artem Goncharov
3c0a9f2d94 Release 2.5.0 version
Change-Id: Ie96930eda27984833f386bbcd65ebf2eeda4e40c
Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
2025-10-21 13:09:36 +02:00
Tadas Sutkaitis
b1ecd54a5d feat: introduce share_type modules
Add share_type and share_type_info modules.
Uses direct Manila API calls via the SDK's session/connection interface
since share type resources are not available in openstacksdk.

Change-Id: I49af9a53435e226c5cc93a14190f85ef4637c798
Signed-off-by: Tadas Sutkaitis <tadasas@gmail.com>
2025-10-08 20:51:26 +00:00
Zuul
4a3460e727 Merge "Add import_method to module" 2025-10-07 17:13:52 +00:00
Jay Jahns
c9887b3a23 Add import_method to module
This adds the import method to support web-download option. It
has been added to the openstacksdk.

Closes-Bug: #2115023
Change-Id: I3236cb50b1265e0d7596ada9122aa3b4fc2baf9e
Depends-On: https://review.opendev.org/c/openstack/ansible-collections-openstack/+/955752
2025-08-26 12:04:42 +00:00
Andrew Bonney
e84ebb0773 ci: fix various issues preventing complete runs
When creating a coe cluster, a flavor lookup occurs which
fails as nothing is specified. This adds a default flavor
which can be used to test cluster provisioning.

Various checks used a deprecated truthy check which no
longer works with Ansible 2.19

Inventory cache format change in Ansible 2.19

galaxy.yml required in tmp testing directory or version
checks fail for linters with Ansible 2.19

Change-Id: Iaf3f05d0841a541e4318821fe44ddd59f236b640
2025-07-25 10:15:30 +01:00
Zuul
f584c54dfd Merge "Add volume_manage module" 2025-06-05 12:42:20 +00:00
Zuul
3901000119 Merge "feat: add support for filters in inventory" 2025-06-05 12:08:15 +00:00
Simon Dodsley
556208fc3c Add volume_manage module
This module introduces the ability to use the cinder manage
and unmanage of an existing volume on a cinder backend.

Due to API limitations, when unmanaging a volume, only the
volume ID can be provided.

Change-Id: If969f198864e6bd65dbb9fce4923af1674da34bc
2025-05-31 09:46:52 -04:00
Zuul
3ac95541da Merge "Shows missing data in stack_info module output" 2025-05-13 19:23:35 +00:00
Zuul
59b5b33557 Merge "Let clouds_yaml_path behave as documented (Override path to clouds.yaml file)" 2025-05-13 19:23:34 +00:00
Zuul
3d7948a4e4 Merge "Don't compare current state for reboot_* actions" 2025-05-13 18:15:17 +00:00
Paulo Dias
6cb5ed4b84 feat: add support for filters in inventory
Change-Id: Id8428ce1b590b7b2c409623f180f8f8e608e1cda
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
2025-05-13 17:21:47 +00:00
matthias-rabe
283c342b10 Let clouds_yaml_path behave as documented (Override path to clouds.yaml file)
Change-Id: I01b38467c4bea5884cbbd04e1e3a2e7c6eeebfeb
2025-04-25 09:55:36 +02:00
Roberto Alfieri
2a5fb584e2 Shows missing data in stack_info module output
The generator `stacks` object didn't return all the values (e.g. output
and parameters) so `get_stack` is used to populate the dict.

Closes-Bug: #2059771
Change-Id: Ie9061e35fc4bf217d76eee96f07e0ed68e44927c
Signed-off-by: Roberto Alfieri <ralfieri@redhat.com>
2025-04-24 22:45:15 +00:00
Zuul
762fee2bad Merge "Allow role_assignment module to work cross domain" 2025-04-24 15:30:33 +00:00
Zuul
9d92897522 Merge "Fix example in the dns_zone_info module doc" 2025-04-24 13:35:53 +00:00
Zuul
df0b57a3c6 Merge "Fix router module external IPs when only subnet specified" 2025-04-24 10:03:02 +00:00
Gavin Chappell
5a6f5084dd Don't compare current state for reboot_* actions
When performing these actions a server will start `ACTIVE` and end
`ACTIVE` meaning that the Ansible module skips over the host you are
trying to reboot because it looks like the action was already taken.

Tests are updated to reflect `changed=True` with the end state
remaining as `ACTIVE`

Closes-Bug: 2046429

Change-Id: I8828f05bb5402fd2ba2c26b67c727abfbcc43202
2025-04-23 18:18:48 +01:00
Roberto Alfieri
c988b3bcbf Fix example in the dns_zone_info module doc
The example in `dns_zone_info` documentation showed an incorrect
`openstack.cloud.dns_zones` module instead of
`openstack.cloud.dns_zone_info`.

Closes-Bug: #2065471
Change-Id: Ic9484034f6631306c031ed640979bec009672ade
Signed-off-by: Roberto Alfieri <me@rebtoor.com>
2025-04-23 16:14:59 +00:00
Doug Goldstein
437438e33c Allow role_assignment module to work cross domain
The role_assignment module always looks up the user, group and project
so to support cross-domain assignments we should add extra parameters
like OSC to look them up from the correct domains. Switch to using
the service proxy interface to grant or revoke the roles as well.

Partial-Bug: #2052448
Partial-Bug: #2047151
Partial-Bug: #2097203
Change-Id: Id023cb9e7017c749bc39bba2091921154a413723
2025-04-23 09:21:43 -05:00
Mohammed Naser
3fd79d342c Fix disable_gateway_ip for subnet
When creating a subnet with disable_gateway_ip, the value
was not passed into the creation which would lead into
a subnet being created with a gateway, and then on updates
it would have the gateway removed.

Change-Id: I816d4a4d09b2116c00cf868a590bd92dac4bfc5b
2025-04-22 18:25:52 +00:00
Andrew Bonney
98bb212ae4 Fix router module external IPs when only subnet specified
The router module used to support adding external fixed IPs
by specifying the subnet only, and the documentation still
allows for this. Unfortunately the logic currently results
in an error message stating that the ip_address cannot be
null.

This patch reinstates this functionality and adds tests to
avoid a future regression.

Change-Id: Ie29c7b2b763a58ea107cc50507e99f650ee9e53f
2025-04-22 16:28:02 +00:00
Doug Goldstein
08d8cd8c25 fix test failures on recordset
Since long time we knew that it is necessary to explicitly invoke
`to_dict` for openstacksdk resources before passing them to Ansible.
Here it was missed and in addition to that records are only returned
when the recordset becomes active.

Change-Id: I49238d2f7add9412bb9100b69f1b84b512f8c34b
2025-04-22 16:30:58 +03:00
Doug Goldstein
41cf92df99 replace storyboard links with bugs.launchpad.net
When you go to the storyboard link at the top it tells users that issues
and bugs are now tracked at bugs.launchpad.net so just update all the
links to point there.

Change-Id: I1dadae24ef4ca6ee2d244cc2a114cca5e4ea5a6b
2025-04-02 09:44:59 -05:00
Callum Dickinson
5494d153b1 Add the object_containers_info module
This adds a module for getting information on one or more
object storage containers from OpenStack.

The following options are supported:

* name - Get details for a single container by name.
  When this parameter is defined a single container is returned,
  with extra metadata available (with the same keys and value
  as in the existing object_container module).
* prefix - Search for and return a list of containers by prefix.
  When searching for containers, only a subset of metadata values
  are available.

When no options are specified, all containers in the project
are returned, with the same metadata available as when the
prefix option is used.

Change-Id: I8ba434a86050f72d8ce85c9e98731f6ef552fc79
2025-01-24 10:43:18 +13:00
Zuul
fef560eb5b Merge "CI: add retries for trait test" 2025-01-20 19:41:02 +00:00
Sagi Shnaidman
1ce7dd8b5f Release 2.4.1 version
Change-Id: I5d5532865c8700030925a1dcd6e262c53f37c0a9
2025-01-20 17:58:47 +02:00
Zuul
438bbea34b Merge "Fix missed client_cert in OpenStackModule" 2025-01-18 20:37:18 +00:00
Sagi Shnaidman
239c45c78f CI: add retries for trait test
Change-Id: Ic94f521950da75128a6a677111d4f0206a0e33d6
2025-01-18 13:03:43 +02:00
Anna Arhipova
e065818024 Update tags when changing server
Tags are not included in the metadata and are not supported by PUT
/servers/{server_id}, requiring a specific mechanism for modification.

With this fix, existing tags on the server will be completely replaced
by the new set of tags provided during the update

Also optimized tags tests a bit

Change-Id: I2673ed57d848654427dcb7ed7aceba811a3dd314
2025-01-17 20:49:50 +01:00
Victor Chembaev
0764e671a9 Fix missed client_cert in OpenStackModule
Change-Id: Ia6bc31c18f0707047c62e8824f7e9e489284bdab
2025-01-17 14:41:32 +02:00
Sagi Shnaidman
5f4db3583e Release 2.4.0 version
Change-Id: I7e09a849d089962aaec90d30d9e6ab8a3891aa41
2025-01-15 18:18:47 +02:00
Anna Arhipova
6262474c94 Allow create instance with tags
Change-Id: I98a04c18ac0a815841c6c474b39af5e9ed4d1c0d
2025-01-14 17:24:45 +00:00
Freerk-Ole Zakfeld
f9fcd35018 Add Traits Module
Change-Id: I7db759f716c1154cb0dd30e240af3a0420efab8f
Signed-off-by: Freerk-Ole Zakfeld <fzakfeld@scaleuptech.com>
2025-01-14 10:34:50 +01:00
Zuul
5dbf47cb49 Merge "Add loadbalancer quota options" 2025-01-09 18:43:07 +00:00
Tom Clark
57c63e7918 Add loadbalancer quota options
Enable configuration of loadbalancer options within the quota module so that the current collection can be used to address Octavia quotas.

Change-Id: I1dd593f5387929ed522d54954fc63dd535df7c7c
2025-01-09 13:45:19 +00:00
Sagi Shnaidman
ed5829d462 Release 2.3.3 version
Change-Id: I9d78fdc98fdb986c926f196077d9b401de573218
2024-12-22 16:57:48 +02:00
Zuul
b025e7c356 Merge "Fix deprecated ANSIBLE_COLLECTIONS_PATHS variable" 2024-12-22 14:38:13 +00:00
Sagi Shnaidman
782340833e Fix deprecated ANSIBLE_COLLECTIONS_PATHS variable
Change it to ANSIBLE_COLLECTIONS_PATH

Change-Id: I6100e1da0e578c26dd90c05b7bd5eeddcaec983b
2024-12-22 14:54:52 +02:00
Sagi Shnaidman
73aab9e80c Add test to only_ipv4 in inventory
Change-Id: I70cbfef05af4853947fac0040c4a3a9cf6c2f1fe
2024-12-22 13:55:33 +02:00
Zuul
ae7e8260a3 Merge "add an option to use only IPv4 only for ansible_host and ansible_ssh_host" 2024-12-22 11:51:13 +00:00
Sagi Shnaidman
030df96dc0 Release 2.3.2 version
Change-Id: I0234ad386309685066ede85286a5d3938c9d6133
2024-12-20 11:46:16 +02:00
Kevin Honka
c5d0d3ec82 add an option to use only IPv4 only for ansible_host and ansible_ssh_host
By default the openstack inventory fetches the first fixed ip
address for "ansible_host" and "ansible_ssh_host".
Due to the random sorting of addresses by OpenStack, this can either be
a ipv4 or ipv6 address, this is not desirable in some legacy setups
where Ansible runs in a ipv4 only setup,
but OpenStack is already ipv6 enabled.

To prevent this, a new option called "only_ipv4" was added,
which forces the inventory plugin to use only fixed ipv4 addresses.

Closes-Bug: #2051249
Change-Id: I3aa9868c9299705d4b0dcbf9b9cb561c0855c11c
2024-12-20 06:36:04 +00:00
Zuul
0cff7eb3a2 Merge "Fix openstack.cloud.port module failure in check mode" 2024-12-19 23:07:20 +00:00
Hirano Yuki
29e3f3dac8 Fix openstack.cloud.port module failure in check mode
The openstack.cloud.port module always fails in check mode due to it
calls PortModule._will_change() with the wrong number of arguments.

Change-Id: I7e8a4473df8bb27d888366b444a54d3f7b1c2fa8
2024-12-19 19:01:22 +00:00
Takashi Kajinami
d18ea87091 Drop compat implementations for tests
Python < 3.4.4 has already reached its EOL.

Change-Id: Ieb7cfd796991645db44dafc0e5ba82855c08853a
2024-12-19 19:00:27 +00:00
Sagi Shnaidman
529c1e8dcc Fix release job
Set up Ansible in virtualenv

Change-Id: I0ee92fe621423f9f199b2baab6a95fba377b65a1
2024-12-19 12:52:07 +02:00
Sagi Shnaidman
99b7af529c Release 2.3.1 version
Change-Id: I8fa2c36d08e387c93f61630b55892ff69b4eff6a
2024-12-18 13:27:39 +02:00
Sagi Shnaidman
2ed3ffe1d0 Change token for new Ansible Galaxy server
Change it with:

zuul-client encrypt  \
  --tenant openstack \
  --project openstack/ansible-collections-openstack
(zuul URl is https://zuul.opendev.org)

Change-Id: I9623f14453fd1fd9631195cc3794141edfce0cf7
2024-12-16 21:37:33 +02:00
Victor Chembaev
ae5dbf0fc0 Add ability to pass client tls certificate
Add ablity to pass client tls certificate
to make mTLS connection to OpenStack provider.
Closes-Bug: #2090953

Change-Id: I33ef38c830309cf4f9fae11c8403fb4e616cf315
2024-12-14 21:42:50 +00:00
Sagi Shnaidman
4074db1bd0 Replace 2.16 jobs by 2.18 Ansible jobs
Change-Id: I4cae065e961a06d44792bef2e6479c30fe242911
2024-12-13 21:41:53 +00:00
Sagi Shnaidman
3248ba9960 CI: wait until server is shelved offloaded
Wait for condition when shelving is finished.

Change-Id: I7945989461c0b80adbb629da2eef1464e1ce2645
2024-12-13 23:39:48 +02:00
Sagi Shnaidman
2d5ca42629 Fix CI and add 2.16 Ansible job
Change-Id: Idcb5d2db4a92084239b80703be6a80de3e9f1116
2024-12-10 17:00:47 +02:00
Sagi Shnaidman
83456005fc Release 2.3.0 version
Change-Id: Ibe054979b707645722f9dd1133b40db95f1aba4e
2024-11-28 19:19:51 +02:00
Zuul
5b61019a34 Merge "Add module to filter available volume services." 2024-11-07 20:04:50 +00:00
Zuul
630dac3787 Merge "Add inactive state for the images" 2024-11-05 12:02:07 +00:00
Zuul
54c2257376 Merge "Allow to specify multiple allocation pools when creating a subnet" 2024-11-05 12:02:06 +00:00
Zuul
c843feb338 Merge "Add target_all_project option" 2024-11-05 11:56:22 +00:00
Simon Hensel
28541ee158 Allow to specify multiple allocation pools when creating a subnet
With this change, multiple allocation pool may be specified when creating
a subnet. Allocation pools are defined as a list of dictionaries.

For example:

openstack.cloud.subnet:
  name: sub1
  network: network1
  cidr: 192.168.0.0/24
  ip_version: 4
  allocation_pools:
    - start: 192.168.0.10
      end: 192.168.0.50
    - start: 192.168.0.100
      end: 192.168.0.150

Change-Id: I77a06990de082466dc6265a14c379b8bbaf789e8
2024-11-05 10:13:45 +01:00
Amir Nikpour
c09029ada0 Add target_all_project option
Adds target_all_project option to neutron_rbac_policy
module, for specifing all projects as target projects
explicitly.

Change-Id: I1393463a79fc83bcda7aa5642f5d3ed27fb195b5
2024-11-05 10:32:08 +03:30
Gaël THEROND (Fl1nt)
903eeb7db7 Add module to filter available volume services.
Add a way to filter which volume service is running on a host or list
which hosts run available volume services.

Closes-Bug: #2010490
Change-Id: Icb17f6019a61d9346472d83ddcd2ad29c340ea05
2024-11-04 13:54:15 +00:00
Christian Berendt
03ebbaed93 Fix typo in openstack.cloud.lb_pool
Change-Id: Ic265ce384d9d4392984bc400e6a286831396d472
2024-11-03 12:15:11 +00:00
Dmitriy Rabotyagov
8d9b8b9a35 Add inactive state for the images
Glance images can be deactivated ad reactivated with corresponding
API calls. It might be useful for operators to be able to control
these states through ansible modules as well. Instead of introduction
of the new parameter we're adding new state for the image that is
`inactive`.

Change-Id: I0738ff564f81a31690872450a4731340ed6bbeb1
2024-11-03 12:12:34 +00:00
Zuul
fef5e127d4 Merge "Allow wait: false when auto_ip is false" 2024-10-31 15:53:55 +00:00
Zuul
01d3011895 Merge "Enable glance-direct interop image import" 2024-10-31 13:51:29 +00:00
James Denton
d4f25d2282 Allow wait: false when auto_ip is false
There is an issue with the logic that results in a failure
to create a server when auto_ip is false. This patch tests
for the bool value of auto_ip and the two lists rather that
None.

Closes-Bug: #2049046
Change-Id: I2664c087c4bde83c4033ab3eb9d3e97dafb9e5cb
Signed-off-by: James Denton <james.denton@rackspace.com>
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2024-10-30 17:44:06 -05:00
Sagi Shnaidman
3df5c38ca6 Fix test for server shelve
Change-Id: I6adb15e82817a4e08ed102a722d9fb44ebe80333
2024-10-29 17:03:36 +02:00
Jay Jahns
474b3804eb Enable glance-direct interop image import
Adds the use_import parameter to enable interop import so
images that need transformation by glance can have it, such as
format conversion.

Closes-Bug: 2084481
Change-Id: I39d1e94ff8ab9f0e0b99c1cef9a814eef0b1f060
2024-10-15 00:29:42 -05:00
Zuul
5a8ad4cdf0 Merge "Fix typo in parameter description" 2024-10-10 21:20:14 +00:00
Zuul
e742016861 Merge "Ensure coe_cluster_template compare labels properly" 2024-10-10 17:03:16 +00:00
Dmitriy Rabotyagov
40a384214c Ensure coe_cluster_template compare labels properly
SDK does return all keys and values of the template labels as
strings. At the same time user can define some labels as integers or
booleans, which will break comparison of labels and lead to module
failure on consecutive runs.

Change-Id: I7ab624428c8bb06030a2b28888f5cb89bb249f08
2024-10-09 20:56:10 +00:00
Pierre Riteau
1188af2486 Fix typo in parameter description
Change-Id: Ia9d4c5b2c8bb27c6088de71c6e55e160d0427ff7
2024-10-09 20:54:02 +00:00
Tobias Urdin
e42e21f621 Add Neutron trunk module
This adds a Ansible module for managing a
Neutron trunk and the sub ports associated
with the trunk.

Change-Id: I0e1c6798b6cc30062c881d1f92fdd4d630d31106
2024-10-09 14:35:52 +00:00
Zuul
e6379e3038 Merge "Fix exception when creating object from file" 2024-10-09 09:08:35 +00:00
Vahid Mohsseni
e0dc4776bb Fix exception when updating container with metadata
A ValueError is raised when running the object_container module with the
`metadata` param against a container with existing metadata.

When the module attempts to enumerate the existing container metadata, a
ValueError exception is raised, because the code is iterating over the
metadata keys, instead of `dict_items`.
Compare to the iteration through another dict `metadata` on the next
line:

    new_metadata = dict((k, v) for k, v in metadata.items()

This change adds a call to `items()` on the dictionary.
Note that this is added outside the parentheses so that the behaviour of the
`or` statement is not affected, and that another exception isn't caused
if `container.metadata` is not a dict.

Closes-Bug: #2071934
Change-Id: Ie5e1f275839e38340a75ab18c3b9ec9bc7745d68
2024-10-09 08:57:18 +11:00
Ben Formosa
22941e86d1 Fix exception when creating object from file
When creating a new object from file, a AttributeError is raised.

This is caused because the sdk does not return anything when creating an
object from a file.

With this change, the `_create` function will always return an object.

Closes-Bug: #2061604
Change-Id: I34cefd1bb10c6eef784e37d26122e5ed2c72488d
2024-10-09 08:53:28 +11:00
Zuul
b089d56136 Merge "Fix regression in quota module" 2024-10-08 15:43:40 +00:00
Zuul
536fe731f7 Merge "Add application_credential module" 2024-10-08 14:27:36 +00:00
Ben Formosa
4a8214b196 Fix regression in quota module
I suspect that the change to `update_quota_set` in openstacksdk commit
[9145dce64](https://opendev.org/openstack/openstacksdk/commit/9145dcec64)
has caused a regession in the quota module, making it not work correctly
for volume and compute quotas.

This change updates the calls to `update_quota_set` with the new
signatures.

Closes-Bug: #2068568
Change-Id: I604a8ffb08a76c20397f43c0ed3b23ddb11e53eb
2024-10-08 16:24:04 +03:00
Sagi Shnaidman
d1b77a3546 Remove 2.9 jobs from Zuul config
It's old and obsolete version, we don't need to run on it.
Change-Id: I1ca3bb1a4c513af1227c08ace4e9df69dca1a4d3
2024-10-08 13:47:14 +03:00
Clark Boylan
8aefe5dc3a Run functional testing regardless of pep8/linter results
The parent change was pushed up initially with a super minor pep8 under
indentation issue. The Zuul config at the time prevent functional
testing from running so we got no indiciation of whether or not the
proposed fix actually fixed the issue.

Update the Zuul config to run pep8 and functional tests concurrently.
Formatting errors are independent of functionality and getting quick
feedback on both gives contributors and reviewers as much feedback as
possible when making decisions about the next step for the code review
process.

The fewer round trips we force everyone to make the less likely we are
to forget about a change or ignore it and otherwise extend the time it
takes to get code merged.

Change-Id: Ib92b3b80f2873327161e23b0ce6bfc6c34850538
2024-10-08 08:11:10 +00:00
Sagi Shnaidman
217e965357 Fix CI in collection
Temporarly disable the quota tests

Change-Id: I7a064649276c1fe0fde025c85817682b0429086a
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2024-10-08 00:14:27 +03:00
Steve Baker
94afde008b Add application_credential module
Create or delete a Keystone application credential.  When the secret
parameter is not set a secret will be generated and returned in the
response. Existing credentials cannot be modified so running this module
against an existing credential will result in it being deleted and
recreated. This needs to be taken into account when the secret is
generated, as the secret will change on each run of the module.

The returned result also includes a usable cloud config which allows
playbooks to easily run openstack tasks using the credential created by
this module.

Change-Id: I0ed86dc8785b0e9d10cc89cd9137a11d02d03945
2024-06-26 01:57:55 +00:00
Zuul
032a5222c1 Merge "Add vlan_tranparency for creation networks" 2024-06-25 23:01:13 +00:00
Zuul
fa6eb547ab Merge "Add insecure_registry property to coe_cluster_templates" 2024-06-25 19:49:25 +00:00
Artem Goncharov
23290a568b Allow munch results in server_info module
Certain branches of the openstacksdk are explicitly converting
`Resource` objects to munch objects to add additional virtual
properties. This means that the module may receive `Resource` or a
`Munch` object. Add a small check.

Change-Id: I413877128d1e2b68d7f39420d19e2560d3d9a99e
2024-06-25 09:27:32 +00:00
Artem Goncharov
69801f268f Wait for deleted server to disappear from results
When we delete server wait for it to completely disappear from the
results (Nova returns it for some time with the 'DELETED' state). Since
tests (and actually also users) not able to really cope with this wait
for server to be gone completely.

Change-Id: Ie2dde98ae47dd7108d554495d5025df175647d5c
2024-06-24 17:56:27 +02:00
Fiorella Yanac
0c6aee5378 Add vlan_tranparency for creation networks
vlan_tranparency can be enabled for creation networks.

Change-Id: If1a874d28507ac89eed38426e97f1a58db020965
2024-06-19 13:43:24 +01:00
Dmitriy Rabotyagov
fb258ababa Add insecure_registry property to coe_cluster_templates
This property was missing from API documentation while being supported
for quite some time.

Change-Id: Idc1e1d78cb33f3183af00ee19446ccfd1f00f266
2024-05-02 16:59:12 +02:00
Slawek Kaplonski
4c186a2ae6 Add support for creation of the default external networks
In Neutron external network can be marked as 'default' and such network
will be used in the auto allocate network functionality [1].
This patch adds support for creation of such default network by the
ansible openstack module.

[1] https://docs.openstack.org/neutron/latest/admin/config-auto-allocation.html

Change-Id: I1aeb91f8142cdc506c3343871e95dcad13f44da0
2024-05-02 10:21:38 +02:00
Zuul
598cc2d743 Merge "fix: subnet module: allow cidr option with subnet_pool" 2024-04-08 14:40:10 +00:00
George Shuklin
e0139fe940 fix: subnet module: allow cidr option with subnet_pool
Specifying CIDR during creation of subnet from subnet pool is a valid
operation. Moreover, in case of use of a subnet pool with multiple
subnets, cidr is a mandatory paramter for creating subnet.

Following code should be valid:

    - name: Create subnet
      openstack.cloud.subnet:
        name: "subnet_name"
        network: "some_network"
        gateway_ip: "192.168.0.1"
        allocation_pool_start: "192.168.0.2"
        allocation_pool_end: "192.168.0.254"
        cidr: "192.168.0.0/24"
        ip_version: 4
        subnet_pool: "192.168.0.0/24"

This scenario is added as a subnet-pool.yaml test in the test role.

Change-Id: I1163ba34ac3079f76dd0b7477a80a2135985a650
2024-04-05 12:30:22 +03:00
Zuul
bc65d42f52 Merge "Disable auto-discovery for setuptools" 2024-03-20 15:45:59 +00:00
Zuul
ac4d105813 Merge "router: Allow specifying external network name in a different project" 2024-03-19 17:33:20 +00:00
Joel Capitao
747c4d23bc Disable auto-discovery for setuptools
Since setuptools release (61.0.0) ansible-collection-openstack's
package build command (python3 setup.py sdist bdist_wheel) is
finding multiple top-level packages in a flat-layout automatically.

This issue is mentioned in setuptools bug 3197 [1], and the suggested
workaround is to disable auto-discovery by adding 'py_modules=[]' in
setup.py.

[1] https://github.com/pypa/setuptools/issues/3197

Change-Id: I4aef1fd59375c4a3bc9e362e7949fa153e4cbcb0
2024-03-14 15:50:28 +01:00
Steve Baker
93d51498e9 CI: Don't create port with binding profile
Creating a port with a binding profile now requires a user with the
service role. This fixes CI by removing the tasks which create a port
with a binding profile. The new policy implies that only other openstack
services should be doing this. The capability can remain in the module,
but it is unlikely to be used unless with a custom or deprecated policy.

Change-Id: I89306d35670503d2fc8e76c030d88f64c20eca08
2024-03-13 14:21:14 +13:00
Mark Goddard
cfd2d1f773 router: Allow specifying external network name in a different project
If a router is created in a specific project, the router module
tried to find its external network in the same project. This would fail
with 'No Network found for <network>' if the external network is in a
different project. This behaviour has changed, most likely in [1] when
the project scoping was added to the find_network function call.

This change modifies the network query to first check the project, then
fall back to a global search if the network is not found. This ensures
that if there are multiple networks with the name we will choose one in
the project first, while allowing use of a network in a different
project.

A regression test has been added to cover this case.

[1] 3fdbd56a58

Closes-Bug: #2049658
Change-Id: Iddc0c63a2ce3c500d7be2f8802f718a22f2895ae
2024-01-24 09:24:32 +00:00
Mark Goddard
e009f80ffc CI: Fix linters-devel and devstack tests
The linters-devel job fails with:

  ansible-test sanity: error: argument --skip-test: invalid choice:
  'metaclass-boilerplate' (choose from 'action-plugin-docs', ...)

The functional test fails with:

  The conditional check 'info1.volumes | selectattr("id", "equalto", "{{
  info.volumes.0.id }}") | list | length == 1' failed. The error was:
  Conditional is marked as unsafe, and cannot be evaluated.

This is due to a change in Ansible 2.17 preventing embedded templates
from referencing unsafe data [1].

[1] https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_9.html#playbook

Change-Id: I2f8411cac1403568afb13c2b96ba452c4c81f126
2024-01-19 17:42:23 +00:00
Dmitry Tantsur
08c93cf9b1 Migrate Bifrost jobs to Ubuntu Jammy
Change-Id: I8971e760457a499129d06bb472598f25ee168a7f
2023-12-19 12:53:18 +01: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
Sagi Shnaidman
5ef192f1f2 Add automatic release job triggered by tag
Currently put it in pre-release pipeline to test that it's ok.

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

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

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

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

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

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

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

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

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

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

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

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

The second option errors with:

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

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

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

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

Suggested patch here:

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

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

credit to https://github.com/AlanCoding

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Ref.: 2f97394847

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

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

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

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

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

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

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

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

Story: #2008445
Task: #41412

Story: #2008444
Task: #41411

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

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

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

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

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

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

Task: 41307
Story: 2008384

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

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

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

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

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

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

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

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

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

Change-Id: I4fd36bf3ed347e020151721a6b56d1cac0a8fd23
2020-10-12 19:08:45 +02:00
371 changed files with 40540 additions and 15792 deletions

1
.gitignore vendored
View File

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

View File

@@ -1,345 +1,368 @@
# 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-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 devstack
# Do not set job.override-checkout or job.required-projects.override-checkout in base job because
# else Zuul will use this branch when matching variants for parent jobs during job freeze
required-projects:
- openstack/ansible-collections-openstack
- openstack/designate
# openstack/devstack is required through parent job openstacksdk-functional-devstack
# openstack/os-client-config is required through parent job openstacksdk-functional-devstack
# openstack/openstacksdk is required through parent job openstacksdk-functional-devstack
irrelevant-files: &ignore_files
- changelogs/.*
- galaxy.*
- COPYING
- docs/.*
- .*\.md
- .*\.rst
- tools/run-ansible-sanity.sh
- tests/sanity/.*
- .zuul.yaml
vars:
zuul_work_dir: src/opendev.org/openstack/ansible-collections-openstack
tox_envlist: ansible_latest
tox_install_siblings: true
fetch_subunit: false
devstack_plugins:
designate: https://opendev.org/openstack/designate
devstack_services:
designate: true
neutron-dns: true
neutron-trunk: true
zuul_copy_output:
'{{ devstack_log_dir }}/test_output.log': 'logs'
extensions_to_txt:
log: true
- job:
name: ansible-collections-openstack-functional-devstack
parent: openstacksdk-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 with latest ansible release
required-projects:
- openstack/ansible-collections-openstack
vars:
zuul_work_dir: src/opendev.org/openstack/ansible-collections-openstack
tox_envlist: ansible-2.9
tox_install_siblings: true
fetch_subunit: false
- job:
name: ansible-collections-openstack-functional-devstack-releases
parent: ansible-collections-openstack-functional-devstack
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-manila-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 Manila 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/manila
- openstack/python-manilaclient
files:
- ^ci/roles/share_type/.*$
- ^plugins/modules/share_type.py
- ^plugins/modules/share_type_info.py
timeout: 10800
vars:
devstack_localrc:
MANILA_ENABLED_BACKENDS: generic
MANILA_OPTGROUP_generic_driver_handles_share_servers: true
MANILA_OPTGROUP_generic_connect_share_server_to_tenant_network: true
MANILA_USE_SERVICE_INSTANCE_PASSWORD: true
devstack_plugins:
manila: https://opendev.org/openstack/manila
devstack_services:
manila: true
m-api: true
m-sch: true
m-shr: true
m-dat: true
tox_extra_args: -vv --skip-missing-interpreters=false -- share_type share_type_info
- 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
using releases of openstacksdk and latest ansible release
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-manila
parent: ansible-collections-openstack-functional-devstack-manila-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
with Manila plugin enabled, using master of openstacksdk and latest
ansible release. Run it only on share_type{,_info} changes.
- job:
name: ansible-collections-openstack-functional-devstack-octavia-base
parent: ansible-collections-openstack-functional-devstack-base
# Do not restrict branches in base jobs because else Zuul would not find a matching
# parent job variant during job freeze when child jobs are on other branches.
description: |
Run openstack collections functional tests against a devstack with Octavia plugin enabled
# Do not set job.override-checkout or job.required-projects.override-checkout in base job because
# else Zuul will use this branch when matching variants for parent jobs during job freeze
required-projects:
- openstack/octavia
files:
- ^ci/roles/loadbalancer/.*$
- ^plugins/modules/lb_health_monitor.py
- ^plugins/modules/lb_listener.py
- ^plugins/modules/lb_member.py
- ^plugins/modules/lb_pool.py
- ^plugins/modules/loadbalancer.py
vars:
tox_envlist: ansible-2.9
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
devstack_services:
designate: true
octavia: true
o-api: true
o-cw: true
o-hm: true
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-ansible-2.10
parent: ansible-collections-openstack-functional-devstack
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
using master of openstacksdk and stable 2.10 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.10
vars:
tox_envlist: ansible
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-ansible-2.9
parent: ansible-collections-openstack-functional-devstack
name: ansible-collections-openstack-functional-devstack-releases
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
using latest releases of openstacksdk and latest ansible release
vars:
tox_constraints_file: '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/constraints-openstacksdk-1.x.x.txt'
tox_install_siblings: false
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.18
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.16 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
override-checkout: stable-2.18
vars:
tox_envlist: ansible-2.9
tox_envlist: ansible_2_18
- 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
# Pip installation job
- job:
name: ansible-collections-openstack-functional-devstack-ansible-pip
parent: ansible-collections-openstack-functional-devstack
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk with latest ansible release.
Ansible collection is built using PIP.
vars:
tox_envlist: ansible-pip
# Stable branches
- job:
name: ansible-collections-openstack-functional-devstack-ussuri-ansible-2.9
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.9 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- name: openstack/openstacksdk
override-branch: ussuri
- name: openstack/devstack
override-checkout: ussuri
vars:
tox_envlist: ansible-2.9
- job:
name: ansible-collections-openstack-functional-devstack-train-ansible-2.9
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a train devstack
using train brach of openstacksdk and stable 2.9 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- name: openstack/openstacksdk
override-branch: train
- name: openstack/devstack
override-checkout: train
vars:
tox_envlist: ansible-2.9
- job:
name: ansible-collections-openstack-functional-devstack-stein-ansible-2.9
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a stein devstack
using stein brach of openstacksdk and stable 2.9 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- name: openstack/openstacksdk
override-branch: stein
- name: openstack/devstack
override-checkout: stein
vars:
tox_envlist: ansible-2.9
- job:
name: ansible-collections-openstack-functional-devstack-rocky-ansible-2.9
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a rocky devstack
using rocky brach of openstacksdk and stable 2.9 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- name: openstack/openstacksdk
override-branch: rocky
- name: openstack/devstack
override-checkout: rocky
vars:
tox_envlist: ansible-2.9
- job:
name: ansible-collections-openstack-functional-devstack-queens-ansible-2.9
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a queens devstack
using master brach of openstacksdk and stable 2.9 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- name: openstack/openstacksdk
override-branch: master
- name: openstack/devstack
override-checkout: queens
vars:
tox_envlist: ansible-2.9
- job:
name: ansible-collections-openstack-functional-devstack-queens-ansible-2.10
parent: ansible-collections-openstack-functional-devstack-ansible-devel
description: |
Run openstack collections functional tests against a queens devstack
using master brach of openstacksdk and stable 2.10 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.10
- name: openstack/openstacksdk
override-branch: master
- name: openstack/devstack
override-checkout: queens
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 brach of openstacksdk and devel branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
- name: openstack/openstacksdk
override-branch: master
- name: openstack/devstack
override-checkout: queens
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
# Linters
- job:
name: openstack-tox-linters-ansible-2.10
name: openstack-tox-linters-ansible
parent: openstack-tox-linters
nodeset: ubuntu-bionic
description: |
Run openstack collections linter tests using the 2.10 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.10
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.18
parent: openstack-tox-linters-ansible
description: |
Run openstack collections linter tests using the 2.18 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
override-checkout: stable-2.18
vars:
tox_envlist: linters-2.9
tox_envlist: linters_2_18
python_version: "3.12"
bindep_profile: test py312
# Cross-checks with other projects
- job:
name: bifrost-collections-src
parent: bifrost-integration-tinyipa-ubuntu-bionic
parent: bifrost-integration-tinyipa-ubuntu-jammy
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-bionic
parent: bifrost-integration-tinyipa-keystone-ubuntu-jammy
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: ansible-collections-openstack-release
parent: openstack-tox-linters-ansible
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
- QJ3c5LfmM4YmqwwLKv4wK5lroWDLGeMyPkmHXhvf0ry3vGjKZvZxVpbIhFXJHXevHov/r
nvlqwmG8D5msynQKZDFg2ZwSMIQWRKfSbsSLe7A6NWI2wC+QtZSPiRiBcBcHY1QbNNW21
84cssYa1oHOA0WXpomBz1qXuPV48aKLjMnWysgFhNSx3Oog+ZOSCczyyVVuXP1lIWIO26
AtRTrEcr37K3JY9usE2PCbZKFOq/+IDPz9fbS7PtBOv7iXOHOf3AfBiJiaJe3q/ecoaaq
ejk2WTKWfvq/3rY4pU1976kUcxgcd+jj9ReFyw8edCsc1ecL0qmZFbdHmC03jEcVo4p8I
WJQ0D5wk4/u2Fu9texNuBvb62Yu3Y028Zhm5rz8Zl/ISsdaA3losn5S7C7iAH/yKlGQEI
N/1X4M0tVPaMtsIhZyyz+JMbeNyVR9ZarqbtpzRtVhjxL7KOiAQbEzAmZcBbCJ2Z5iI+P
bTp03f9Y/tZNtkohARvx1TKhv8CvsmyGkMm+r5Y8aWz3SNy8LL6bSwtGun/ifbnadHmw/
TD5/UUXHHjBGkeAu9HTtwUZ5Qdkfg92PnPgruAAuOkF1Y4RyRS9qvwhtqyHO8TwU0INRY
5MHEzeOQWemoQb/qdENp+J/Q9oMEbpFYv9TkrWkxVoKop6Str8e3FF5sxmN/SE=
- project:
check:
jobs:
- tox-pep8
- openstack-tox-linters-ansible-devel
- openstack-tox-linters-ansible-2.10
- openstack-tox-linters-ansible-2.9
- ansible-collections-openstack-functional-devstack:
dependencies: &deps_unit_lint
- tox-pep8
- openstack-tox-linters-ansible-2.9
irrelevant-files: &ignore_files
- changelogs/.*
- COPYING
- docs/.*
- .*\.md
- .*\.rst
- tools/run-ansible-sanity.sh
- tests/sanity/.*
- contrib/.*
- ansible-collections-openstack-functional-devstack:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-releases:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-ansible-2.10:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-ansible-devel:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-ansible-pip:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-ussuri-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-train-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-stein-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-rocky-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-queens-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- openstack-tox-linters-ansible-2.18
- ansible-collections-openstack-functional-devstack
- ansible-collections-openstack-functional-devstack-releases
- ansible-collections-openstack-functional-devstack-ansible-2.18
- ansible-collections-openstack-functional-devstack-ansible-devel
- ansible-collections-openstack-functional-devstack-magnum
- ansible-collections-openstack-functional-devstack-manila
- ansible-collections-openstack-functional-devstack-octavia
- 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.10
- openstack-tox-linters-ansible-2.9
- ansible-collections-openstack-functional-devstack
- openstack-tox-linters-ansible-2.18
- ansible-collections-openstack-functional-devstack-releases
- ansible-collections-openstack-functional-devstack-ansible-2.9
- ansible-collections-openstack-functional-devstack-ansible-2.10
- ansible-collections-openstack-functional-devstack-ansible-pip
- ansible-collections-openstack-functional-devstack-ussuri-ansible-2.9
- ansible-collections-openstack-functional-devstack-train-ansible-2.9
- ansible-collections-openstack-functional-devstack-stein-ansible-2.9
- ansible-collections-openstack-functional-devstack-rocky-ansible-2.9
- ansible-collections-openstack-functional-devstack-queens-ansible-2.9
- ansible-collections-openstack-functional-devstack-magnum
- ansible-collections-openstack-functional-devstack-manila
- ansible-collections-openstack-functional-devstack-octavia
periodic:
jobs:
- openstack-tox-linters-ansible-devel
- openstack-tox-linters-ansible-2.10
- openstack-tox-linters-ansible-2.9
- openstack-tox-linters-ansible-2.18
- 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.10
- ansible-collections-openstack-functional-devstack-ansible-2.18
- ansible-collections-openstack-functional-devstack-ansible-devel
- ansible-collections-openstack-functional-devstack-ansible-pip
- ansible-collections-openstack-functional-devstack-ussuri-ansible-2.9
- ansible-collections-openstack-functional-devstack-train-ansible-2.9
- ansible-collections-openstack-functional-devstack-stein-ansible-2.9
- ansible-collections-openstack-functional-devstack-rocky-ansible-2.9
- ansible-collections-openstack-functional-devstack-queens-ansible-2.9
- ansible-collections-openstack-functional-devstack-queens-ansible-2.10
- ansible-collections-openstack-functional-devstack-queens-ansible-devel
- bifrost-collections-src
- bifrost-keystone-collections-src
- ansible-collections-openstack-functional-devstack-magnum
- ansible-collections-openstack-functional-devstack-manila
- ansible-collections-openstack-functional-devstack-octavia
tag:
jobs:
- ansible-collections-openstack-release

View File

@@ -1,9 +1,639 @@
=============================================
Openstack Cloud Ansilbe modules Release Notes
=============================================
==========================================
Ansible OpenStack Collection Release Notes
==========================================
.. contents:: Topics
v2.5.0
======
Release Summary
---------------
Bugfixes and minor changes
Major Changes
-------------
- Add import_method to module
- Add object_containers_info module
- Add support for filters in inventory
- Add volume_manage module
- Introduce share_type modules
Minor Changes
-------------
- Allow role_assignment module to work cross domain
- Don't compare current state for `reboot_*` actions
- Fix disable_gateway_ip for subnet
- Fix disable_gateway_ip for subnet
- Fix example in the dns_zone_info module doc
- Fix router module external IPs when only subnet specified
- Fix the bug reporting url
- Let clouds_yaml_path behave as documented (Override path to clouds.yaml file)
- Shows missing data in `stack_info` module output
v2.4.1
======
Release Summary
---------------
Bugfixes and minor changes
Minor Changes
-------------
- Update tags when changing server
Bugfixes
--------
- Fix missed client_cert in OpenStackModule
v2.4.0
======
Release Summary
---------------
New trait module and minor changes
Major Changes
-------------
- Add trait module
Minor Changes
-------------
- Add loadbalancer quota options
- Allow create instance with tags
New Modules
-----------
- openstack.cloud.trait - Add or Delete a trait from OpenStack
v2.3.3
======
Release Summary
---------------
Bugfixes and minor changes
Minor Changes
-------------
- Add test to only_ipv4 in inventory
- add an option to use only IPv4 only for ansible_host and ansible_ssh_host
Bugfixes
--------
- CI - Fix deprecated ANSIBLE_COLLECTIONS_PATHS variable
v2.3.2
======
Release Summary
---------------
Bugfixes and minor changes
Minor Changes
-------------
- Drop compat implementations for tests
Bugfixes
--------
- Fix openstack.cloud.port module failure in check mode
v2.3.1
======
Release Summary
---------------
Client TLS certificate support
Minor Changes
-------------
- Add ability to pass client tls certificate
v2.3.0
======
Release Summary
---------------
Bugfixes and new modules
Major Changes
-------------
- Add Neutron trunk module
- Add application_credential module
- Add module to filter available volume services
Minor Changes
-------------
- Add inactive state for the images
- Add insecure_registry property to coe_cluster_templates
- Add support for creation of the default external networks
- Add target_all_project option
- Add vlan_tranparency for creation networks
- Allow munch results in server_info module
- Allow to specify multiple allocation pools when creating a subnet
- CI - Disable auto-discovery for setuptools
- CI - Don't create port with binding profile
- CI - Fix CI in collection
- CI - Fix linters-devel and devstack tests
- CI - Fix regression in quota module
- CI - Fix test for server shelve
- CI - Migrate Bifrost jobs to Ubuntu Jammy
- CI - Remove 2.9 jobs from Zuul config
- CI - Run functional testing regardless of pep8/linter results
- Enable glance-direct interop image import
- Ensure coe_cluster_template compare labels properly
- Wait for deleted server to disappear from results
- router - Allow specifying external network name in a different project
Bugfixes
--------
- Allow wait false when auto_ip is false
- Fix exception when creating object from file
- Fix exception when updating container with metadata
- Fix typo in openstack.cloud.lb_pool
- Fix typo in parameter description
- fix subnet module - allow cidr option with subnet_pool
New Modules
-----------
- openstack.cloud.application_credential - Manage OpenStack Identity (Keystone) application credentials
- openstack.cloud.trunk - Add or delete trunks from an OpenStack cloud
- openstack.cloud.volume_service_info - Fetch OpenStack Volume (Cinder) services
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
======
Release Summary
---------------
New modules for DNS and FIPs and bugfixes.
Minor Changes
-------------
- Add bindep.txt for ansible-builder
- Add check_mode attribute to OpenstackModule
- Migrating image module from AnsibleModule to OpenStackModule
- Switch KeystoneFederationProtocolInfo module to OpenStackModule
- Switch ProjectAccess module to OpenStackModule
- Switch Quota module to OpenStackModule
- Switch Recordset module to OpenStackModule
- Switch ServerGroup module to OpenStackModule
- Switch ServerMetadata module to OpenStackModule
- Switch Snapshot module to OpenStackModule
- Switch Stack module to OpenStackModule
- Switch auth module to OpenStackModule
- Switch catalog_service module to OpenStackModule
- Switch coe_cluster module to OpenStackModule
- Switch coe_cluster_template module to OpenStackModule
- Switch endpoint module to OpenStackModule
- Switch federation_idp module to OpenStackModule
- Switch federation_idp_info module to OpenStackModule
- Switch federation_mapping module to OpenStackModule
- Switch federation_mapping_info module to OpenStackModule
- Switch federation_protocol module to OpenStackModule
- Switch flavor module to OpenStackModule
- Switch flavor_info module to OpenStackModule
- Switch floating_ip module to OpenStackModule
- Switch group_assignment module to OpenStackModule
- Switch hostaggregate module to OpenStackModule
- Switch identity_domain module to OpenStackModule
- Switch identity_domain_info module to OpenStackModule
- Switch identity_group module to OpenStackModule
- Switch identity_group_info module to OpenStackModule
- Switch identity_role module to OpenStackModule
- Switch identity_user module to OpenStackModule
- Switch lb_listener module to OpenStackModule
- Switch lb_member module to OpenStackModule
- Switch lb_pool module to OpenStackModule
- Switch object module to OpenStackModule
- Switch port module to OpenStackModule
- Switch port_info module to OpenStackModule
- Switch project and project_info module to OpenStackModule
- Switch role_assignment module to OpenStackModule
- Switch user_info module to OpenStackModule
- image - Add support to setting image tags
Bugfixes
--------
- Update checks for validate_certs in openstack_cloud_from_module
- compute_flavor - Fix the idempotent of compute_flavor module
- host_aggregate - Fix host_aggregate to tolerate aggregate.hosts being None
- inventory/openstack - Fix inventory plugin on Ansible 2.11
- port - fix update on empty list of allowed address pairs
- setup.cfg Replace dashes with underscores
- subnet - Only apply necessary changes to subnets
- volume - Fail if referenced source image for a new volume does not exist
New Modules
-----------
- openstack.cloud.address_scope - Create or delete address scopes from OpenStack
- openstack.cloud.dns_zone_info - Getting information about dns zones
- openstack.cloud.floating_ip_info - Get information about floating ips
v1.4.0
======
Release Summary
---------------
New object_container module and bugfixes.
Bugfixes
--------
- Add Octavia job for testing Load Balancer
- Add binding profile to port module
- Add execution environment metadata
- Fix CI for latest ansible-test with no_log
- Fix issues with newest ansible-test 2.11
- Prepare for Ansible 2.11 tests
- add option to exclude legacy groups
- security_group_rule add support ipv6-icmp
New Modules
-----------
- openstack.cloud.object_container - Manage Swift container
v1.3.0
======
Release Summary
---------------
New modules and bugfixes.
Minor Changes
-------------
- Fix some typos in readme
- Guidelines Fix links and formatting
- baremetal_node - Add support for new features
- baremetal_node - ironic deprecate sub-options of driver_info
- baremetal_node - ironic stop putting meaningless values to properties
- image_info - Migrating image_info module from AnsibleModule to OpenStackModule
- recordset - Update recordset docu
- server - Allow description field to be set with os_server
- server_action - Added shelve and unshelve as new server actions
Bugfixes
--------
- port - Fixed check for None in os_port
- project - Fix setting custom property on os_project
- security_group_rule - Remove protocols choice in security rules
- volume_info - Fix volume_info result for SDK < 0.19
New Modules
-----------
- openstack.cloud.identity_role_info - Retrieve information about Openstack Identity roles.
- openstack.cloud.keypair_info - Retrieve information about Openstack key pairs.
- openstack.cloud.security_group_info - Retrieve information about Openstack Security Groups.
- openstack.cloud.security_group_rule_info - Retrieve information about Openstack Security Group rules.
- openstack.cloud.stack_info - Retrieve information about Openstack Heat stacks.
v1.2.1
======
Release Summary
---------------
Porting modules to new OpenstackModule class and fixes.
Minor Changes
-------------
- dns_zone - Migrating dns_zone from AnsibleModule to OpenStackModule
- dns_zone, recordset - Enable update for recordset and add tests for dns and recordset module
- endpoint - Do not fail when endpoint state is absent
- ironic - Refactor ironic authentication into a new module_utils module
- loadbalancer - Refactor loadbalancer module
- network - Migrating network from AnsibleModule to OpenStackModule
- networks_info - Migrating networks_info from AnsibleModule to OpenStackModule
- openstack - Add galaxy.yml to support install from git
- openstack - Fix docs-args mismatch in modules
- openstack - OpenStackModule Support defining a minimum version of the SDK
- router - Migrating routers from AnsibleModule to OpenStackModule
- routers_info - Added deprecated_names for router_info module
- routers_info - Migrating routers_info from AnsibleModule to OpenStackModule
- security_group.py - Migrating security_group from AnsibleModule to OpenStackModule
- security_group_rule - Refactor TCP/UDP port check
- server.py - Improve "server" module with OpenstackModule class
- server_volume - Migrating server_volume from AnsibleModule to OpenStackModule
- subnet - Fix subnets update and idempotency
- subnet - Migrating subnet module from AnsibleModule to OpenStackModule
- subnets_info - Migrating subnets_info from AnsibleModule to OpenStackModule
- volume.py - Migrating volume from AnsibleModule to OpenStackModule
- volume_info - Fix volume_info arguments for SDK 0.19
v1.2.0
======

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

230
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 Openstack Cloud collection firstly need to install `ansible` and `openstacksdk` Python modules on 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 not standard Python interpreter on the target host.
Using Python verison 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 via `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 Openstack Cloud collection, please reference the full namespace, collection name, and modules name that you want to use:
```sh
ansible-galaxy collection install -r requirements.yml
```
## Usage
To use a module from the 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
@@ -66,16 +89,16 @@ To use a module from Openstack Cloud collection, please reference the full names
volume_size: 75
```
Or you can add full namepsace and collecton name in the `collections` element:
Or you can add the full namespace and collection name in the `collections` element:
```yaml
---
- name: Using Openstack Cloud collection
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 full namepsace and collecton name in the `collections` element:
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://bugs.launchpad.net/ansible-collections-openstack).
- [Submit and review patches](
https://review.opendev.org/#/q/project:openstack/ansible-collections-openstack).
- Follow OpenStack's [How To Contribute](https://wiki.openstack.org/wiki/How_To_Contribute) guide.
We work with [OpenDev Gerrit](https://review.opendev.org/), pull requests submitted through GitHub will be ignored.
## Testing and Development
If you want to develop new content for this collection or improve what is already here, the easiest way to work on the collection is to clone it into one of the configured [`COLLECTIONS_PATHS`](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#collections-paths), and work on it there.
### Testing with `ansible-test`
We use `ansible-test` for sanity:
```bash
tox -e linters
```
## More Information
TBD
Please read our [Contributions and Development Guide](docs/contributing.md) (⚠️) and our [Review Guide](
docs/reviewing.md) (⚠️) before sending your first patch. Pull requests submitted through GitHub will be ignored.
## Communication
We have a dedicated Interest Group for Openstack Ansible modules.
You can find other people interested in this in `#openstack-ansible-sig` on Freenode IRC.
We have a Special Interest Group for the Ansible OpenStack collection. Join us in `#openstack-ansible-sig` on
[OFTC IRC](https://www.oftc.net/) 🍪
## License
GNU General Public License v3.0 or later
See [LICENCE](https://opendev.org/openstack/ansible-collections-openstack/src/branch/master/COPYING) to see the full text.
See [LICENCE](COPYING) to see the full text.

7
bindep.txt Normal file
View File

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

View File

@@ -1,84 +1,638 @@
ancestor: null
releases:
1.2.0:
release_date: '2020-10-13'
changes:
release_summary: New volume backup modules.
minor_changes:
- lb_health_monitor - Make it possible to create a health monitor to a pool
modules:
- name: volume_snapshot_info module
description: Retrieve information about Openstack volume snapshots.
namespace: ''
- name: volume_backup_info module
description: Retrieve information about Openstack volume backups.
namespace: ''
- name: volume_backup module
description: Add/Delete Openstack volumes backup.
namespace: ''
1.1.0:
release_date: '2020-08-17'
changes:
release_summary: Starting redesign modules and bugfixes.
minor_changes:
- A basic module subclass was introduced and a few modules moved to inherit from it.
- Added pip installation option for collection.
- Added template for generation of artibtrary module.
- Add more useful information from exception
- inventory_openstack - Add openstack logger and Ansible display utility
- loadbalancer - Add support for setting the Flavor when creating a load balancer
- baremetal modules - Do not require ironic_url if cloud or auth.endpoint is provided
bugfixes:
- security_group_rule - Don't pass tenant_id for remote group
- Fix non existing attribuites in SDK exception
modules:
- name: volume_info
description: Retrieve information about Openstack volumes.
namespace: ''
1.0.1:
release_date: '2020-05-22'
changes:
release_summary: Bugfix for server_info
bugfixes:
- server_info - Fix broken server_info module and add tests
1.0.0:
release_date: '2020-05-19'
changes:
release_summary: Initial release of collection.
minor_changes:
- Renaming all modules and removing "os" prefix from names.
- server_action - pass imageRef to rebuild
- subnet - Updated allocation pool checks
- project - Add properties for os_project
- config - Update os_client_config to use openstacksdk
- host_aggregate - Add support for not 'purging' missing hosts
- baremetal_node_action - Support json type for the ironic_node config_drive parameter
bugfixes:
- federation_mapping - Fixup some minor nits found in followup reviews
- coe_cluster - Retrive id/uuid correctly
- baremetal_node - Correct parameter name
- network - Bump minimum openstacksdk version when using os_network/dns_domain
- inventory_openstack - Fix constructed compose
- role_assignment - Fix os_user_role for groups in multidomain context
- role_assignment - Fix os_user_role issue to grant a role in a domain
- baremetal_node - Correct parameter name
- coe_cluster - Retrive id/uuid correctly
- federation_mapping - Fixup some minor nits found in followup reviews
- inventory_openstack - Fix constructed compose
- network - Bump minimum openstacksdk version when using os_network/dns_domain
- role_assignment - Fix os_user_role for groups in multidomain context
- role_assignment - Fix os_user_role issue to grant a role in a domain
minor_changes:
- Renaming all modules and removing "os" prefix from names.
- baremetal_node_action - Support json type for the ironic_node config_drive
parameter
- config - Update os_client_config to use openstacksdk
- host_aggregate - Add support for not 'purging' missing hosts
- project - Add properties for os_project
- server_action - pass imageRef to rebuild
- subnet - Updated allocation pool checks
release_summary: Initial release of collection.
modules:
- name: keystone_federation_protocol_info
description: Add support for getting information about Keystone federation Protocols
namespace: ''
- name: keystone_federation_protocol
description: Add support for Keystone federation Protocols
namespace: ''
- name: federation_idp_info
description: Add support for fetching the information about federation IDPs
namespace: ''
- name: federation_idp
description: Add support for Keystone Identity Providers
namespace: ''
- name: federation_mapping_info
description: Add support for fetching the information about Keystone mappings
namespace: ''
- name: federation_mapping
description: Add support for Keystone mappings
namespace: ''
- name: routers_info
description: Retrieve information about one or more OpenStack routers.
namespace: ''
- description: Add support for Keystone Identity Providers
name: federation_idp
namespace: ''
- description: Add support for fetching the information about federation IDPs
name: federation_idp_info
namespace: ''
- description: Add support for Keystone mappings
name: federation_mapping
namespace: ''
- description: Add support for fetching the information about Keystone mappings
name: federation_mapping_info
namespace: ''
- description: Add support for Keystone federation Protocols
name: keystone_federation_protocol
namespace: ''
- description: Add support for getting information about Keystone federation Protocols
name: keystone_federation_protocol_info
namespace: ''
- description: Retrieve information about one or more OpenStack routers.
name: routers_info
namespace: ''
release_date: '2020-05-19'
1.0.1:
changes:
bugfixes:
- server_info - Fix broken server_info module and add tests
release_summary: Bugfix for server_info
release_date: '2020-05-22'
1.1.0:
changes:
bugfixes:
- Fix non existing attribuites in SDK exception
- security_group_rule - Don't pass tenant_id for remote group
minor_changes:
- A basic module subclass was introduced and a few modules moved to inherit
from it.
- Add more useful information from exception
- Added pip installation option for collection.
- Added template for generation of artibtrary module.
- baremetal modules - Do not require ironic_url if cloud or auth.endpoint is
provided
- inventory_openstack - Add openstack logger and Ansible display utility
- loadbalancer - Add support for setting the Flavor when creating a load balancer
release_summary: Starting redesign modules and bugfixes.
modules:
- description: Retrieve information about Openstack volumes.
name: volume_info
namespace: ''
release_date: '2020-08-17'
1.2.0:
changes:
minor_changes:
- lb_health_monitor - Make it possible to create a health monitor to a pool
release_summary: New volume backup modules.
modules:
- description: Add/Delete Openstack volumes backup.
name: volume_backup module
namespace: ''
- description: Retrieve information about Openstack volume backups.
name: volume_backup_info module
namespace: ''
- description: Retrieve information about Openstack volume snapshots.
name: volume_snapshot_info module
namespace: ''
release_date: '2020-10-13'
1.2.1:
changes:
minor_changes:
- dns_zone - Migrating dns_zone from AnsibleModule to OpenStackModule
- dns_zone, recordset - Enable update for recordset and add tests for dns and
recordset module
- endpoint - Do not fail when endpoint state is absent
- ironic - Refactor ironic authentication into a new module_utils module
- loadbalancer - Refactor loadbalancer module
- network - Migrating network from AnsibleModule to OpenStackModule
- networks_info - Migrating networks_info from AnsibleModule to OpenStackModule
- openstack - Add galaxy.yml to support install from git
- openstack - Fix docs-args mismatch in modules
- openstack - OpenStackModule Support defining a minimum version of the SDK
- router - Migrating routers from AnsibleModule to OpenStackModule
- routers_info - Added deprecated_names for router_info module
- routers_info - Migrating routers_info from AnsibleModule to OpenStackModule
- security_group.py - Migrating security_group from AnsibleModule to OpenStackModule
- security_group_rule - Refactor TCP/UDP port check
- server.py - Improve "server" module with OpenstackModule class
- server_volume - Migrating server_volume from AnsibleModule to OpenStackModule
- subnet - Fix subnets update and idempotency
- subnet - Migrating subnet module from AnsibleModule to OpenStackModule
- subnets_info - Migrating subnets_info from AnsibleModule to OpenStackModule
- volume.py - Migrating volume from AnsibleModule to OpenStackModule
- volume_info - Fix volume_info arguments for SDK 0.19
release_summary: Porting modules to new OpenstackModule class and fixes.
release_date: '2021-01-03'
1.3.0:
changes:
bugfixes:
- port - Fixed check for None in os_port
- project - Fix setting custom property on os_project
- security_group_rule - Remove protocols choice in security rules
- volume_info - Fix volume_info result for SDK < 0.19
minor_changes:
- Fix some typos in readme
- Guidelines Fix links and formatting
- baremetal_node - Add support for new features
- baremetal_node - ironic deprecate sub-options of driver_info
- baremetal_node - ironic stop putting meaningless values to properties
- image_info - Migrating image_info module from AnsibleModule to OpenStackModule
- recordset - Update recordset docu
- server - Allow description field to be set with os_server
- server_action - Added shelve and unshelve as new server actions
release_summary: New modules and bugfixes.
modules:
- description: Retrieve information about Openstack Identity roles.
name: identity_role_info
namespace: ''
- description: Retrieve information about Openstack key pairs.
name: keypair_info
namespace: ''
- description: Retrieve information about Openstack Security Groups.
name: security_group_info
namespace: ''
- description: Retrieve information about Openstack Security Group rules.
name: security_group_rule_info
namespace: ''
- description: Retrieve information about Openstack Heat stacks.
name: stack_info
namespace: ''
release_date: '2021-02-16'
1.4.0:
changes:
bugfixes:
- Add Octavia job for testing Load Balancer
- Add binding profile to port module
- Add execution environment metadata
- Fix CI for latest ansible-test with no_log
- Fix issues with newest ansible-test 2.11
- Prepare for Ansible 2.11 tests
- add option to exclude legacy groups
- security_group_rule add support ipv6-icmp
release_summary: New object_container module and bugfixes.
modules:
- description: Manage Swift container
name: object_container
namespace: ''
release_date: '2021-04-08'
1.5.0:
changes:
bugfixes:
- Update checks for validate_certs in openstack_cloud_from_module
- compute_flavor - Fix the idempotent of compute_flavor module
- host_aggregate - Fix host_aggregate to tolerate aggregate.hosts being None
- inventory/openstack - Fix inventory plugin on Ansible 2.11
- port - fix update on empty list of allowed address pairs
- setup.cfg Replace dashes with underscores
- subnet - Only apply necessary changes to subnets
- volume - Fail if referenced source image for a new volume does not exist
minor_changes:
- Add bindep.txt for ansible-builder
- Add check_mode attribute to OpenstackModule
- Migrating image module from AnsibleModule to OpenStackModule
- Switch KeystoneFederationProtocolInfo module to OpenStackModule
- Switch ProjectAccess module to OpenStackModule
- Switch Quota module to OpenStackModule
- Switch Recordset module to OpenStackModule
- Switch ServerGroup module to OpenStackModule
- Switch ServerMetadata module to OpenStackModule
- Switch Snapshot module to OpenStackModule
- Switch Stack module to OpenStackModule
- Switch auth module to OpenStackModule
- Switch catalog_service module to OpenStackModule
- Switch coe_cluster module to OpenStackModule
- Switch coe_cluster_template module to OpenStackModule
- Switch endpoint module to OpenStackModule
- Switch federation_idp module to OpenStackModule
- Switch federation_idp_info module to OpenStackModule
- Switch federation_mapping module to OpenStackModule
- Switch federation_mapping_info module to OpenStackModule
- Switch federation_protocol module to OpenStackModule
- Switch flavor module to OpenStackModule
- Switch flavor_info module to OpenStackModule
- Switch floating_ip module to OpenStackModule
- Switch group_assignment module to OpenStackModule
- Switch hostaggregate module to OpenStackModule
- Switch identity_domain module to OpenStackModule
- Switch identity_domain_info module to OpenStackModule
- Switch identity_group module to OpenStackModule
- Switch identity_group_info module to OpenStackModule
- Switch identity_role module to OpenStackModule
- Switch identity_user module to OpenStackModule
- Switch lb_listener module to OpenStackModule
- Switch lb_member module to OpenStackModule
- Switch lb_pool module to OpenStackModule
- Switch object module to OpenStackModule
- Switch port module to OpenStackModule
- Switch port_info module to OpenStackModule
- Switch project and project_info module to OpenStackModule
- Switch role_assignment module to OpenStackModule
- Switch user_info module to OpenStackModule
- image - Add support to setting image tags
release_summary: New modules for DNS and FIPs and bugfixes.
modules:
- description: Create or delete address scopes from OpenStack
name: address_scope
namespace: ''
- description: Getting information about dns zones
name: dns_zone_info
namespace: ''
- description: Get information about floating ips
name: floating_ip_info
namespace: ''
release_date: '2021-06-23'
1.5.1:
changes:
bugfixes:
- Add mandatory requires_ansible version to metadata
- Add protocol listener octavia
- Add support check mode for all info modules
- Allow to attach multiple floating ips to a server
- Only add or remove router interfaces when needed
- Wait for pool to be active and online
minor_changes:
- Changed minversion in tox to 3.18.0
- Update IRC server in README
release_summary: Bugfixes for networking modules
release_date: '2021-09-02'
1.5.2:
changes:
bugfixes:
- Add client and member listener timeouts for persistence (Ex. SSH)
- Added missing warn() used in cloud.openstack.quota
- Fix issue with same host and group names
- Flavor properties are not deleted on changes and id will stay
minor_changes:
- Add documentation links to README.md
- Don't run functional jobs on galaxy.yml change
- Move CI to use Ansible 2.12 version as main
release_summary: Bugfixes
release_date: '2021-11-09'
1.5.3:
changes:
bugfixes:
- Don't require allowed_address_pairs for port
- server_volume - check specified server is found
release_summary: Bugfixes
release_date: '2021-11-11'
1.6.0:
changes:
minor_changes:
- quota - Adds metadata_items parameter
release_summary: New modules for RBAC and Nova services
modules:
- description: Retrieve information about one or more OpenStack compute services
name: compute_service_info
namespace: ''
- description: Fetch Neutron policies.
name: neutron_rbac_policies_info
namespace: ''
- description: Create or delete a Neutron policy to apply a RBAC rule against
an object.
name: neutron_rbac_policy
namespace: ''
release_date: '2022-01-13'
1.7.0:
changes:
bugfixes:
- identity_user_info - Fix identity user lookup with a domain
- keystone_domain - Move identity domain to use proxy layer
minor_changes:
- openstack_inventory - Adds use_name variable
- port - Add dns_[name,domain] to the port module
- project - Remove project properties tests and support
release_summary: New modules for Ironic and bugfixes
modules:
- description: Retrieve information about Bare Metal nodes from OpenStack an object.
name: baremetal_node_info
namespace: ''
- description: Create, Update, Remove ironic ports from OpenStack
name: baremetal_port
namespace: ''
- description: Retrieve information about Bare Metal ports from OpenStack an object.
name: baremetal_port_info
namespace: ''
release_date: '2022-02-15'
1.7.1:
changes:
bugfixes:
- openstack_inventory - Fix documentation
- quota - Fix description of volumes_types parameter
minor_changes:
- lb_member - Add monitor_[address,port] parameter
release_summary: Bugfixes
release_date: '2022-03-08'
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'
2.3.0:
changes:
bugfixes:
- Allow wait false when auto_ip is false
- Fix exception when creating object from file
- Fix exception when updating container with metadata
- Fix typo in openstack.cloud.lb_pool
- Fix typo in parameter description
- fix subnet module - allow cidr option with subnet_pool
major_changes:
- Add Neutron trunk module
- Add application_credential module
- Add module to filter available volume services
minor_changes:
- Add inactive state for the images
- Add insecure_registry property to coe_cluster_templates
- Add support for creation of the default external networks
- Add target_all_project option
- Add vlan_tranparency for creation networks
- Allow munch results in server_info module
- Allow to specify multiple allocation pools when creating a subnet
- CI - Disable auto-discovery for setuptools
- CI - Don't create port with binding profile
- CI - Fix CI in collection
- CI - Fix linters-devel and devstack tests
- CI - Fix regression in quota module
- CI - Fix test for server shelve
- CI - Migrate Bifrost jobs to Ubuntu Jammy
- CI - Remove 2.9 jobs from Zuul config
- CI - Run functional testing regardless of pep8/linter results
- Enable glance-direct interop image import
- Ensure coe_cluster_template compare labels properly
- Wait for deleted server to disappear from results
- router - Allow specifying external network name in a different project
release_summary: Bugfixes and new modules
modules:
- description: Manage OpenStack Identity (Keystone) application credentials
name: application_credential
namespace: ''
- description: Add or delete trunks from an OpenStack cloud
name: trunk
namespace: ''
- description: Fetch OpenStack Volume (Cinder) services
name: volume_service_info
namespace: ''
release_date: '2024-11-28'
2.3.1:
changes:
minor_changes:
- Add ability to pass client tls certificate
release_summary: Client TLS certificate support
release_date: '2024-12-18'
2.3.2:
changes:
bugfixes:
- Fix openstack.cloud.port module failure in check mode
minor_changes:
- Drop compat implementations for tests
release_summary: Bugfixes and minor changes
release_date: '2024-12-20'
2.3.3:
changes:
bugfixes:
- CI - Fix deprecated ANSIBLE_COLLECTIONS_PATHS variable
minor_changes:
- Add test to only_ipv4 in inventory
- add an option to use only IPv4 only for ansible_host and ansible_ssh_host
release_summary: Bugfixes and minor changes
release_date: '2024-12-22'
2.4.0:
changes:
major_changes:
- Add trait module
minor_changes:
- Add loadbalancer quota options
- Allow create instance with tags
release_summary: New trait module and minor changes
modules:
- description: Add or Delete a trait from OpenStack
name: trait
namespace: ''
release_date: '2025-01-15'
2.4.1:
changes:
bugfixes:
- Fix missed client_cert in OpenStackModule
minor_changes:
- Update tags when changing server
release_summary: Bugfixes and minor changes
release_date: '2024-01-20'
2.5.0:
changes:
major_changes:
- Add import_method to module
- Add object_containers_info module
- Add support for filters in inventory
- Add volume_manage module
- Introduce share_type modules
minor_changes:
- Allow role_assignment module to work cross domain
- Don't compare current state for `reboot_*` actions
- Fix disable_gateway_ip for subnet
- Fix disable_gateway_ip for subnet
- Fix example in the dns_zone_info module doc
- Fix router module external IPs when only subnet specified
- Fix the bug reporting url
- Let clouds_yaml_path behave as documented (Override path to clouds.yaml file)
- Shows missing data in `stack_info` module output
release_summary: Bugfixes and minor changes
release_date: '2025-10-24'

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

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

View File

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

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

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

View File

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

View File

@@ -0,0 +1,9 @@
expected_fields:
- description
- expires_at
- id
- name
- project_id
- roles
- secret
- unrestricted

View File

@@ -0,0 +1,61 @@
---
- name: Create application credentials
openstack.cloud.application_credential:
cloud: "{{ cloud }}"
state: present
name: ansible_creds
description: dummy description
register: appcred
- name: Assert return values of application_credential module
assert:
that:
- appcred is changed
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(appcred.application_credential.keys())|length == 0
- name: Create the application credential again
openstack.cloud.application_credential:
cloud: "{{ cloud }}"
state: present
name: ansible_creds
description: dummy description
register: appcred
- name: Assert return values of ansible_credential module
assert:
that:
# credentials are immutable so creating twice will cause delete and create
- appcred is changed
# allow new fields to be introduced but prevent fields from being removed
- expected_fields|difference(appcred.application_credential.keys())|length == 0
- name: Update the application credential again
openstack.cloud.application_credential:
cloud: "{{ cloud }}"
state: present
name: ansible_creds
description: new description
register: appcred
- name: Assert application credential changed
assert:
that:
- appcred is changed
- appcred.application_credential.description == 'new description'
- name: Get list of all keypairs using application credential
openstack.cloud.keypair_info:
cloud: "{{ appcred.cloud }}"
- name: Delete application credential
openstack.cloud.application_credential:
cloud: "{{ cloud }}"
state: absent
name: ansible_creds
register: appcred
- name: Assert application credential changed
assert:
that: appcred is changed

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,183 @@
---
- 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 }}'
flavor_id: 'm1.small'
master_flavor_id: 'm1.small'
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,87 @@
---
- 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
labels:
docker_volume_size: 10
cloud_provider_tag: v1.23.1
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
labels:
docker_volume_size: 10
cloud_provider_tag: v1.23.1
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

@@ -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

@@ -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|length > 0
# 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|length > 0
# 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|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: 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 +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 +1,65 @@
image_name: ansible_image
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,54 +1,376 @@
---
- 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
register: image
- name: Ensure clean environment
ansible.builtin.set_fact:
tmp_file: !!null
- debug: var=image
- name: Create a test image file
ansible.builtin.tempfile:
register: tmp_file
- name: Delete raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
- name: Fill test image file to 1MB
community.general.filesize:
path: '{{ tmp_file.path }}'
size: 1M
- 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: Calculating file checksum
ansible.builtin.stat:
path: "{{ tmp_file.path }}"
checksum_algorithm: sha512
get_checksum: true
register: image_details
- debug: var=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: 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: 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: Deactivate raw image
openstack.cloud.image:
cloud: "{{ cloud }}"
state: inactive
id: "{{ image.image.id }}"
name: 'ansible_image-changed'
register: image
- name: Assert changed
assert:
that:
- image is changed
- image.image.status == 'deactivated'
- name: Reactivate raw image
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.status == 'active'
- 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,430 @@
---
- 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: Further process Ansible 2.19+ cache
ansible.builtin.set_fact:
cache: "{{ cache.__payload__ | from_yaml }}"
when: cache.__payload__ is defined
- 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: List servers with inventory plugin with IPv4 only
ansible.builtin.command:
cmd: ansible-inventory --list --yaml --extra-vars only_ipv4=true --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,62 +1,162 @@
---
- 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
# 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 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 }}"
register: keypairs
- name: Ensure that list of keypairs contains single element
assert:
that:
- keypairs['keypairs']|length == 1
- name: Assert fields
assert:
that:
- 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|length > 0
- name: Create another keypair
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}-2"
state: present
- name: Delete keypair (non-existing)
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: absent
cloud: "{{ cloud }}"
name: "non-existing"
state: absent
- name: Delete keypair
openstack.cloud.keypair:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
state: absent
- name: Get list of keypairs
openstack.cloud.keypair_info:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
register: keypairs
- name: Ensure that list of keypairs is empty
assert:
that:
- keypairs['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:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
register: keypairs
- name: Ensure that list of keypairs contains single element
assert:
that:
- 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:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
register: keypairs
- name: Ensure that list of keypairs is empty
assert:
that:
- 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:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
register: keypairs
- name: Ensure that list of keypairs contains single element
assert:
that:
- 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:
cloud: "{{ cloud }}"
name: "{{ keypair_name }}"
register: keypairs
- name: Ensure that list of keypairs is empty
assert:
that:
- 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,12 +0,0 @@
---
- name: Create keystone role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: present
name: "{{ role_name }}"
- name: Delete keystone role
openstack.cloud.identity_role:
cloud: "{{ cloud }}"
state: absent
name: "{{ role_name }}"

View File

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

@@ -0,0 +1,286 @@
---
- 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 }}"
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 }}"
name: ansible_internal_network
state: present
- name: Create internal subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"
network_name: ansible_internal_network
name: ansible_internal_subnet
state: present
enable_dhcp: true
dns_nameservers:
- 8.8.8.7
- 8.8.8.8
cidr: 192.168.0.0/24
gateway_ip: 192.168.0.1
allocation_pool_start: 192.168.0.2
allocation_pool_end: 192.168.0.254
- name: Create 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: ansible_lb
vip_subnet: ansible_internal_subnet
timeout: 1200
register: load_balancer
- 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
timeout: 150
- name: Create load-balancer with floating ip address
openstack.cloud.loadbalancer:
assign_floating_ip: true
cloud: "{{ cloud }}"
# 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 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
- 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,3 +1,35 @@
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
network_external: false
port_security_enabled: false

View File

@@ -1,14 +1,170 @@
---
- name: Create network
- name: Create network - generic
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
state: present
shared: "{{ network_shared }}"
external: "{{ network_external }}"
external: false
register: infonet
- name: Delete network
openstack.cloud.network:
- name: Check output of creating network
assert:
that:
- infonet.network is defined
- 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:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
filters:
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.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:
cloud: "{{ cloud }}"
name: "{{ network_name_newparams }}"
state: present
shared: "{{ network_shared }}"
external: false
mtu: "{{ mtu }}"
port_security_enabled: "{{ port_security_enabled }}"
register: result_create_nw_with_new_params
ignore_errors: true
- name: Gather networks info - with new SDK params
openstack.cloud.networks_info:
cloud: "{{ cloud }}"
name: "{{ network_name_newparams }}"
register: result_newparams
- name: Verify networks info - with new SDK params
assert:
that:
- 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:
cloud: "{{ cloud }}"
name: "{{ item }}"
state: absent
with_items:
- "{{ network_name }}"
- "{{ network_name_newparams }}"
- name: Gather networks info - deleted
openstack.cloud.networks_info:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
register: result_nonet
- name: Verify networks info - deleted
assert:
that:
- result_nonet.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,10 @@
expected_fields:
- action
- id
- name
- object_id
- object_type
- project_id
- target_project_id
- tenant_id
all_project_symbol: '*'

View File

@@ -0,0 +1,123 @@
---
- 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: Create a new network RBAC policy by targeting all projects
openstack.cloud.neutron_rbac_policy:
cloud: "{{ cloud }}"
object_id: "{{ network.network.id }}"
object_type: 'network'
action: 'access_as_shared'
target_all_project: true
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
- rbac_policy.rbac_policy.target_project_id == all_project_symbol
- 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,76 @@
---
- 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 from data
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: Create object from file
block:
- name: Create temporary data file
ansible.builtin.tempfile:
register: tmp_file
- name: Populate data file
ansible.builtin.copy:
content: "this is a test"
dest: "{{ tmp_file.path }}"
- name: Create object from data file
openstack.cloud.object:
cloud: "{{ cloud }}"
state: present
name: ansible_object
filename: "{{ tmp_file.path }}"
container: ansible_container
register: object
always:
- name: Remove temporary data file
ansible.builtin.file:
path: "{{ tmp_file.path }}"
state: absent
when: tmp_file is defined and 'path' in tmp_file
- 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
- 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

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

@@ -0,0 +1,108 @@
---
- name: Create an empty container with public access
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: ansible_container
read_ACL: ".r:*,.rlistings"
register: container
- 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 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:
- container is changed
- ('cache-control' in container.container.metadata.keys()|map('lower'))
- container.container.metadata['foo'] == 'bar'
- name: Update container metadata
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: ansible_container
metadata:
'foo': 'baz'
register: container
- name: Verify container metadata was updated
assert:
that:
- container is changed
- ('cache-control' in container.container.metadata.keys()|map('lower'))
- container.container.metadata['foo'] == 'baz'
- name: Update a container
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: ansible_container
delete_metadata_keys:
- 'Cache-Control'
read_ACL: ""
register: container
- name: Verify updated container
assert:
that:
- container is changed
- ('cache-control' not in container.container.metadata.keys()|map('lower'))
- "container.container.metadata == {'foo': 'baz'}"
- container.container.read_ACL is none or container.container.read_ACL == ""
- name: Delete container
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: ansible_container
state: absent
register: container
- name: Verify container was deleted
assert:
that:
- container is changed
- 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

@@ -0,0 +1,37 @@
---
test_container_unprefixed_name: ansible-test-container
test_container_prefixed_prefix: ansible-prefixed-test-container
test_container_prefixed_num: 2
test_object_data: "Hello, world!"
expected_fields_single:
- 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
- name
- object_count
- read_ACL
- storage_policy
- sync_key
- sync_to
- timestamp
- versions_location
- write_ACL
expected_fields_multiple:
- bytes
- bytes_used
- count
- id
- name
- object_count

View File

@@ -0,0 +1,124 @@
---
- name: Generate list of containers to create
ansible.builtin.set_fact:
all_test_containers: >-
{{
[test_container_unprefixed_name]
+ (
[test_container_prefixed_prefix + '-']
| product(range(test_container_prefixed_num) | map('string'))
| map('join', '')
)
}}
- name: Run checks
block:
- name: Create all containers
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: "{{ item }}"
read_ACL: ".r:*,.rlistings"
loop: "{{ all_test_containers }}"
- name: Create an object in all containers
openstack.cloud.object:
cloud: "{{ cloud }}"
container: "{{ item }}"
name: hello.txt
data: "{{ test_object_data }}"
loop: "{{ all_test_containers }}"
- name: Fetch single containers by name
openstack.cloud.object_containers_info:
cloud: "{{ cloud }}"
name: "{{ item }}"
register: single_containers
loop: "{{ all_test_containers }}"
- name: Check that all fields are returned for single containers
ansible.builtin.assert:
that:
- (item.containers | length) == 1
- item.containers[0].name == item.item
- item.containers[0].bytes == (test_object_data | length)
- item.containers[0].read_ACL == ".r:*,.rlistings"
# allow new fields to be introduced but prevent fields from being removed
- (expected_fields_single | difference(item.containers[0].keys()) | length) == 0
quiet: true
loop: "{{ single_containers.results }}"
loop_control:
label: "{{ item.item }}"
- name: Fetch multiple containers by prefix
openstack.cloud.object_containers_info:
cloud: "{{ cloud }}"
prefix: "{{ test_container_prefixed_prefix }}"
register: multiple_containers
- name: Check that the correct number of prefixed containers were returned
ansible.builtin.assert:
that:
- (multiple_containers.containers | length) == test_container_prefixed_num
fail_msg: >-
Incorrect number of containers found
(found {{ multiple_containers.containers | length }},
expected {{ test_container_prefixed_num }})
quiet: true
- name: Check that all prefixed containers exist
ansible.builtin.assert:
that:
- >-
(test_container_prefixed_prefix + '-' + (item | string))
in (multiple_containers.containers | map(attribute='name'))
fail_msg: "Container not found: {{ test_container_prefixed_prefix + '-' + (item | string) }}"
quiet: true
loop: "{{ range(test_container_prefixed_num) | list }}"
loop_control:
label: "{{ test_container_prefixed_prefix + '-' + (item | string) }}"
- name: Check that the expected fields are returned for all prefixed containers
ansible.builtin.assert:
that:
- item.name.startswith(test_container_prefixed_prefix)
# allow new fields to be introduced but prevent fields from being removed
- (expected_fields_multiple | difference(item.keys()) | length) == 0
quiet: true
loop: "{{ multiple_containers.containers | sort(attribute='name') }}"
loop_control:
label: "{{ item.name }}"
- name: Fetch all containers
openstack.cloud.object_containers_info:
cloud: "{{ cloud }}"
register: all_containers
- name: Check that all expected containers were returned
ansible.builtin.assert:
that:
- item in (all_containers.containers | map(attribute='name'))
fail_msg: "Container not found: {{ item }}"
quiet: true
loop: "{{ all_test_containers }}"
- name: Check that the expected fields are returned for all containers
ansible.builtin.assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- (expected_fields_multiple | difference(item.keys()) | length) == 0
quiet: true
loop: "{{ all_containers.containers | selectattr('name', 'in', all_test_containers) }}"
loop_control:
label: "{{ item.name }}"
always:
- name: Delete all containers
openstack.cloud.object_container:
cloud: "{{ cloud }}"
name: "{{ item }}"
state: absent
delete_with_all_objects: true
loop: "{{ all_test_containers }}"

View File

@@ -1,6 +1,42 @@
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
network_external: true
subnet_name: ansible_port_subnet
port_name: ansible_port
secgroup_name: ansible_port_secgroup
no_security_groups: True
port_name: ansible_port
subnet_name: ansible_port_subnet

View File

@@ -1,101 +1,269 @@
---
- 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: 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,36 @@
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
test_load_balancer_quota:
load_balancers: 5
health_monitors: 5
listeners: 5
pools: 5
members: 5

View File

@@ -0,0 +1,158 @@
---
- 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: Set load_balancer quotas
openstack.cloud.quota: "{{ test_load_balancer_quota }}"
register: quotas
- name: Assert changed
assert:
that: quotas is changed
- name: Assert field values
assert:
that: quotas.quotas.load_balancer[item.key] == item.value
loop: "{{ test_load_balancer_quota | dict2items }}"
- name: Set load_balancer quotas again
openstack.cloud.quota: "{{ test_load_balancer_quota }}"
register: quotas
- name: Assert not changed
assert:
that: quotas is not changed
- 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, test_load_balancer_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: Assert load_balancer values
assert:
that: quotas.quotas.load_balancer[item.key] == item.value
loop: "{{ test_load_balancer_quota | dict2items }}"
- name: Set all quotas at once again
openstack.cloud.quota:
"{{ [test_network_quota, test_volume_quota, test_compute_quota, test_load_balancer_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,136 @@
---
- 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
- import_tasks: loadbalancer.yml
tags:
- loadbalancer

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