Adds a module to manage Neutron network segments where the
segmentation plugin is enabled.
Segments are relatively simple and do not support modification
beyond the name/description, so most attributes are used for
initial segment creation, or filtering results in order to
perform updates.
Depends-On: https://review.opendev.org/c/openstack/ansible-collections-openstack/+/955752
Change-Id: I4647fd96aaa15460d82765365f98a18ddf2693db
When creating a subnet with disable_gateway_ip, the value
was not passed into the creation which would lead into
a subnet being created with a gateway, and then on updates
it would have the gateway removed.
Change-Id: I816d4a4d09b2116c00cf868a590bd92dac4bfc5b
Since long time we knew that it is necessary to explicitly invoke
`to_dict` for openstacksdk resources before passing them to Ansible.
Here it was missed and in addition to that records are only returned
when the recordset becomes active.
Change-Id: I49238d2f7add9412bb9100b69f1b84b512f8c34b
With this change, multiple allocation pool may be specified when creating
a subnet. Allocation pools are defined as a list of dictionaries.
For example:
openstack.cloud.subnet:
name: sub1
network: network1
cidr: 192.168.0.0/24
ip_version: 4
allocation_pools:
- start: 192.168.0.10
end: 192.168.0.50
- start: 192.168.0.100
end: 192.168.0.150
Change-Id: I77a06990de082466dc6265a14c379b8bbaf789e8
Specifying CIDR during creation of subnet from subnet pool is a valid
operation. Moreover, in case of use of a subnet pool with multiple
subnets, cidr is a mandatory paramter for creating subnet.
Following code should be valid:
- name: Create subnet
openstack.cloud.subnet:
name: "subnet_name"
network: "some_network"
gateway_ip: "192.168.0.1"
allocation_pool_start: "192.168.0.2"
allocation_pool_end: "192.168.0.254"
cidr: "192.168.0.0/24"
ip_version: 4
subnet_pool: "192.168.0.0/24"
This scenario is added as a subnet-pool.yaml test in the test role.
Change-Id: I1163ba34ac3079f76dd0b7477a80a2135985a650
Previously, all subnet properties were updated if any value did not match.
But this behaviour caused errors like e.g. "Current gateway ip 192.168.0.1
already in use by port [ID]. Unable to update." even if that gateway was
not about to be changed.
Task: 40927
Story: 2008172
Change-Id: I049b0dade4c7ea3e1ef24777ae558f650caa136c
Fix subnet idempotency for allocation pools, see the linked story.
Return updated subnet information.
Remove adding allocation pools that were introduced in
Ib8becf5e958f1bc8e5c9fd76f1722536bf1c9f1a
in order to add allocation pools, either add new variable or
recreate the subnet.
Task: 41307
Story: 2008384
Change-Id: Ibe808227de159c6975dc94ef8ad0ab03a9345e17
This is separate from the previous patch - it's just the results
of running the script so we can review the two a little independently.
We should probably squash them.
Change-Id: I838f15cf4a32455a5be20033c8ddc27db6ca15c0
As per the REST Networking API v2.0 (Subnet) docs, if subnets pools
are not specified, OpenStack networking automatically allocates pools
covering all IP addresses in the CIDR.
In custom vendor specific environments, subnets can be created without
allocation pools via UI due to which subnets will not have any existing
allocation pools. Under this scenario, module throws an
"IndexError: list index out of range" error.
Also, allow to add more allocation pools on top of existing allocation
pools.
Change-Id: Ib8becf5e958f1bc8e5c9fd76f1722536bf1c9f1a