Commit Graph

19 Commits

Author SHA1 Message Date
Jakob Meng
e4be201f20 Properly documented openstacksdk version requirements
With "extends_documentation_fragment: ['openstack.cloud.openstack']"
it is not necessary to list required Python libraries in section
'requirements' of DOCUMENTATION docstring in modules. Ansible will
merge requirements from doc fragments and DOCUMENTATION docstring
which previously resulted in duplicates such as in server module [0]:

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

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

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

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

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

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

Change-Id: Ia53c2c34436c7a72080602f5699e82d20f677b8b
2023-01-16 13:52:45 +01:00
Jakob Meng
e8bba38e2e Ensure openstacksdk compatibility in inventory plugin
Story: 2010337
Task: 46470
Change-Id: Ieb624b76627b5127d7a6c4d95233bbd5c2f16182
2022-09-29 20:47:04 +02:00
Jakob Meng
058bd87f2a Lowered maximum OpenStack SDK version to 0.98.999 in inventory plugin
Story: 2010337
Task: 46470
Change-Id: I873b41b85fee3035e35972e7d90048b6ac3722b2
2022-09-29 19:11:33 +02:00
Sagi Shnaidman
f70a50e363 Fix ansible-lint issues for newest version
Change-Id: I8238b5d5e49c2a4a8ed3228de23349092c9e1220
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2022-03-29 18:51:01 +00:00
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
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
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
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
willtome
3c8fbc6b27 add option to exclude legacy groups
Change-Id: I73835b111b1bdfc0d8dd6409d516ad1cb84c658a
2021-02-18 12:03:09 +00:00
Marc-Antoine Bourgeot
40ce8103f4 Add openstack logger and Ansible display utility
Story: 2007879

Change-Id: I76fc7df8202b4e00b54b5bafe7719e02b49e59ff
2020-07-07 22:21:47 +02:00
Monty Taylor
a96d28dfbc Update author lines
We don't use github, so having @ mentions of specific humans is
not valuable. Also, we are a team and own the modules as a team,
so calling out individual authors is philosophically contrary.

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

Change-Id: I38b4e68f14bbba6e13e8a50e2b202874ab74e3bc
2020-06-23 21:50:43 +03:00
Zuul
11331d7f1f Merge "Remove from __future__ lines" 2020-03-04 22:26:59 +00:00
Zuul
fba0eda1d8 Merge "Fix H236 and remove exclusion" 2020-03-04 22:22:02 +00:00
Zuul
4b6c60ff14 Merge "Fix W504 and remove exclusion" 2020-03-02 13:31:35 +00:00
Monty Taylor
96a5914eb6 Remove from __future__ lines
We only support python3

Change-Id: Ieb82eb3369c4ac73f3595dc84ca11e1f11766a79
2020-03-01 06:26:03 -06:00
Monty Taylor
9d29e8c847 Fix H236 and remove exclusion
We haven't needed this in a VERY long time.

Change-Id: I35041c2c6ae421e7caaef3c04ffca92e2ff10e35
2020-03-01 06:22:58 -06:00
Monty Taylor
92d7d7caeb Fix W504 and remove exclusion
This is a topic where there are two points of view. While neither
is fundamentally better than the other in reality, what's best is
to not have any arguments about it. The tox.ini comments about 503
and 504 that were in place make the argument that:

  - 503 is intended to be disabled and 504 enabled by default
  - Donald Knuth believes 504 is the right way

Since Donald Knuth is smarter than all of us, align with 504, match
the comments in the file and turn on enforcement to keep it that way.

Change-Id: I92d4d1e82935e30ae42a0e14e641cbe36fd6e811
2020-02-27 13:56:48 -06:00
willtome
7d46ce9c51 fix constructed compose
Fixes ansible/ansible#59680 and ansible/ansible#48309. add support for strict parameter for constructed.

Change-Id: I08cba2d9ee372071f3899c7c9b74d9351dfdb5d4
Signed-off-by: willtome <willtome@gmail.com>
2020-01-28 09:46:13 -06:00
Sagi Shnaidman
6ac08e7f0e Migrate openstack modules as a collection
Migrate accordin to Ansible guidelines [1[]] and tool
migrate.py [2]
Also fixed ALL ansible-test sanity issues

Add pep8 and linter job with runs ansible-test sanity test.

[1] https://etherpad.openstack.org/p/openstack-ansible-modules
[2] https://github.com/ansible-community/collection_migration

Change-Id: Ib2b1c8f23aacfca95304132bfe5c4cdedbea0520
2020-01-17 14:07:24 +00:00