Skip to content

Commit c06bd89

Browse files
committed
[adoption_osp_deploy] Add BGP support to adoption OSP deployment
This commit adds BGP networking support to the adoption OSP deployment role, including BGP-specific templates, patches, and configuration files for undercloud and overcloud deployments. Signed-off-by: Eduardo Olivares <[email protected]>
1 parent 5d93644 commit c06bd89

14 files changed

+707
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
# Copyright Red Hat, Inc.
3+
# All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License. You may obtain
7+
# a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
17+
- name: BGP post_undercloud hook
18+
hosts: "{{ cifmw_target_host | default('localhost') }}"
19+
gather_facts: false
20+
tasks:
21+
- name: Remove default route from UC
22+
delegate_to: "{{ _vm }}"
23+
become: true
24+
ansible.builtin.command:
25+
cmd: ip route del default via 192.168.111.1
26+
failed_when: false
27+
loop: >-
28+
{{
29+
_vm_groups['osp-underclouds'] | list
30+
}}
31+
loop_control:
32+
loop_var: _vm
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
# Copyright Red Hat, Inc.
3+
# All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License. You may obtain
7+
# a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
17+
- name: BGP pre_undercloud hook
18+
hosts: "{{ cifmw_target_host | default('localhost') }}"
19+
gather_facts: false
20+
tasks:
21+
- name: Add default route to UC and OC nodes
22+
delegate_to: "{{ _vm }}"
23+
become: true
24+
ansible.builtin.command:
25+
cmd: ip route add default via 192.168.111.1
26+
loop: >-
27+
{{
28+
_vm_groups['osp-underclouds'] | list +
29+
_vm_groups['osp-r0-computes'] | list +
30+
_vm_groups['osp-r0-controllers'] | list +
31+
_vm_groups['osp-r1-computes'] | list +
32+
_vm_groups['osp-r1-controllers'] | list +
33+
_vm_groups['osp-r2-computes'] | list +
34+
_vm_groups['osp-r2-controllers'] | list
35+
}}
36+
loop_control:
37+
loop_var: _vm
38+
- name: Prefer IPv4 over IPv6 for name resolution
39+
delegate_to: "{{ _vm }}"
40+
become: true
41+
ansible.builtin.lineinfile:
42+
path: /etc/gai.conf
43+
line: 'precedence ::ffff:0:0/96 100'
44+
regexp: '^#?\s*precedence ::ffff:0:0/96' # Matches the line, even if commented
45+
state: present
46+
create: true
47+
owner: root
48+
group: root
49+
mode: '0644'
50+
loop: >-
51+
{{
52+
_vm_groups['osp-underclouds'] | list +
53+
_vm_groups['osp-r0-computes'] | list +
54+
_vm_groups['osp-r0-controllers'] | list +
55+
_vm_groups['osp-r1-computes'] | list +
56+
_vm_groups['osp-r1-controllers'] | list +
57+
_vm_groups['osp-r2-computes'] | list +
58+
_vm_groups['osp-r2-controllers'] | list
59+
}}
60+
loop_control:
61+
loop_var: _vm

roles/adoption_osp_deploy/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ configure the OSP17.1 deployment.
2828
* `cifmw_adoption_osp_deploy_overcloud_extra_args`: (String) The content of a
2929
file which will be used with the -e option in the overcloud deploy command.
3030
This is useful to specify private/restricted parameters.
31+
* `cifmw_adoption_osp_deploy_bgp`: (Boolean) Enable BGP support for the OSP
32+
deployment. When enabled, uses BGP-specific network configurations and
33+
templates. Defaults to `false`.
3134

3235
### Break point
3336

roles/adoption_osp_deploy/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ cifmw_adoption_osp_deploy_adoption_vars_exclude_nets:
3030
- "{{ cifmw_libvirt_manager_pub_net | default('ocpbm') }}"
3131

3232
cifmw_adoption_osp_deploy_overcloud_extra_args: ''
33+
34+
cifmw_adoption_osp_deploy_bgp: false
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- cinder-api-container-puppet.yaml.bkp 2025-08-29 18:07:23.465927047 +0000
2+
+++ cinder-api-container-puppet.yaml 2025-08-29 18:07:57.061261925 +0000
3+
@@ -434,6 +434,7 @@
4+
- {get_param: RootStackName}
5+
name: "{{ item.service_name }}"
6+
service_type: "{{ item.service_type }}"
7+
+ timeout: 300
8+
state: absent
9+
loop:
10+
- {service_name: cinderv2, service_type: volumev2}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--- a/deployment/frr/frr-container-ansible.yaml
2+
+++ b/deployment/frr/frr-container-ansible.yaml
3+
@@ -327,6 +327,11 @@ outputs:
4+
- name: Wait to give FRR time to converge
5+
wait_for:
6+
timeout: {get_param: FrrConvergeTimeout}
7+
+ - name: Remove temporary route
8+
+ become: true
9+
+ ansible.builtin.shell: |
10+
+ sudo ip r del default
11+
+ changed_when: false
12+
update_tasks:
13+
- name: Update FRR
14+
when:

roles/adoption_osp_deploy/tasks/config_files.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,16 @@
3434
register: _original_config_download
3535
delegate_to: "localhost"
3636

37+
- name: Copy config download file as is (bgp)
38+
when: cifmw_adoption_osp_deploy_bgp | bool
39+
delegate_to: "osp-undercloud-0"
40+
ansible.builtin.copy:
41+
content: "{{ _original_config_download['content'] |b64decode | from_yaml | to_nice_yaml(indent=2, sort_keys=false) }}"
42+
dest: "{{ ansible_user_dir }}/config_download_{{ _stack.stackname }}.yaml"
43+
mode: "0644"
44+
3745
- name: Generate config download file
46+
when: not (cifmw_adoption_osp_deploy_bgp | bool)
3847
vars:
3948
_ctlplane_net: "{{ cifmw_networking_env_definition.networks.ctlplane }}"
4049
_hostname_map_translation: >-

roles/adoption_osp_deploy/tasks/generate_adoption_vars.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- user_dir
2323

2424
- name: Generate adoption vars file
25+
when: not (cifmw_adoption_osp_deploy_bgp | bool)
2526
delegate_to: "controller-0"
2627
vars:
2728
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
@@ -44,3 +45,22 @@
4445
src: "adoption_vars.yaml.j2"
4546
dest: "{{ ansible_user_dir }}/adoption_vars.yaml"
4647
mode: "0644"
48+
49+
50+
- name: Generate adoption vars file (BGP)
51+
when: cifmw_adoption_osp_deploy_bgp | bool
52+
delegate_to: "controller-0"
53+
vars:
54+
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
55+
_undercloud_net: "{{ cifmw_networking_env_definition.instances[_undercloud_name] }}"
56+
_undercloud_ip: "{{ _undercloud_net.networks.ctlplaner0[ip_version|default('ip_v4')] }}"
57+
_controller_1_name: "{{ _vm_groups['osp-r0-controllers'] | first }}"
58+
_controller_1_net: "{{ cifmw_networking_env_definition.instances[_controller_1_name] }}"
59+
_controller_1_internalapi_ip: "99.99.0.9"
60+
_compute_1_name: "{{ _vm_groups['osp-r0-computes'] | first }}"
61+
_compute_1_net: "{{ cifmw_networking_env_definition.instances[_compute_1_name] }}"
62+
_compute_1_ip: "{{ _compute_1_net.networks.ctlplaner0[ip_version|default('ip_v4')] }}"
63+
ansible.builtin.template:
64+
src: "adoption_vars_bgp.yaml.j2"
65+
dest: "{{ ansible_user_dir }}/adoption_vars.yaml"
66+
mode: "0644"

roles/adoption_osp_deploy/tasks/prepare_overcloud.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,21 @@
137137
script: "{{ _source_cmd }}; {{ _vip_provision_cmd }}"
138138

139139
- name: Create tripleo ansible inventory
140+
when: not (cifmw_adoption_osp_deploy_bgp | bool)
140141
delegate_to: "osp-undercloud-0"
141142
ansible.builtin.template:
142143
src: "tripleo-ansible-inventory.yaml.j2"
143144
dest: "{{ ansible_user_dir }}/overcloud-deploy/{{ _overcloud_name }}/tripleo-ansible-inventory.yaml"
144145
mode: "0644"
145146

147+
- name: Create tripleo ansible inventory (BGP)
148+
when: cifmw_adoption_osp_deploy_bgp | bool
149+
delegate_to: "osp-undercloud-0"
150+
ansible.builtin.template:
151+
src: "tripleo-ansible-inventory_bgp.yaml.j2"
152+
dest: "{{ ansible_user_dir }}/overcloud-deploy/{{ _overcloud_name }}/tripleo-ansible-inventory.yaml"
153+
mode: "0644"
154+
146155
- name: Ensure os-net-config and openvswitch is installed in overcloud nodes
147156
become: true
148157
delegate_to: "{{ overcloud_vm }}"
@@ -184,6 +193,78 @@
184193
loop: "{{ _tripleo_nodes_stack[_overcloud_name] }}"
185194
loop_control:
186195
loop_var: overcloud_vm
196+
when: not (cifmw_adoption_osp_deploy_bgp | bool)
197+
198+
- name: Generate os-net-config file for overcloud nodes (bgp)
199+
become: true
200+
delegate_to: "{{ overcloud_vm }}"
201+
vars:
202+
_node_net: "{{ cifmw_networking_env_definition.instances[overcloud_vm] }}"
203+
_dns_server: "{{ _ctlplane_net.[dns_version|default('dns_v4')] }}"
204+
_interface_mtu: 1500
205+
vms:
206+
osp-r0-compute-0:
207+
ctlplane: '192.168.122.100'
208+
left: '100.64.0.2'
209+
right: '100.65.0.2'
210+
main: '99.99.0.7'
211+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0004'
212+
osp-r0-compute-1:
213+
ctlplane: '192.168.122.101'
214+
left: '100.64.0.6'
215+
right: '100.65.0.6'
216+
main: '99.99.0.8'
217+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0005'
218+
osp-r1-compute-0:
219+
ctlplane: '192.168.123.105'
220+
left: '100.64.1.2'
221+
right: '100.65.1.2'
222+
main: '99.99.1.7'
223+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0006'
224+
osp-r1-compute-1:
225+
ctlplane: '192.168.123.106'
226+
left: '100.64.1.6'
227+
right: '100.65.1.6'
228+
main: '99.99.1.8'
229+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0007'
230+
osp-r2-compute-0:
231+
ctlplane: '192.168.124.110'
232+
left: '100.64.2.2'
233+
right: '100.65.2.2'
234+
main: '99.99.2.7'
235+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0008'
236+
osp-r2-compute-1:
237+
ctlplane: '192.168.124.111'
238+
left: '100.64.2.6'
239+
right: '100.65.2.6'
240+
main: '99.99.2.8'
241+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0009'
242+
osp-r0-controller-0:
243+
ctlplane: '192.168.122.140'
244+
left: '100.64.0.26'
245+
right: '100.65.0.26'
246+
main: '99.99.0.9'
247+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0001'
248+
osp-r1-controller-0:
249+
ctlplane: '192.168.123.142'
250+
left: '100.64.1.26'
251+
right: '100.65.1.26'
252+
main: '99.99.1.9'
253+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0002'
254+
osp-r2-controller-0:
255+
ctlplane: '192.168.124.144'
256+
left: '100.64.2.26'
257+
right: '100.65.2.26'
258+
main: '99.99.2.9'
259+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0003'
260+
ansible.builtin.template:
261+
src: "os_net_config_overcloud_bgp.yml.j2"
262+
dest: /etc/os-net-config/tripleo_config.yaml
263+
mode: "0644"
264+
loop: "{{ _tripleo_nodes_stack[_overcloud_name] }}"
265+
loop_control:
266+
loop_var: overcloud_vm
267+
when: cifmw_adoption_osp_deploy_bgp | bool
187268

188269
- name: Configure network interfaces for overcloud nodes
189270
become: true
@@ -208,3 +289,24 @@
208289
loop: "{{ _tripleo_nodes_stack[_overcloud_name] }}"
209290
loop_control:
210291
loop_var: overcloud_vm
292+
293+
- name: Apply patch to increase cinder-api timeout (bgp)
294+
when: cifmw_adoption_osp_deploy_bgp | bool
295+
delegate_to: "osp-undercloud-0"
296+
become: true
297+
block:
298+
- name: Ensure patch package is installed in undercloud
299+
ansible.builtin.dnf:
300+
name: patch
301+
state: present
302+
303+
- name: BGP workaround apply patch
304+
ansible.posix.patch:
305+
src: "{{ item.patch_file }}"
306+
dest: "{{ item.dest_file }}"
307+
strip: 1
308+
loop:
309+
- patch_file: files/bgp-tht-cinder-patch
310+
dest_file: /usr/share/openstack-tripleo-heat-templates/deployment/cinder/cinder-api-container-puppet.yaml
311+
- patch_file: files/bgp-tht-frr-patch
312+
dest_file: /usr/share/openstack-tripleo-heat-templates/deployment/frr/frr-container-ansible.yaml

roles/adoption_osp_deploy/tasks/prepare_undercloud.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
openstack tripleo container image prepare
6060
default --output-env-file
6161
{{ ansible_user_dir }}/containers-prepare-parameters.yaml
62+
{% if cifmw_adoption_osp_deploy_scenario.container_prepare_local_push_dest | default(false) | bool %}
63+
--local-push-destination
64+
{% endif %}
6265
cifmw.general.ci_script:
6366
output_dir: "{{ cifmw_basedir }}/artifacts"
6467
script: "{{ _container_prepare_cmd }}"
@@ -106,6 +109,7 @@
106109
mode: '0755'
107110

108111
- name: Generate os-net-config file
112+
when: not (cifmw_adoption_osp_deploy_bgp | bool)
109113
become: true
110114
vars:
111115
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
@@ -122,6 +126,24 @@
122126
dest: /etc/os-net-config/tripleo_config.yaml
123127
mode: "0644"
124128

129+
- name: Generate os-net-config file (bgp)
130+
when: cifmw_adoption_osp_deploy_bgp | bool
131+
become: true
132+
vars:
133+
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
134+
_undercloud_net: "{{ cifmw_networking_env_definition.instances[_undercloud_name] }}"
135+
_ctlplane_ip: "{{ _undercloud_net.networks.ctlplaner0[ip_version|default('ip_v4')] }}"
136+
_ctlplane_vip: "{{ cifmw_adoption_osp_deploy_scenario.undercloud.ctlplane_vip }}"
137+
_ctlplane_net: "{{ cifmw_networking_env_definition.networks.ctlplaner0}}"
138+
_dns_server: "{{ _ctlplane_net[dns_version|default('dns_v4')] }}"
139+
_gateway_ip: "{{ _ctlplane_net[gw_version|default('gw_v4')] }}"
140+
_interface_mtu: "{{ _undercloud_net.networks.ctlplaner0.mtu }}"
141+
_ctlplane_cidr: "{{ _undercloud_net.networks.ctlplaner0[prefix_length_version|default('prefix_length_v4')] }}"
142+
ansible.builtin.template:
143+
src: "os_net_config_undercloud_bgp.yml.j2"
144+
dest: /etc/os-net-config/tripleo_config.yaml
145+
mode: "0644"
146+
125147
- name: Copy undercloud.conf file to location to edit it
126148
ansible.builtin.copy:
127149
src: "/usr/share/python-tripleoclient/undercloud.conf.sample"
@@ -130,6 +152,7 @@
130152
mode: "0644"
131153

132154
- name: Add environment specific vars for undercloud
155+
when: not (cifmw_adoption_osp_deploy_bgp | bool)
133156
vars:
134157
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
135158
_undercloud_net: "{{ cifmw_networking_env_definition.instances[_undercloud_name] }}"
@@ -185,6 +208,33 @@
185208
combine(_env_undercloud, recursive=true, list_merge="append_rp")
186209
}}
187210
211+
- name: Add environment specific vars for undercloud (bgp)
212+
when: cifmw_adoption_osp_deploy_bgp | bool
213+
vars:
214+
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
215+
_undercloud_net: "{{ cifmw_networking_env_definition.instances[_undercloud_name] }}"
216+
_undercloud_ip: "{{ _undercloud_net.networks.ctlplaner0[ip_version|default('ip_v4')] }}"
217+
_undercloud_net_prefix: "{{ _undercloud_net.networks.ctlplaner0[prefix_length_version|default('prefix_length_v4')] }}"
218+
_ctlplane_cidr: "{{ cifmw_networking_env_definition.networks.ctlplaner0[network_version|default('network_v4')] }}"
219+
_interface_mtu: "{{ _undercloud_net.networks.ctlplaner0.mtu }}"
220+
_env_undercloud:
221+
config:
222+
- section: DEFAULT
223+
option: undercloud_ntp_servers
224+
value: "{{ cifmw_adoption_osp_deploy_ntp_server }}"
225+
- section: DEFAULT
226+
option: container_images_file
227+
value: "{{ ansible_user_dir }}/containers-prepare-parameters.yaml"
228+
- section: DEFAULT
229+
option: net_config_override
230+
value: "/etc/os-net-config/tripleo_config.yaml"
231+
ansible.builtin.set_fact:
232+
_undercloud_conf: >-
233+
{{
234+
cifmw_adoption_osp_deploy_scenario.undercloud |
235+
combine(_env_undercloud, recursive=true, list_merge="append_rp")
236+
}}
237+
188238
- name: Copy undercloud overrides file if present and amend undercloud conf
189239
when: cifmw_adoption_osp_deploy_scenario.undercloud.undercloud_parameters_override is defined
190240
vars:

0 commit comments

Comments
 (0)