Ironic do not support tinyipa anymore, all jobs run with DIB
based ipa ramdisks, so we updated their config and names.
Change-Id: Id7b260a0965d941d3a34eb181a068a9a5e7189ef
Signed-off-by: Riccardo Pittau <elfosardo@gmail.com>
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>
Adds a module to manage Neutron network segments where the
segmentation plugin is enabled.
Segments are relatively simple and do not support modification
beyond the name/description, so most attributes are used for
initial segment creation, or filtering results in order to
perform updates.
Depends-On: https://review.opendev.org/c/openstack/ansible-collections-openstack/+/955752
Change-Id: I4647fd96aaa15460d82765365f98a18ddf2693db
This adds a Ansible module for managing a
Neutron trunk and the sub ports associated
with the trunk.
Change-Id: I0e1c6798b6cc30062c881d1f92fdd4d630d31106
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
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
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
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
- 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
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
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
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
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
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
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
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
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
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
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
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
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
Make project_info module compatible with the new sdk 1.0.0 and also add
ansible tests for project_info module
Change-Id: I413200cf6a9b8bada7e5d78087246b888d53fac2