mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-05-07 05:43:15 +00:00
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
76 lines
2.2 KiB
YAML
76 lines
2.2 KiB
YAML
---
|
|
- name: Create network {{ network_name }}
|
|
openstack.cloud.network:
|
|
cloud: "{{ cloud }}"
|
|
name: "{{ network_name }}"
|
|
state: present
|
|
|
|
- name: Create subnet {{ subnet_name }} on network {{ network_name }}
|
|
openstack.cloud.subnet:
|
|
cloud: "{{ cloud }}"
|
|
network_name: "{{ network_name }}"
|
|
enable_dhcp: "{{ enable_subnet_dhcp }}"
|
|
name: "{{ subnet_name }}"
|
|
state: present
|
|
cidr: 192.168.0.0/24
|
|
gateway_ip: 192.168.0.1
|
|
allocation_pool_start: 192.168.0.2
|
|
allocation_pool_end: 192.168.0.4
|
|
|
|
- name: Create subnet {{ subnet_name }} on network {{ network_name }} again
|
|
openstack.cloud.subnet:
|
|
cloud: "{{ cloud }}"
|
|
network_name: "{{ network_name }}"
|
|
enable_dhcp: "{{ enable_subnet_dhcp }}"
|
|
name: "{{ subnet_name }}"
|
|
state: present
|
|
cidr: 192.168.0.0/24
|
|
gateway_ip: 192.168.0.1
|
|
allocation_pool_start: 192.168.0.2
|
|
allocation_pool_end: 192.168.0.4
|
|
register: idem1
|
|
|
|
- name: Update subnet {{ subnet_name }} allocation pools
|
|
openstack.cloud.subnet:
|
|
cloud: "{{ cloud }}"
|
|
network_name: "{{ network_name }}"
|
|
name: "{{ subnet_name }}"
|
|
state: present
|
|
cidr: 192.168.0.0/24
|
|
gateway_ip: 192.168.0.1
|
|
allocation_pool_start: 192.168.0.2
|
|
allocation_pool_end: 192.168.0.8
|
|
|
|
- name: Get Subnet Info
|
|
openstack.cloud.subnets_info:
|
|
cloud: "{{ cloud }}"
|
|
name: "{{ subnet_name }}"
|
|
register: subnet_result
|
|
|
|
- name: Verify Subnet Allocation Pools Exist
|
|
assert:
|
|
that:
|
|
- idem1 is not changed
|
|
- subnet_result.openstack_subnets is defined
|
|
- subnet_result.openstack_subnets | length == 1
|
|
- subnet_result.openstack_subnets[0].allocation_pools is defined
|
|
- subnet_result.openstack_subnets[0].allocation_pools | length == 1
|
|
|
|
- name: Verify Subnet Allocation Pools
|
|
assert:
|
|
that:
|
|
- subnet_result.openstack_subnets[0].allocation_pools.0.start == '192.168.0.2'
|
|
- subnet_result.openstack_subnets[0].allocation_pools.0.end == '192.168.0.8'
|
|
|
|
- name: Delete subnet {{ subnet_name }}
|
|
openstack.cloud.subnet:
|
|
cloud: "{{ cloud }}"
|
|
name: "{{ subnet_name }}"
|
|
state: absent
|
|
|
|
- name: Delete network {{ network_name }}
|
|
openstack.cloud.network:
|
|
cloud: "{{ cloud }}"
|
|
name: "{{ network_name }}"
|
|
state: absent
|