Skip to content
Snippets Groups Projects
  1. Oct 26, 2022
    • Kristian Kucerak's avatar
      Change subnets_info module to work with new SDK · 97fa59bf
      Kristian Kucerak authored
      Change-Id: Ie23604c34ed9fb17eeb15bf73db9019ca9ebc7d8
      97fa59bf
    • Rafael Castillo's avatar
      Updates volume for 2.0.0 · c13fac37
      Rafael Castillo authored
      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
      c13fac37
  2. Oct 25, 2022
    • Jakob Meng's avatar
      Refactored baremetal_port and baremetal_port_info modules · 99074ccd
      Jakob Meng authored
      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
      99074ccd
    • Jakob Meng's avatar
      Refactored baremetal_node_action module · 65a7e74b
      Jakob Meng authored
      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
      65a7e74b
    • Jakob Meng's avatar
      Refactored baremetal_node and baremetal_node_info modules · 902b2f81
      Jakob Meng authored
      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
      902b2f81
  3. Oct 18, 2022
    • Artem Goncharov's avatar
      Do not enforce optional params in network module · f51898bd
      Artem Goncharov authored
      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
      f51898bd
  4. Oct 14, 2022
  5. Oct 10, 2022
  6. Oct 07, 2022
  7. Oct 06, 2022
  8. Sep 30, 2022
  9. Sep 27, 2022
  10. Sep 23, 2022
  11. Sep 22, 2022
  12. Sep 21, 2022
  13. Sep 20, 2022
    • Will Szumski's avatar
      Allow networks to be updated · 2d0656f0
      Will Szumski authored
      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
      2d0656f0
  14. Sep 09, 2022
  15. Sep 07, 2022
  16. Aug 28, 2022
  17. Aug 22, 2022
  18. Aug 16, 2022
  19. Aug 11, 2022
    • Rafael Castillo's avatar
      Update compute flavor module for 2.0.0 · 4df7a12e
      Rafael Castillo authored
      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
      4df7a12e
    • Jakob Meng's avatar
      Dropped extra interfaces_info attribute from routers_info module · 0ec16fbe
      Jakob Meng authored
      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] https://opendev.org/openstack/openstacksdk/src/commit/3f81d0001dd994cde990d38f6e2671ee0694d7d5/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
      0ec16fbe
  20. Aug 10, 2022
    • Rafael Castillo's avatar
      Update identity_group for 2.0.0 · 5e7c29d9
      Rafael Castillo authored
      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
      5e7c29d9
  21. Aug 08, 2022
    • Jakob Meng's avatar
      Refactored port and port_info modules · d0eb83e9
      Jakob Meng authored
      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] https://github.com/ansible/ansible/blob/61af59c8082cff068424d1012271daa0aac97288/lib/ansible/module_utils/common/parameters.py#L489
      
      
      
      Signed-off-by: default avatarJakob Meng <code@jakobmeng.de>
      Change-Id: Iacca78649f8e01ae95649d8d462f5d0a1740405e
      d0eb83e9
    • Arx Cruz's avatar
      Update federation_idp_info module to use proxy layer · ce6193cd
      Arx Cruz authored
      This patch update federation_idp_info to use proxy layer as well as add
      the ansible role to test the module
      
      Change-Id: I6b4544cca317f2d5fab4a9612b820872b87585f4
      ce6193cd
  22. Aug 03, 2022
    • Jakob Meng's avatar
      Refactored router module · fdc67892
      Jakob Meng authored
      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
      fdc67892
  23. Aug 02, 2022
    • Rafael Castillo's avatar
      Update baremetal_inspect to be compatible with new sdk · d2eb98d0
      Rafael Castillo authored
      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
      d2eb98d0
Loading