33 Commits

Author SHA1 Message Date
Sagi Shnaidman
5bb8312171 Release 1.8.0 version
Change-Id: Id5dbee79e2df9a0bd0185d649cbcbf5c0e288178
2022-04-08 12:30:59 +03:00
Jakob Meng
b3ac841442 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:46 +00:00
Arx Cruz
37c52c321d Changed compute_flavor_info module to use OpenStack SDK's proxy layer
We still return computed values here to keep backward compatibility.

Change-Id: Idad13228efe55b2dd35224cc37c61657590f9b8e
2022-04-05 13:46:15 +02:00
Arx Cruz
6edc70f965 Updated return value docs of compute_service_info module
We still return computed values here to keep backward compatibility.

Change-Id: I11af9486a6a284d1756380548fca22435c43765a
2022-04-04 11:33:06 +02:00
Jakob Meng
cc8cd08c03 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 10:28:25 +02:00
Ümit Seren
b572bf8ae9 Add subnet pool module
Change-Id: Ib8b5481a1e257490f2a9ff62659a70ea2e920304
2022-03-31 20:05:11 +00:00
Gaudenz Steinlin
b3e0d610ea 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 12:18:09 +00:00
Jakob Meng
291e8b8640 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:19:50 +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
Jakob Meng
befcc4353d 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 15:20:17 +02:00
Jakob Meng
8a91352a38 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 09:29:51 +02:00
Jakob Meng
1d7fd25ac0 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 13:44:36 +02:00
Jakob Meng
44fa06cba1 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 10:50:22 +02:00
Jakob Meng
26bc8a0666 Synchronized galaxy.yml and galaxy.yml.in files
Change-Id: Ic93a0d1f93e2d86358085c7442ad73d52b9a55ba
2022-03-25 16:01:40 +01:00
Jakob Meng
19d0562551 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 14:33:27 +00:00
Jakob Meng
07c3ed0c17 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
(cherry picked from commit 5b53433348)
2022-03-24 12:57:29 +00:00
Jakob Meng
8708167b5f 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
2022-03-24 11:10:16 +01:00
Kevin Carter
a9565779b5 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 10:43:02 +01:00
Jakob Meng
5c2069c47d Run tripleo*{train,wallaby}-osa jobs on stable/1.0.0 branch only
Our master branch is compatible to OpenStack SDK 1.* releases only,
while our stable/1.0.0 branch works with OpenStack SDK 0.* releases
only. Users of train or wallaby branches of TripleO will use packages
which are provided by RDO and we will pin them to our stable/1.0.0
anyway. Using OpenStack SDK 1.* from PyPI with TripleO train/wallaby
is not supported.

Change-Id: Ia6bcd3809e2a63ec9c11db4eeeca837839c9c0a9
2022-03-22 14:08:19 +01:00
Jakob Meng
583df2a8a9 Dropped inherited variable tox_install_siblings
Change-Id: I9f67c404d1b0ae23daf527b373f196ab17efc9a3
2022-03-22 12:11:33 +01:00
Jakob Meng
0f532d10f3 Run *-releases job on master branch only
Latest releases of OpenStack SDK will soon be 1.* versioned which
our stable/1.0.0 branch is incompatible with. We will have to add
a siblings job for *-releases later which pulls the latest release
of the 0.* series of the OpenStack SDK and runs on commits for our
stable/1.0.0 branch.

Change-Id: I77f6730e8c9e5840be460795a17c9d48aeecccd0
2022-03-22 11:40:56 +01:00
Jakob Meng
87858ab976 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-22 11:25:51 +01:00
Jakob Meng
09c3e4bdc9 Run *-octavia job on master branch only
Latest releases of OpenStack SDK will soon be 1.* versioned which
our stable/1.0.0 branch is incompatible with. We will have to add
a siblings job for octavia later which pulls the latest release
of the 0.* series of the OpenStack SDK and runs on commits for our
stable/1.0.0 branch.

Change-Id: I8cfc7cf609d10ff96a03ae7f1f407ee0ec2da20c
2022-03-22 10:54:33 +01:00
Jakob Meng
ebffbe4fe8 Disable jobs against master branch of OpenStack SDK on stable/1.0.0 branch
Run Zuul jobs which test against the master branch of OpenStack SDK
only for commits on our master branch because branch stable/1.0.0 is
compatible only to OpenStack SDK 0.* releases.

Change-Id: I35849df166f3f36f4e3e2870ccd8d5fe9e33e50f
2022-03-22 09:11:40 +01:00
anbanerj
cbcfce2e23 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:44 +00:00
Will Szumski
406558dae9 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-18 07:59:56 +00:00
Zuul
c8d89f81a5 Merge "Fix assertion after stack deletion" into stable/1.0.0 2022-03-14 13:40:30 +00:00
Jakob Meng
c0e1f56894 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:03:17 +00:00
Jan Weiher
a031968f80 Router: Remove unneeded 'filter' parameter
Change-Id: If46916e3480fced3be919c6d39b82a6c64321065
2022-03-14 08:31:31 +00:00
Jakob Meng
2e78559cc1 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:17:08 +00:00
Jakob Meng
bf939a4ce0 Release 1.7.2 version
Primary reason for this new release is to fix the mess we did yesterday
when we accidentially merged release 1.7.1 and all changes from the
stable branch into the master branch. This release 1.7.2 does not really
change anything except fixing the guidelines.

Change-Id: I1ad23bd36746a180f8851df294df4e01213bdf2f
2022-03-10 11:43:44 +01:00
Jakob Meng
24d6f36602 Release 1.7.1 version
Change-Id: I958ba6890a54c59e0ccdb9249d959c745acfb8e9
(cherry picked from commit b640e6207c)
2022-03-10 08:47:36 +00:00
Sagi Shnaidman
dd9cdde3d8 Fix docs for openstack fragment
Change-Id: I7fef01dbd11137e26d3ff0bd0088dc405559b272
2022-03-09 20:33:32 +00:00
43 changed files with 1125 additions and 196 deletions

View File

@@ -1,16 +1,25 @@
# yamllint disable
---
# 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.
- job:
name: ansible-collections-openstack-functional-devstack
name: ansible-collections-openstack-functional-devstack-base
parent: openstacksdk-functional-devstack
branches: ^(stable/1.0.0|master).*$
# Do not restrict branches in base jobs because else Zuul would not find a matching
# parent job variant during job freeze when child jobs are on other branches.
post-run: ci/playbooks/postlog.yaml
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk with latest ansible release
Run openstack collections functional tests against a devstack
# Do not set job.override-checkout or job.required-projects.override-checkout in base job because
# else Zuul will use this branch when matching variants for parent jobs during job freeze
required-projects:
- openstack/ansible-collections-openstack
- openstack/designate
# openstack/devstack is required through parent job openstacksdk-functional-devstack
# openstack/os-client-config is required through parent job openstacksdk-functional-devstack
# openstack/openstacksdk is required through parent job openstacksdk-functional-devstack
irrelevant-files: &ignore_files
- changelogs/.*
- galaxy.*
@@ -25,7 +34,7 @@
vars:
zuul_work_dir: src/opendev.org/openstack/ansible-collections-openstack
tox_envlist: ansible
tox_install_siblings: false
tox_install_siblings: true
fetch_subunit: false
devstack_plugins:
designate: https://opendev.org/openstack/designate
@@ -38,19 +47,25 @@
log: true
- job:
name: ansible-collections-openstack-functional-devstack-octavia
parent: ansible-collections-openstack-functional-devstack
branches: ^(stable/1.0.0|master).*$
override-checkout: master
name: ansible-collections-openstack-functional-devstack
parent: ansible-collections-openstack-functional-devstack-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
with Octavia plugin enabled, using releases of openstacksdk and latest
ansible release. Run it only on Load Balancer changes.
using master of openstacksdk with latest ansible release
- 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
pre-run: ci/playbooks/get_amphora_tarball.yaml
# Do not set job.override-checkout or job.required-projects.override-checkout in base job because
# else Zuul will use this branch when matching variants for parent jobs during job freeze
required-projects:
- openstack/octavia
- name: github.com/ansible/ansible
override-checkout: stable-2.12
files:
- ^ci/roles/loadbalancer/.*$
- ^plugins/modules/lb_health_monitor.py
@@ -60,7 +75,7 @@
- ^plugins/modules/loadbalancer.py
vars:
configure_swap_size: 8192
tox_envlist: ansible
tox_install_siblings: false
devstack_plugins:
designate: https://opendev.org/openstack/designate
octavia: https://opendev.org/openstack/octavia
@@ -78,60 +93,170 @@
OCTAVIA_AMP_IMAGE_NAME: "test-only-amphora-x64-haproxy-ubuntu-bionic"
- job:
name: ansible-collections-openstack-functional-devstack-releases
parent: ansible-collections-openstack-functional-devstack
override-checkout: master
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 releases of openstacksdk and latest ansible release
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-octavia
parent: ansible-collections-openstack-functional-devstack-octavia-base
branches: stable/1.0.0
description: |
Run openstack collections functional tests against a master devstack
with Octavia plugin enabled, using 0.*.* releases of openstacksdk
and latest ansible release. Run it only on Load Balancer changes.
required-projects:
- # Choose parent devstack job from master branch instead of non-existing stable/1.0.0 branch
name: openstack/devstack
override-checkout: master
- # Choose parent devstack job from master branch instead of non-existing stable/1.0.0 branch
name: openstack/openstacksdk
override-checkout: master
vars:
tox_envlist: ansible
tox_constraints_file: '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/constraints-openstacksdk-0.x.x.txt'
- job:
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 latest releases of openstacksdk and latest ansible release
# OpenStack SDK 1.*.* has not been released to PyPI yet
voting: false
vars:
# Uncomment once OpenStack SDK 1.*.* has been released to PyPI
# 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-releases
parent: ansible-collections-openstack-functional-devstack-base
branches: stable/1.0.0
description: |
Run openstack collections functional tests against a master devstack
using 0.*.* releases of openstacksdk and latest ansible release
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- # Choose parent devstack job from master branch instead of non-existing stable/1.0.0 branch
name: openstack/devstack
override-checkout: master
- # Choose parent devstack job from master branch instead of non-existing stable/1.0.0 branch
name: openstack/openstacksdk
override-checkout: master
vars:
tox_constraints_file: '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/constraints-openstacksdk-0.x.x.txt'
tox_install_siblings: false
# Job with Ansible 2.9 for checking backward compatibility
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.9
parent: ansible-collections-openstack-functional-devstack
override-checkout: master
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
voting: false
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
vars:
tox_envlist: ansible-2.9
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.9
parent: ansible-collections-openstack-functional-devstack-base
branches: stable/1.0.0
description: |
Run openstack collections functional tests against a master devstack
using 0.*.* releases of openstacksdk and stable 2.9 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- # Choose parent devstack job from master branch instead of non-existing stable/1.0.0 branch
name: openstack/devstack
override-checkout: master
- name: openstack/openstacksdk
# Yoga has the latest SDK release of the 0.*.* series atm
override-checkout: stable/yoga
vars:
tox_envlist: ansible-2.9
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.11
parent: ansible-collections-openstack-functional-devstack
override-checkout: master
parent: ansible-collections-openstack-functional-devstack-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk and stable 2.12 branch of ansible
voting: false
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
vars:
tox_envlist: ansible
tox_envlist: ansible-2.11
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.11
parent: ansible-collections-openstack-functional-devstack-base
branches: stable/1.0.0
description: |
Run openstack collections functional tests against a master devstack
using 0.*.* releases of openstacksdk and stable 2.12 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- # Choose parent devstack job from master branch instead of non-existing stable/1.0.0 branch
name: openstack/devstack
override-checkout: master
- name: openstack/openstacksdk
# Yoga has the latest SDK release of the 0.*.* series atm
override-checkout: stable/yoga
vars:
tox_envlist: ansible-2.11
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.12
parent: ansible-collections-openstack-functional-devstack
override-checkout: master
parent: ansible-collections-openstack-functional-devstack-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk and stable 2.12 branch of ansible
voting: false
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.12
vars:
tox_envlist: ansible
tox_envlist: ansible-2.12
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.12
parent: ansible-collections-openstack-functional-devstack-base
branches: stable/1.0.0
description: |
Run openstack collections functional tests against a master devstack
using 0.*.* releases of openstacksdk and stable 2.12 branch of ansible
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.12
- # Choose parent devstack job from master branch instead of non-existing stable/1.0.0 branch
name: openstack/devstack
override-checkout: master
- name: openstack/openstacksdk
# Yoga has the latest SDK release of the 0.*.* series atm
override-checkout: stable/yoga
vars:
tox_envlist: ansible-2.12
- job:
name: ansible-collections-openstack-functional-devstack-ansible-devel
parent: ansible-collections-openstack-functional-devstack
override-checkout: master
parent: ansible-collections-openstack-functional-devstack-base
branches: master
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk and devel branch of ansible
@@ -139,143 +264,222 @@
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
vars:
tox_envlist: ansible-2.12
# Stable branches tests
- job:
name: ansible-collections-openstack-functional-devstack-xena-ansible-2.12
parent: ansible-collections-openstack-functional-devstack-ansible-devel
# Do not inherit from any parent job which does not run for branch stable/1.0.0 because Zuul would dismiss this job
# when collecting parent job variants. For example, when job.branches is set to master in a parent job, then Zuul
# will not match that job when it collects job variants.
#
# Do not 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.
parent: ansible-collections-openstack-functional-devstack-base
description: |
Run openstack collections functional tests against a xena devstack
using xena brach of openstacksdk and stable 2.12 branch of ansible
voting: true
using xena branch of openstacksdk and stable 2.12 branch of ansible
branches: stable/1.0.0
override-checkout: stable/xena
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.12
- # Choose parent devstack job from stable/1.0.0 branch instead of non-existing stable/xena branch
name: openstack/ansible-collections-openstack
override-checkout: stable/1.0.0
- # Choose parent devstack job from stable/xena branch
name: openstack/devstack
override-checkout: stable/xena
- name: openstack/openstacksdk
override-checkout: stable/xena
vars:
tox_envlist: ansible
tox_install_siblings: true
tox_envlist: ansible-2.12
- job:
name: ansible-collections-openstack-functional-devstack-wallaby-ansible-2.12
parent: ansible-collections-openstack-functional-devstack-ansible-devel
# Do not inherit from any parent job which does not run for branch stable/1.0.0 because Zuul would dismiss this job
# when collecting parent job variants. For example, when job.branches is set to master in a parent job, then Zuul
# will not match that job when it collects job variants.
#
# Do not 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.
parent: ansible-collections-openstack-functional-devstack-base
description: |
Run openstack collections functional tests against a wallaby devstack
using wallaby brach of openstacksdk and stable 2.12 branch of ansible
voting: true
using wallaby branch of openstacksdk and stable 2.12 branch of ansible
branches: stable/1.0.0
override-checkout: stable/wallaby
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.12
- # Choose parent devstack job from stable/1.0.0 branch instead of non-existing stable/wallaby branch
name: openstack/ansible-collections-openstack
override-checkout: stable/1.0.0
- # Choose parent devstack job from stable/wallaby branch
name: openstack/devstack
override-checkout: stable/wallaby
- name: openstack/openstacksdk
override-checkout: stable/wallaby
vars:
tox_envlist: ansible
tox_install_siblings: true
tox_envlist: ansible-2.12
- job:
name: ansible-collections-openstack-functional-devstack-victoria-ansible-2.12
parent: ansible-collections-openstack-functional-devstack-ansible-devel
# Do not inherit from any parent job which does not run for branch stable/1.0.0 because Zuul would dismiss this job
# when collecting parent job variants. For example, when job.branches is set to master in a parent job, then Zuul
# will not match that job when it collects job variants.
#
# Do not 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.
parent: ansible-collections-openstack-functional-devstack-base
description: |
Run openstack collections functional tests against a victoria devstack
using victoria brach of openstacksdk and stable 2.12 branch of ansible
voting: true
using victoria branch of openstacksdk and stable 2.12 branch of ansible
branches: stable/1.0.0
override-checkout: stable/victoria
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.12
- # Choose parent devstack job from stable/1.0.0 branch instead of non-existing stable/victoria branch
name: openstack/ansible-collections-openstack
override-checkout: stable/1.0.0
- # Choose parent devstack job from stable/victoria branch
name: openstack/devstack
override-checkout: stable/victoria
- name: openstack/openstacksdk
override-checkout: stable/victoria
vars:
tox_envlist: ansible
tox_install_siblings: true
tox_envlist: ansible-2.12
- job:
name: ansible-collections-openstack-functional-devstack-ussuri-ansible-2.11
parent: ansible-collections-openstack-functional-devstack-ansible-devel
# Do not inherit from any parent job which does not run for branch stable/1.0.0 because Zuul would dismiss this job
# when collecting parent job variants. For example, when job.branches is set to master in a parent job, then Zuul
# will not match that job when it collects job variants.
#
# Do not 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.
parent: ansible-collections-openstack-functional-devstack-base
description: |
Run openstack collections functional tests against a ussuri devstack
using ussuri brach of openstacksdk and stable 2.11 branch of ansible
voting: true
using ussuri branch of openstacksdk and stable 2.11 branch of ansible
branches: stable/1.0.0
override-checkout: stable/ussuri
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- # Choose parent devstack job from stable/1.0.0 branch instead of non-existing stable/ussuri branch
name: openstack/ansible-collections-openstack
override-checkout: stable/1.0.0
- # Choose parent devstack job from stable/ussuri branch
name: openstack/devstack
override-checkout: stable/ussuri
- name: openstack/openstacksdk
override-checkout: stable/ussuri
- name: openstack/os-client-config
override-checkout: stable/ussuri
vars:
tox_envlist: ansible
tox_install_siblings: true
tox_envlist: ansible-2.11
- job:
name: ansible-collections-openstack-functional-devstack-train-ansible-2.11
parent: ansible-collections-openstack-functional-devstack-ansible-devel
# Do not inherit from any parent job which does not run for branch stable/1.0.0 because Zuul would dismiss this job
# when collecting parent job variants. For example, when job.branches is set to master in a parent job, then Zuul
# will not match that job when it collects job variants.
#
# Do not 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.
parent: ansible-collections-openstack-functional-devstack-base
description: |
Run openstack collections functional tests against a train devstack
using train brach of openstacksdk and stable 2.11 branch of ansible
voting: true
using train branch of openstacksdk and stable 2.11 branch of ansible
branches: stable/1.0.0
override-checkout: stable/train
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- # Choose parent devstack job from stable/1.0.0 branch instead of non-existing stable/train branch
name: openstack/ansible-collections-openstack
override-checkout: stable/1.0.0
- # Choose parent devstack job from stable/train branch
name: openstack/devstack
override-checkout: stable/train
- name: openstack/openstacksdk
override-checkout: stable/train
- name: openstack/os-client-config
override-checkout: stable/train
vars:
tox_envlist: ansible
tox_install_siblings: true
tox_envlist: ansible-2.11
- job:
name: ansible-collections-openstack-functional-devstack-queens-ansible-2.11
parent: ansible-collections-openstack-functional-devstack-ansible-devel
# Do not inherit from any parent job which does not run for branch stable/1.0.0 because Zuul would dismiss this job
# when collecting parent job variants. For example, when job.branches is set to master in a parent job, then Zuul
# will not match that job when it collects job variants.
#
# Do not 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.
parent: ansible-collections-openstack-functional-devstack-base
description: |
Run openstack collections functional tests against a queens devstack
using master branch of openstacksdk and stable 2.11 branch of ansible
voting: true
using train branch of openstacksdk and stable 2.11 branch of ansible
branches: stable/1.0.0
override-checkout: stable/queens
# job.override-checkout will not override job.required-projects.override-checkout in parent jobs
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.11
- # Choose parent devstack job from stable/1.0.0 branch instead of non-existing stable/queens branch
name: openstack/ansible-collections-openstack
override-checkout: stable/1.0.0
- # Choose parent devstack job from stable/queens branch
name: openstack/devstack
override-checkout: stable/queens
- name: openstack/openstacksdk
# Run queens with highest possible py2 version of SDK
override-checkout: stable/train
vars:
tox_envlist: ansible
tox_install_siblings: true
tox_envlist: ansible-2.11
# Linters
- job:
name: openstack-tox-linters-ansible-devel
name: openstack-tox-linters-ansible
parent: openstack-tox-linters
nodeset: ubuntu-focal
description: |
Run openstack collections linter tests using the devel branch of ansible
# non-voting because we can't prevent ansible devel from breaking us
voting: false
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
vars:
tox_envlist: linters-2.12
# override tox_constraints_file from parent job
tox_constraints_file: '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/constraints-none.txt'
tox_envlist: linters
tox_install_siblings: true
- job:
name: openstack-tox-linters-ansible-devel
parent: openstack-tox-linters-ansible
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
vars:
python_version: 3.8
bindep_profile: test py38
- job:
name: openstack-tox-linters-ansible-2.12
parent: openstack-tox-linters
nodeset: ubuntu-focal
parent: openstack-tox-linters-ansible
description: |
Run openstack collections linter tests using the 2.12 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.12
@@ -286,11 +490,10 @@
- job:
name: openstack-tox-linters-ansible-2.9
parent: openstack-tox-linters
parent: openstack-tox-linters-ansible
nodeset: ubuntu-bionic
description: |
Run openstack collections linter tests using the 2.9 branch of ansible
voting: true
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
@@ -303,12 +506,17 @@
parent: bifrost-integration-tinyipa-ubuntu-focal
required-projects:
- openstack/ansible-collections-openstack
- # always use master branch when collecting parent job variants, refer to git blame for rationale.
name: openstack/bifrost
override-checkout: master
- job:
name: bifrost-keystone-collections-src
parent: bifrost-integration-tinyipa-keystone-ubuntu-focal
required-projects:
- openstack/ansible-collections-openstack
- # always use master branch when collecting parent job variants, refer to git blame for rationale.
name: openstack/bifrost
override-checkout: master
# TripleO jobs
- job:
@@ -318,6 +526,11 @@
featureset: '052'
consumer_job: false
build_container_images: true
required-projects:
- openstack/ansible-collections-openstack
- # always use master branch when collecting parent job variants, refer to git blame for rationale.
name: openstack/tripleo-ci
override-checkout: master
irrelevant-files: &irr_files
- .*molecule.*
- ^.*\.md$
@@ -329,7 +542,6 @@
- ^tests/.*$
- ^tools/.*$
- ^requirements.*$
- ^test-requirements.*$
- ^setup.*$
- tox.ini
# Run only on files used in TripleO
@@ -363,6 +575,7 @@
- job:
name: tripleo-ci-centos-8-standalone-train-osa
parent: tripleo-ci-centos-8-standalone-osa
branches: stable/1.0.0
override-checkout: stable/train
vars:
branch_override: stable/train
@@ -370,6 +583,7 @@
- job:
name: tripleo-ci-centos-8-standalone-wallaby-osa
parent: tripleo-ci-centos-8-standalone-osa
branches: stable/1.0.0
override-checkout: stable/wallaby
vars:
branch_override: stable/wallaby
@@ -377,7 +591,7 @@
- job:
name: tripleo-ci-centos-9-standalone-wallaby-osa
parent: tripleo-ci-centos-9-standalone-osa
branches: ^(stable/1.0.0|master).*$
branches: stable/1.0.0
override-checkout: stable/wallaby
vars:
branch_override: stable/wallaby
@@ -417,6 +631,7 @@
- tox-pep8
- openstack-tox-linters-ansible-2.9
- openstack-tox-linters-ansible-2.12
voting: false
- ansible-collections-openstack-functional-devstack-releases:
dependencies: *deps_unit_lint
@@ -432,7 +647,6 @@
dependencies: *deps_unit_lint
- ansible-collections-openstack-functional-devstack-train-ansible-2.11:
dependencies: *deps_unit_lint
voting: false
- ansible-collections-openstack-functional-devstack-octavia:
dependencies: *deps_unit_lint
@@ -465,13 +679,13 @@
- tox-pep8
- openstack-tox-linters-ansible-2.12
- openstack-tox-linters-ansible-2.9
- ansible-collections-openstack-functional-devstack
# - ansible-collections-openstack-functional-devstack
- ansible-collections-openstack-functional-devstack-releases
- ansible-collections-openstack-functional-devstack-ansible-2.9
- ansible-collections-openstack-functional-devstack-ansible-2.12
# - ansible-collections-openstack-functional-devstack-ansible-2.9
# - ansible-collections-openstack-functional-devstack-ansible-2.12
- ansible-collections-openstack-functional-devstack-wallaby-ansible-2.12
- ansible-collections-openstack-functional-devstack-xena-ansible-2.12
# - ansible-collections-openstack-functional-devstack-train-ansible-2.11
- ansible-collections-openstack-functional-devstack-train-ansible-2.11
- ansible-collections-openstack-functional-devstack-octavia
- tripleo-ci-centos-8-standalone-wallaby-osa

View File

@@ -5,6 +5,67 @@ Openstack Cloud Ansilbe modules Release Notes
.. contents:: Topics
v1.8.0
======
Release Summary
---------------
Subnet pool module and bugfixes
Bugfixes
--------
- Add 'all_projects' to server_action module
- Add subnet pool module
- Bumped minimum required OpenStack SDK release to SDK 0.36.0 (Train)
- Changed compute_flavor_info module to use OpenStack SDK's proxy layer
- Dropped deprecated return values in floating_ip_info and assert remaining fields
- Fix ansible-lint issues for the newest version
- Fix assertion after stack deletion
- Handle aggregate host list set to None
- Reenabled check-import.sh which tests imports to Ansible Galaxy
- Remove old, unsupported parameters from documentation in image_info module
- Router - Remove unneeded 'filter' parameter
- Updated return value docs of compute_service_info module
New Modules
-----------
- openstack.cloud.subnet_pool - Create or Delete subnet pools from OpenStack.
v1.7.2
======
Release Summary
---------------
Bugfixes
Bugfixes
--------
- Fix collection guidelines
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
======

View File

@@ -15,7 +15,7 @@ For using the Openstack Cloud collection firstly you need to install `ansible` a
For example with pip:
```bash
pip install ansible openstacksdk
pip install "ansible>=2.9" "openstacksdk>=0.36"
```
OpenStackSDK has to be available to Ansible and to the Python interpreter on the host, where Ansible executes the module (target host).

View File

@@ -304,3 +304,40 @@ releases:
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'
1.7.2:
changes:
bugfixes:
- Fix collection guidelines
release_summary: Bugfixes
release_date: '2022-03-10'
1.8.0:
changes:
bugfixes:
- Add 'all_projects' to server_action module
- Add subnet pool module
- Bumped minimum required OpenStack SDK release to SDK 0.36.0 (Train)
- Changed compute_flavor_info module to use OpenStack SDK's proxy layer
- Dropped deprecated return values in floating_ip_info and assert remaining
fields
- Fix ansible-lint issues for the newest version
- Fix assertion after stack deletion
- Handle aggregate host list set to None
- Reenabled check-import.sh which tests imports to Ansible Galaxy
- Remove old, unsupported parameters from documentation in image_info module
- Router - Remove unneeded 'filter' parameter
- Updated return value docs of compute_service_info module
release_summary: Subnet pool module and bugfixes
modules:
- description: Create or Delete subnet pools from OpenStack.
name: subnet_pool
namespace: ''
release_date: '2022-04-08'

View File

@@ -0,0 +1,33 @@
---
- name: List flavors
openstack.cloud.compute_flavor_info:
cloud: "{{ cloud }}"
- name: List flavors with filter
openstack.cloud.compute_flavor_info:
cloud: "{{ cloud }}"
name: "m1.tiny"
register: flavor_name
- name: Check output of list flavors with filter
assert:
that:
- flavor_name.openstack_flavors | length == 1
- name: Assert fields on SDK 0.*
when: sdk_version is version(1.0, '<')
assert:
that:
- '["name", "description", "disk", "is_public", "ram",
"vcpus", "swap", "ephemeral", "is_disabled", "rxtx_factor", "id",
"extra_specs"] | difference(flavor_name.openstack_flavors.0.keys())
| length == 0'
- name: Assert fields on SDK 1.*
when: sdk_version is version(1.0, '>=')
assert:
that:
- '["name", "original_name", "description", "disk", "is_public", "ram",
"vcpus", "swap", "ephemeral", "is_disabled", "rxtx_factor", "id",
"extra_specs"] | difference(flavor_name.openstack_flavors.0.keys())
| length == 0'

View File

@@ -9,3 +9,13 @@
that:
- fips is success
- fips is not changed
- name: assert fields
when: fips.floating_ips|length > 0
assert:
that:
# allow new fields to be introduced but prevent fields from being removed
- '["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"]|
difference(fips.floating_ips.0.keys())|length == 0'

View File

@@ -7,6 +7,13 @@
register: result
failed_when: "result.openstack_compute_services | length <= 0"
- name: Assert fields
assert:
that:
- '["availability_zone", "binary", "disabled_reason", "is_forced_down",
"host", "name", "state", "status", "updated_at", "id"] |
difference(result.openstack_compute_services.0.keys()) | length == 0'
- name: Get nova conductor services info
openstack.cloud.compute_service_info:
cloud: "{{ cloud }}"

View File

@@ -41,4 +41,4 @@
- assert:
that:
- stacks is defined
- stacks['stacks']|length == 0
- (stacks['stacks']|length == 0) or (stacks['stacks'][0]['status'] == 'DELETE_COMPLETE')

View File

@@ -1,5 +1,8 @@
server_network: private
server_name: ansible_server
server_alt_network: private_alt
server_alt_subnet: subnet_alt
server_alt_name: ansible_server_alt
flavor: m1.tiny
floating_ip_pool_name: public
boot_volume_size: 5

View File

@@ -518,3 +518,95 @@
that:
- info24.openstack_servers.0.status == 'ACTIVE'
- server is not changed
- name: Create network for alternate server
openstack.cloud.network:
cloud: "{{ cloud_alt }}"
name: "{{ server_alt_network }}"
state: present
- name: Create subnet for alternate server
openstack.cloud.subnet:
cloud: "{{ cloud_alt }}"
network_name: "{{ server_alt_network }}"
name: "{{ server_alt_subnet }}"
state: present
cidr: 192.168.0.0/24
- name: Create server in alternate project
openstack.cloud.server:
cloud: "{{ cloud_alt }}"
state: present
name: "{{ server_alt_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
network: "{{ server_alt_network }}"
auto_floating_ip: false
wait: true
register: server_alt
- name: Get info about server in alternate project
openstack.cloud.server_info:
cloud: "{{ cloud_alt }}"
server: "{{ server_alt_name }}"
register: info25
- name: Ensure status for server in alternate project is ACTIVE
assert:
that:
- info25.openstack_servers.0.status == 'ACTIVE'
- name: Try to stop server in alternate project
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_alt_name }}"
action: stop
wait: true
ignore_errors: true
register: server_alt
- name: Ensure server was not stopped
assert:
that:
- server_alt is failed
- server_alt.msg == "Could not find server {{ server_alt_name }}"
- name: Stop server in alternate project with all_projects=true
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_alt_name }}"
action: stop
wait: true
all_projects: True
register: server_alt
- name: Get info about server in alternate project
openstack.cloud.server_info:
cloud: "{{ cloud_alt }}"
server: "{{ server_alt_name }}"
register: info26
- name: Ensure status for server is SHUTOFF
assert:
that:
- info26.openstack_servers.0.status == 'SHUTOFF'
- server_alt is changed
- name: Delete server in alternate project
openstack.cloud.server:
cloud: "{{ cloud_alt }}"
state: absent
name: "{{ server_alt_name }}"
wait: true
- name: Delete subnet for alternate server
openstack.cloud.subnet:
cloud: "{{ cloud_alt }}"
name: "{{ server_alt_subnet }}"
state: absent
- name: Delete network for alternate server
openstack.cloud.network:
cloud: "{{ cloud_alt }}"
name: "{{ server_alt_network }}"
state: absent

View File

@@ -0,0 +1,5 @@
subnet_pool_name: "subnet_pool"
address_scope_name: "address_scope"
default_prefix_length: 24
minimum_prefix_length: 10
maximum_prefix_length: 30

View File

@@ -0,0 +1,73 @@
---
- name: Create address_scope
openstack.cloud.address_scope:
cloud: "{{ cloud }}"
name: "{{ address_scope_name }}"
shared: False
ip_version: "4"
register: create_address_scope
- name: Create subnet pool
openstack.cloud.subnet_pool:
cloud: "{{ cloud }}"
name: "{{ subnet_pool_name }}"
shared: False
address_scope: "{{ address_scope_name }}"
prefixes:
- 192.168.0.0/24
register: create_subnet_pool
- name: Verify subnet pool
assert:
that:
- create_subnet_pool is successful
- create_subnet_pool is changed
- create_subnet_pool.subnet_pool.name == subnet_pool_name
- create_subnet_pool.subnet_pool.is_shared == False
- create_subnet_pool.subnet_pool.is_default == False
- create_subnet_pool.subnet_pool.address_scope_id == create_address_scope.address_scope.id
- create_subnet_pool.subnet_pool.prefixes == ['192.168.0.0/24']
- name: Update subnet pool
openstack.cloud.subnet_pool:
cloud: "{{ cloud }}"
name: "{{ subnet_pool_name }}"
address_scope: "{{ address_scope_name }}"
shared: False
default_prefix_length: "{{ default_prefix_length }}"
minimum_prefix_length: "{{ minimum_prefix_length }}"
maximum_prefix_length: "{{ maximum_prefix_length }}"
description: "test"
prefixes:
- 192.168.0.0/24
- 192.168.1.0/24
register: update_subnet_pool
- name: Verify updated subnet pool
assert:
that:
- update_subnet_pool is successful
- update_subnet_pool is changed
- update_subnet_pool.subnet_pool.name == subnet_pool_name
- update_subnet_pool.subnet_pool.is_shared == False
- update_subnet_pool.subnet_pool.is_default == False
- update_subnet_pool.subnet_pool.address_scope_id == create_address_scope.address_scope.id
- update_subnet_pool.subnet_pool.prefixes == ['192.168.0.0/23']
- update_subnet_pool.subnet_pool.description == 'test'
- update_subnet_pool.subnet_pool.default_prefix_length == default_prefix_length
- update_subnet_pool.subnet_pool.minimum_prefix_length == minimum_prefix_length
- update_subnet_pool.subnet_pool.maximum_prefix_length == maximum_prefix_length
- name: Delete created subnet pool
openstack.cloud.subnet_pool:
cloud: "{{ cloud }}"
name: "{{ subnet_pool_name }}"
state: absent
- name: Delete created address scope
openstack.cloud.address_scope:
cloud: "{{ cloud }}"
name: "{{ address_scope_name }}"
state: absent

View File

@@ -6,20 +6,22 @@
#
# tox -e ansible [TAG ...]
# or
# tox -e ansible -- -c cloudX [TAG ...]
# tox -e ansible -- -c cloudX -u cloudY [TAG ...]
# or to use the development version of Ansible:
# tox -e ansible -- -d -c cloudX [TAG ...]
# tox -e ansible -- -d -c cloudX -u cloudY [TAG ...]
#
# USAGE:
# run-ansible-tests.sh -e ENVDIR [-d] [-c CLOUD] [TAG ...]
# run-ansible-tests.sh -e ENVDIR [-d] [-c CLOUD] [-u CLOUD_ALT] [TAG ...]
#
# PARAMETERS:
# -d Use Ansible source repo development branch.
# -e ENVDIR Directory of the tox environment to use for testing.
# -c CLOUD Name of the cloud to use for testing.
# Defaults to "devstack-admin".
# [TAG ...] Optional list of space-separated tags to control which
# modules are tested.
# -d Use Ansible source repo development branch.
# -e ENVDIR Directory of the tox environment to use for testing.
# -c CLOUD Name of the cloud to use for testing.
# Defaults to "devstack-admin".
# -u CLOUD_ALT Name of another cloud to use for testing.
# Defaults to "devstack-alt".
# [TAG ...] Optional list of space-separated tags to control which
# modules are tested.
#
# EXAMPLES:
# # Run all Ansible tests
@@ -31,14 +33,16 @@
set -ex
CLOUD="devstack-admin"
CLOUD_ALT="devstack-alt"
ENVDIR=
USE_DEV=0
while getopts "c:de:" opt
while getopts "c:de:u:" opt
do
case $opt in
d) USE_DEV=1 ;;
c) CLOUD=${OPTARG} ;;
u) CLOUD_ALT=${OPTARG} ;;
e) ENVDIR=${OPTARG} ;;
?) echo "Invalid option: -${OPTARG}"
exit 1;;
@@ -134,6 +138,6 @@ pushd ci/
set -o pipefail
ANSIBLE_COLLECTIONS_PATHS=$TEST_COLLECTIONS_PATHS ansible-playbook \
-vvv ./run-collection.yml \
-e "sdk_version=${SDK_VER} cloud=${CLOUD} image=${IMAGE} ${ANSIBLE_VARS}" \
-e "sdk_version=${SDK_VER} cloud=${CLOUD} cloud_alt=${CLOUD_ALT} image=${IMAGE} ${ANSIBLE_VARS}" \
${tag_opt} 2>&1 | sudo tee /opt/stack/logs/test_output.log
popd

View File

@@ -35,6 +35,8 @@
- rbac
- neutron_rbac
- { role: nova_flavor, tags: nova_flavor }
- role: compute_flavor_info
tags: nova_flavor
- role: nova_services
tags: nova_services
when: sdk_version is version(0.44, '>=')
@@ -45,6 +47,7 @@
- { role: security_group, tags: security_group }
- { role: server, tags: server }
- { role: subnet, tags: subnet }
- { role: subnet_pool, tags: subnet_pool }
- { role: user, tags: user }
- { role: user_group, tags: user_group }
- { role: user_role, tags: user_role }

View File

@@ -13,7 +13,7 @@ Naming
------
* This is a collection named ``openstack.cloud``. There is no need for further namespace prefixing.
* Name any module that a cloud consumer would expect to use after the logical resource it manages:
* Name any module that a cloud consumer would expect to use after the logical resource it manages:
``server`` not ``nova``. This naming convention acknowledges that the end user does not care
which service manages the resource - that is a deployment detail. For example cloud consumers may
not know whether their floating IPs are managed by Nova or Neutron.
@@ -24,6 +24,7 @@ Interface
* If the resource being managed has an id, it should be returned.
* If the resource being managed has an associated object more complex than
an id, it should also be returned.
* Return format shall be a dictionary or list
Interoperability
----------------
@@ -53,7 +54,7 @@ Libraries
* All complex cloud interaction or interoperability code should be housed in
the `openstacksdk <https://opendev.org/openstack/openstacksdk>`_
library.
* All OpenStack API interactions should happen via the openstacksdk and not via
* All OpenStack API interactions should happen via the openstackSDK and not via
OpenStack Client libraries. The OpenStack Client libraries do no have end
users as a primary audience, they are for intra-server communication.
* All modules should be registered in ``meta/action_groups.yml`` for enabling the

View File

@@ -33,4 +33,4 @@ build_ignore:
- ansible_collections_openstack.egg-info
- contrib
- changelogs
version: 1.7.0
version: 1.8.0

View File

@@ -18,7 +18,7 @@ build_ignore:
- ci
- galaxy.yml.in
- setup.cfg
- test-requirements.txt
- test-requirements*
- tests
- tools
- tox.ini
@@ -29,7 +29,7 @@ build_ignore:
- importer_result.json
- .tox
- .env
- .vscode
- ansible_collections_openstack.egg-info
- contrib
- changelogs/.plugin-cache.yaml
- changelogs/fragments
- changelogs

View File

@@ -99,6 +99,7 @@ action_groups:
- stack
- subnet
- subnets_info
- subnet_pool
- volume
- volume_backup
- volume_backup_info

View File

@@ -25,7 +25,7 @@ options:
show_all:
description: toggles showing all vms vs only those with a working IP
type: bool
default: 'no'
default: false
inventory_hostname:
description: |
What to register as the inventory hostname.
@@ -47,7 +47,7 @@ options:
'ansible_ssh_host' facts. This might be desired when using jump or
bastion hosts and the name is the FQDN of the host.
type: bool
default: 'no'
default: false
expand_hostvars:
description: |
Run extra commands on each host to fill in additional
@@ -56,7 +56,7 @@ options:
(Note, the default value of this is opposite from the default
old openstack.py inventory script's option expand_hostvars)
type: bool
default: 'no'
default: false
private:
description: |
Use the private interface of each server, if it has one, as
@@ -64,12 +64,13 @@ options:
running ansible inside a server in the cloud and would rather
communicate to your servers over the private network.
type: bool
default: 'no'
default: false
only_clouds:
description: |
List of clouds from clouds.yaml to use, instead of using
the whole list.
type: list
elements: str
default: []
fail_on_errors:
description: |
@@ -80,12 +81,12 @@ options:
default value of this is opposite from the old openstack.py
inventory script's option fail_on_errors)
type: bool
default: 'no'
default: false
all_projects:
description: |
Lists servers from all projects
type: bool
default: 'no'
default: false
clouds_yaml_path:
description: |
Override path to clouds.yaml file. If this value is given it
@@ -94,6 +95,7 @@ options:
/etc/ansible/openstack.yml to the regular locations documented
at https://docs.openstack.org/os-client-config/latest/user/configuration.html#config-files
type: list
elements: str
env:
- name: OS_CLIENT_CONFIG_FILE
compose:

View File

@@ -30,7 +30,7 @@ options:
ip_version:
description:
- The IP version of the subnet 4 or 6
default: 4
default: '4'
type: str
choices: ['4', '6']
shared:

View File

@@ -126,6 +126,29 @@ openstack_flavors:
returned: success
type: str
sample: "tiny"
description:
description: Description of the flavor
returned: success
type: str
sample: "Small flavor"
is_disabled:
description: Wether the flavor is enabled or not
returned: success
type: bool
sample: False
rxtx_factor:
description: Factor to be multiplied by the rxtx_base property of
the network it is attached to in order to have a
different bandwidth cap.
returned: success
type: float
sample: 1.0
extra_specs:
description: Optional parameters to configure different flavors
options.
returned: success
type: dict
sample: "{'hw_rng:allowed': True}"
disk:
description: Size of local disk, in GB.
returned: success
@@ -196,16 +219,22 @@ class ComputeFlavorInfoModule(OpenStackModule):
filters['ephemeral'] = ephemeral
if name:
flavors = self.conn.search_flavors(filters={'name': name})
# extra_specs are exposed in the flavor representation since Rocky, so we do not
# need get_extra_specs=True which is not available in OpenStack SDK 0.36 (Train)
# Ref.: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html
flavor = self.conn.compute.find_flavor(name)
flavors = [flavor] if flavor else []
else:
flavors = self.conn.list_flavors()
flavors = list(self.conn.compute.flavors())
if filters:
flavors = self.conn.range_search(flavors, filters)
if limit is not None:
flavors = flavors[:limit]
# Transform entries to dict
flavors = [flavor.to_dict(computed=True) for flavor in flavors]
self.exit_json(changed=False, openstack_flavors=flavors)

View File

@@ -59,10 +59,22 @@ openstack_compute_services:
description: The name of the host.
returned: success
type: str
zone:
disabled_reason:
description: The reason why the service is disabled
returned: success
type: str
availability_zone:
description: The availability zone name.
returned: success
type: str
is_forced_down:
description: If the service has been forced down or nova-compute
returned: success
type: bool
name:
description: Service name
returned: success
type: str
status:
description: The status of the service. One of enabled or disabled.
returned: success
@@ -71,7 +83,7 @@ openstack_compute_services:
description: The state of the service. One of up or down.
returned: success
type: str
update:
update_at:
description: The date and time when the resource was updated
returned: success
type: str
@@ -98,7 +110,7 @@ class ComputeServiceInfoModule(OpenStackModule):
if host:
filters['host'] = host
services = self.conn.compute.services(**filters)
services = list(services)
services = [service.to_dict(computed=True) for service in services]
self.exit_json(changed=False, openstack_compute_services=services)

View File

@@ -165,7 +165,6 @@ class FloatingIPInfoModule(OpenStackModule):
router = self.params['router']
status = self.params['status']
data = []
query = {}
if description:
query['description'] = description
@@ -194,15 +193,8 @@ class FloatingIPInfoModule(OpenStackModule):
if status:
query['status'] = status.upper()
for raw in self.conn.network.ips(**query):
dt = raw.to_dict()
dt.pop('location')
data.append(dt)
self.exit_json(
changed=False,
floating_ips=data
)
ips = [ip.to_dict(computed=False) for ip in self.conn.network.ips(**query)]
self.exit_json(changed=False, floating_ips=ips)
def main():

View File

@@ -135,14 +135,14 @@ class ComputeHostAggregateModule(OpenStackModule):
if hosts is None:
return
hosts_to_add = set(hosts) - set(aggregate.get("hosts", []))
hosts_to_add = set(hosts) - set(aggregate.get("hosts") or [])
for i in hosts_to_add:
self.conn.add_host_to_aggregate(aggregate.id, i)
if not purge_hosts:
return
hosts_to_remove = set(aggregate.get("hosts", [])) - set(hosts)
hosts_to_remove = set(aggregate.get("hosts") or []) - set(hosts)
for i in hosts_to_remove:
self.conn.remove_host_from_aggregate(aggregate.id, i)

View File

@@ -61,7 +61,7 @@ options:
description:
- Prevent image from being deleted
type: bool
default: 'no'
default: false
filename:
description:
- The path to the file which has to be uploaded

View File

@@ -88,10 +88,6 @@ openstack_image:
description: Image created at timestamp.
returned: success
type: str
deleted:
description: Image deleted flag.
returned: success
type: bool
container_format:
description: Container format of the image.
returned: success
@@ -132,10 +128,6 @@ openstack_image:
description: Is public flag of the image.
returned: success
type: bool
deleted_at:
description: Image deleted at timestamp.
returned: success
type: str
size:
description: Size of the image.
returned: success

View File

@@ -45,7 +45,7 @@ options:
- The number of successful checks before changing the operating status of the member to ONLINE.
max_retries_down:
type: 'str'
default: 3
default: '3'
description:
- The number of allowed check failures before changing the operating status of the member to ERROR. A valid value is from 1 to 10. The default is 3.
resp_timeout:
@@ -60,7 +60,7 @@ options:
type: bool
expected_codes:
type: 'str'
default: 200
default: '200'
description:
- The list of HTTP status codes expected in response from the member to declare it healthy. Specify one of the following values
A single value, such as 200

View File

@@ -234,8 +234,7 @@ class RouterModule(OpenStackModule):
missing_port_ids,
requested_subnet_ids,
existing_subnet_ids,
router_ifs_cfg,
filters=None):
router_ifs_cfg):
"""Decide if the given router needs an update."""
if router['admin_state_up'] != self.params['admin_state_up']:
return True
@@ -476,8 +475,7 @@ class RouterModule(OpenStackModule):
missing_port_ids,
requested_subnet_ids,
existing_subnet_ids,
router_ifs_cfg,
filters)
router_ifs_cfg)
self.exit_json(changed=changed)
if state == 'present':
@@ -510,8 +508,7 @@ class RouterModule(OpenStackModule):
missing_port_ids,
requested_subnet_ids,
existing_subnet_ids,
router_ifs_cfg,
filters):
router_ifs_cfg):
changed = True
kwargs = self._build_kwargs(router, net)
updated_router = self.conn.update_router(**kwargs)

View File

@@ -49,6 +49,7 @@ options:
description:
- A list of tags to filter the list result by. Resources that match all tags in this list will be returned.
type: list
elements: str
requirements:
- "python >= 3.6"
- "openstacksdk"

View File

@@ -46,6 +46,12 @@ options:
description:
- Admin password for server to rebuild
type: str
all_projects:
description:
- Whether to search for server in all projects or just the current
auth scoped project.
type: bool
default: 'no'
requirements:
- "python >= 3.6"
@@ -120,6 +126,7 @@ class ServerActionModule(OpenStackModule):
'rebuild', 'shelve', 'shelve_offload', 'unshelve']),
image=dict(required=False, type='str'),
admin_password=dict(required=False, type='str', no_log=True),
all_projects=dict(required=False, type='bool', default=False),
)
module_kwargs = dict(
required_if=[('action', 'rebuild', ['image'])],
@@ -137,7 +144,10 @@ class ServerActionModule(OpenStackModule):
def _preliminary_checks(self):
# Using Munch object for getting information about a server
os_server = self.conn.get_server(self.params['server'])
os_server = self.conn.get_server(
self.params['server'],
all_projects=self.params['all_projects'],
)
if not os_server:
self.fail_json(msg='Could not find server %s' % self.params['server'])
# check mode
@@ -193,8 +203,9 @@ class ServerActionModule(OpenStackModule):
def _wait(self, os_server):
"""Wait for the server to reach the desired state for the given action."""
# Using Server object for wait_for_server function
server = self.conn.compute.find_server(self.params['server'])
# The wait_for_server function needs a Server object instead of the
# Munch object returned by self.conn.get_server
server = self.conn.compute.get_server(os_server['id'])
states = _action_map[self.params['action']]
try:

View File

@@ -39,7 +39,7 @@ options:
ip_version:
description:
- The IP version of the subnet 4 or 6
default: 4
default: '4'
type: str
choices: ['4', '6']
enable_dhcp:

View File

@@ -0,0 +1,345 @@
#!/usr/bin/python
# coding: utf-8 -*-
#
# Copyright (c) 2021 by Uemit Seren <uemit.seren@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = '''
---
module: subnet_pool
short_description: Create or delete subnet pools from OpenStack
author: OpenStack Ansible SIG
description:
- Create or Delete subnet pools from OpenStack.
options:
state:
description:
- Indicate desired state of the resource
choices: ['present', 'absent']
default: present
type: str
name:
description:
- Name to be give to the subnet pool
required: true
type: str
project:
description:
- Unique name or ID of the project.
type: str
prefixes:
description:
- Set subnet pool prefixes (in CIDR notation)
type: list
elements: str
minimum_prefix_length:
description:
- The minimum prefix length that can be allocated from the subnet pool.
required: False
type: int
maximum_prefix_length:
description:
- The maximum prefix length that can be allocated from the subnet pool.
required: False
type: int
default_prefix_length:
description:
- The length of the prefix to allocate when the cidr or prefixlen attributes
are omitted when creating a subnet
type: int
required: False
address_scope:
description:
- Set address scope (ID or name) associated with the subnet pool
type: str
required: False
is_default:
description:
- Whether this subnet pool is by default
type: bool
default: 'no'
description:
description: The subnet pool description
type: str
required: False
default_quota:
description:
- A per-project quota on the prefix space that can be allocated
from the subnet pool for project subnets
required: False
type: int
shared:
description:
- Whether this subnet pool is shared or not.
type: bool
default: 'no'
extra_specs:
description:
- Dictionary with extra key/value pairs passed to the API
required: false
default: {}
type: dict
requirements:
- "python >= 3.6"
- "openstacksdk"
extends_documentation_fragment:
- openstack.cloud.openstack
'''
EXAMPLES = '''
# Create an subnet pool.
- openstack.cloud.subnet_pool:
cloud: mycloud
state: present
name: my_subnet_pool
prefixes:
- 10.10.10.0/24
# Create a subnet pool for a given project.
- openstack.cloud.subnet_pool:
cloud: mycloud
state: present
name: my_subnet_pool
project: myproj
prefixes:
- 10.10.10.0/24
# Create a shared and default subnet pool in existing address scope
- openstack.cloud.subnet_pool:
cloud: mycloud
state: present
name: my_subnet_pool
address_scope: my_adress_scope
is_default: True
default_quota: 10
maximum_prefix_length: 32
minimum_prefix_length: 8
default_prefix_length: 24
shared: True
prefixes:
- 10.10.10.0/8
# Delete subnet poool.
- openstack.cloud.subnet_pool:
cloud: mycloud
state: absent
name: my_subnet_pool
'''
RETURN = '''
subnet_pool:
description: Dictionary describing the subnet pool.
returned: On success when I(state) is 'present'
type: complex
contains:
id:
description: Subnet Pool ID.
type: str
sample: "474acfe5-be34-494c-b339-50f06aa143e4"
name:
description: Subnet Pool name.
type: str
sample: "my_subnet_pool"
project_id:
description: The ID of the project.
type: str
sample: "861174b82b43463c9edc5202aadc60ef"
ip_version:
description: The IP version of the subnet pool 4 or 6.
type: int
sample: 4
is_shared:
description: Indicates whether this subnet pool is shared across all projects.
type: bool
sample: false
is_default:
description: Indicates whether this is the default subnet pool.
type: bool
sample: false
address_scope_id:
description: The address scope ID.
type: str
sample: "861174b82b43463c9edc5202aadc60ef"
created_at:
description: Timestamp when the subnet pool was created.
type: str
sample: ""
default_prefix_length:
description:
- The length of the prefix to allocate when the cidr or prefixlen
attributes are omitted when creating a subnet
type: int
sample: 32
default_quota:
description:
- The per-project quota on the prefix space that can be allocated
from the subnet pool for project subnets.
type: int
sample: 22
description:
description: The subnet pool description.
type: str
sample: "My test subnet pool."
maximum_prefix_length:
description: The maximum prefix length that can be allocated from the subnet pool.
type: int
sample: 22
minimum_prefix_length:
description: The minimum prefix length that can be allocated from the subnet pool.
type: int
sample: 8
prefixes:
description: A list of subnet prefixes that are assigned to the subnet pool.
type: list
sample: ['10.10.20.0/24', '10.20.10.0/24']
revision_number:
description: Revision number of the subnet pool.
type: int
sample: 5
updated_at:
description: Timestamp when the subnet pool was last updated.
type: str
sample:
'''
from ansible_collections.openstack.cloud.plugins.module_utils.openstack import OpenStackModule
class SubnetPoolModule(OpenStackModule):
argument_spec = dict(
state=dict(default='present', choices=['absent', 'present']),
name=dict(required=True),
shared=dict(default=False, type='bool'),
minimum_prefix_length=dict(default=None, type='int'),
maximum_prefix_length=dict(default=None, type='int'),
default_prefix_length=dict(default=None, type='int'),
description=dict(default=None, type='str'),
default_quota=dict(default=None, type='int'),
prefixes=dict(type='list', elements='str'),
is_default=dict(default=False, type='bool'),
address_scope=dict(default=None),
project=dict(default=None),
extra_specs=dict(type='dict', default=dict())
)
def _needs_update(self, subnet_pool):
"""Check for differences in the updatable values.
NOTE: We don't currently allow name updates.
"""
compare_simple = ['is_default',
'minimum_prefix_length',
'maximum_prefix_length',
'default_prefix_length',
'description',
'default_quota']
compare_list = ['prefixes']
for key in compare_simple:
if self.params[key] is not None and self.params[key] != subnet_pool[key]:
return True
for key in compare_list:
if (
self.params[key] is not None
and set(self.params[key]) != set(subnet_pool[key])
):
return True
return False
def _system_state_change(self, subnet_pool, filters=None):
"""Check if the system state would be changed."""
state = self.params['state']
if state == 'absent' and subnet_pool:
return True
if state == 'present':
if not subnet_pool:
return True
return self._needs_update(subnet_pool, filters)
return False
def _compose_subnet_pool_args(self):
subnet_pool_kwargs = {}
optional_parameters = ['name',
'minimum_prefix_length',
'maximum_prefix_length',
'default_prefix_length',
'description',
'is_default',
'default_quota',
'prefixes']
for optional_param in optional_parameters:
if self.params[optional_param] is not None:
subnet_pool_kwargs[optional_param] = self.params[optional_param]
return subnet_pool_kwargs
def run(self):
state = self.params['state']
name = self.params['name']
project = self.params['project']
address_scope = self.params['address_scope']
extra_specs = self.params['extra_specs']
if project is not None:
proj = self.conn.get_project(project)
if proj is None:
self.fail(msg='Project %s could not be found' % project)
project_id = proj['id']
else:
project_id = self.conn.current_project_id
address_scope_id = None
if address_scope is not None:
address_scope = self.conn.network.find_address_scope(name_or_id=address_scope)
if address_scope is None:
self.fail(msg='AddressScope %s could not be found' % address_scope)
address_scope_id = address_scope['id']
subnet_pool = self.conn.network.find_subnet_pool(name_or_id=name)
if self.ansible.check_mode:
self.exit_json(
changed=self._system_state_change(subnet_pool)
)
if state == 'present':
changed = False
if not subnet_pool:
kwargs = self._compose_subnet_pool_args()
kwargs['address_scope_id'] = address_scope_id
kwargs['project_id'] = project_id
kwargs['is_shared'] = self.params['shared']
dup_args = set(kwargs.keys()) & set(extra_specs.keys())
if dup_args:
raise ValueError('Duplicate key(s) {0} in extra_specs'
.format(list(dup_args)))
kwargs = dict(kwargs, **extra_specs)
subnet_pool = self.conn.network.create_subnet_pool(**kwargs)
changed = True
else:
if self._needs_update(subnet_pool):
kwargs = self._compose_subnet_pool_args()
subnet_pool = self.conn.network.update_subnet_pool(subnet_pool['id'], **kwargs)
changed = True
else:
changed = False
self.exit_json(changed=changed, subnet_pool=subnet_pool, id=subnet_pool['id'])
elif state == 'absent':
if not subnet_pool:
self.exit(changed=False)
else:
self.conn.network.delete_subnet_pool(subnet_pool['id'])
self.exit_json(changed=True)
def main():
module = SubnetPoolModule()
module()
if __name__ == '__main__':
main()

View File

@@ -1 +1 @@
openstacksdk>=0.13
openstacksdk>=0.36

View File

@@ -1 +0,0 @@
test-requirements-2.11.txt

View File

@@ -0,0 +1 @@
# No constraints are defined by default

View File

@@ -0,0 +1 @@
openstacksdk<1.0.0

View File

@@ -0,0 +1 @@
openstacksdk>=1.0.0

View File

@@ -1,11 +1,11 @@
openstacksdk
ansible-core
pycodestyle
ansible-core>=2.11.0,<2.12.0
flake8
galaxy-importer
openstacksdk
pycodestyle
pylint
voluptuous
yamllint
rstcheck
ruamel.yaml
#galaxy-importer # see https://review.opendev.org/#/c/743054
tox
voluptuous
yamllint

View File

@@ -1,11 +1,11 @@
openstacksdk
ansible<2.10
pycodestyle
ansible-core>=2.12.0,<2.13.0
flake8
galaxy-importer
openstacksdk
pycodestyle
pylint
voluptuous
yamllint
rstcheck
ruamel.yaml
#galaxy-importer # see https://review.opendev.org/#/c/743054
tox
voluptuous
yamllint

View File

@@ -0,0 +1,13 @@
ansible>=2.9.0,<2.10.0
flake8
# galaxy-importer 0.3.2 moved from ansible 2.9 to ansible-core 2.11
# Ref.: https://github.com/ansible/galaxy-importer/commit/98933547831922c45243f39d85eefe150b55fc36
galaxy-importer==0.3.1
openstacksdk
pycodestyle
pylint
rstcheck
ruamel.yaml
tox
voluptuous
yamllint

View File

@@ -1,11 +1,11 @@
openstacksdk
ansible-core
pycodestyle
flake8
galaxy-importer
openstacksdk
pycodestyle
pylint
voluptuous
yamllint
rstcheck
ruamel.yaml
#galaxy-importer # see https://review.opendev.org/#/c/743054
tox
voluptuous
yamllint

View File

@@ -15,11 +15,5 @@
set -e
TOXDIR=${1:-.}
######### Disbaled in https://review.opendev.org/#/c/743054
# galaxy_importer.main does not return non-zero error code on error
#output=$(python -m galaxy_importer.main $TOXDIR/build_artifact/*)
#if echo $output | grep ERROR: ; then
# exit 1
#fi
TOXDIR="${1:-.}"
python -m galaxy_importer.main "$TOXDIR/build_artifact/"*

39
tox.ini
View File

@@ -1,6 +1,6 @@
[tox]
minversion = 3.18.0
envlist = pep8
envlist = linters
skipsdist = True
ignore_basepython_conflict = True
@@ -21,7 +21,8 @@ setenv =
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
pip: PIP_INSTALL={env:PIP_INSTALL:true}
deps =
-r{toxinidir}/test-requirements.txt
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements.txt
pip: {toxinidir}
commands = stestr run {posargs}
@@ -33,9 +34,10 @@ commands =
[testenv:build]
deps =
ansible-core
galaxy-importer
pbr
ruamel.yaml
ansible-core
commands =
python {toxinidir}/tools/build.py
@@ -57,24 +59,22 @@ commands =
passenv = {[testenv:linters]passenv}
commands = {[testenv:linters]commands}
deps =
-r{toxinidir}/test-requirements-2.9.txt
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.9.txt
[testenv:linters-2.11]
passenv = {[testenv:linters]passenv}
commands = {[testenv:linters]commands}
deps =
-r{toxinidir}/test-requirements-2.11.txt
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.11.txt
[testenv:linters-2.12]
passenv = {[testenv:linters]passenv}
commands = {[testenv:linters]commands}
deps =
-r{toxinidir}/test-requirements-2.12.txt
[testenv:venv]
deps =
-r{toxinidir}/test-requirements.txt
commands = {posargs}
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.12.txt
[flake8]
# W503 Is supposed to be off by default but in the latest pycodestyle isn't.
@@ -98,29 +98,24 @@ deps =
commands =
/bin/bash {toxinidir}/ci/run-ansible-tests-collection.sh -e {envdir} {posargs}
# PIP job runs with Ansible-2.9
[testenv:ansible-pip]
deps =
-r{toxinidir}/test-requirements-2.9.txt
{toxinidir}
passenv = {[testenv:ansible]passenv}
commands = {[testenv:ansible]commands}
[testenv:ansible-2.9]
deps =
-r{toxinidir}/test-requirements-2.9.txt
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.9.txt
passenv = {[testenv:ansible]passenv}
commands = {[testenv:ansible]commands}
[testenv:ansible-2.11]
deps =
-r{toxinidir}/test-requirements-2.11.txt
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.11.txt
passenv = {[testenv:ansible]passenv}
commands = {[testenv:ansible]commands}
[testenv:ansible-2.12]
deps =
-r{toxinidir}/test-requirements-2.12.txt
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.12.txt
passenv = {[testenv:ansible]passenv}
commands = {[testenv:ansible]commands}