Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/dictionary/en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ baseimg
baseurl
bashrc
bd
bgp
blockquote
bmaas
bmc
Expand Down
32 changes: 32 additions & 0 deletions hooks/playbooks/adoption_bgp_post_undercloud.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

- name: BGP post_undercloud hook
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: false
tasks:
- name: Remove default route from UC
delegate_to: "{{ _vm }}"
become: true
ansible.builtin.command:
cmd: ip route del default via 192.168.111.1
failed_when: false
loop: >-
{{
_vm_groups['osp-underclouds'] | list
}}
loop_control:
loop_var: _vm
61 changes: 61 additions & 0 deletions hooks/playbooks/adoption_bgp_pre_undercloud.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

- name: BGP pre_undercloud hook
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: false
tasks:
- name: Add default route to UC and OC nodes
delegate_to: "{{ _vm }}"
become: true
ansible.builtin.command:
cmd: ip route add default via 192.168.111.1
loop: >-
{{
_vm_groups['osp-underclouds'] | list +
_vm_groups['osp-r0-computes'] | list +
_vm_groups['osp-r0-controllers'] | list +
_vm_groups['osp-r1-computes'] | list +
_vm_groups['osp-r1-controllers'] | list +
_vm_groups['osp-r2-computes'] | list +
_vm_groups['osp-r2-controllers'] | list
}}
loop_control:
loop_var: _vm
- name: Prefer IPv4 over IPv6 for name resolution
delegate_to: "{{ _vm }}"
become: true
ansible.builtin.lineinfile:
path: /etc/gai.conf
line: 'precedence ::ffff:0:0/96 100'
regexp: '^#?\s*precedence ::ffff:0:0/96' # Matches the line, even if commented
state: present
create: true
owner: root
group: root
mode: '0644'
loop: >-
{{
_vm_groups['osp-underclouds'] | list +
_vm_groups['osp-r0-computes'] | list +
_vm_groups['osp-r0-controllers'] | list +
_vm_groups['osp-r1-computes'] | list +
_vm_groups['osp-r1-controllers'] | list +
_vm_groups['osp-r2-computes'] | list +
_vm_groups['osp-r2-controllers'] | list
}}
loop_control:
loop_var: _vm
69 changes: 69 additions & 0 deletions playbooks/bgp/prepare-bgp-spines-leaves.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,60 @@
---
- name: Start spines and leafs and add them to inventory
hosts: localhost
vars:
leafs_list:
- leaf-0
- leaf-1
- leaf-2
- leaf-3
- leaf-4
- leaf-5
spines_list:
- spine-0
- spine-1
routers_list:
- router-0
fabric_list: "{{ leafs_list + spines_list + routers_list }}"
tasks:
- name: Start spine and leaf VMs
delegate_to: hypervisor
become: true
community.libvirt.virt:
name: "cifmw-{{ item }}"
state: running
loop: "{{ fabric_list }}"

- name: Add leafs group to inventory
when: '"leafs" not in groups'
ansible.builtin.add_host:
name: "{{ item }}.utility"
group: leafs
loop: "{{ leafs_list }}"

- name: Add spines group to inventory
when: '"spines" not in groups'
ansible.builtin.add_host:
name: "{{ item }}.utility"
group: spines
loop: "{{ spines_list }}"

- name: Add routers group to inventory
when: '"routers" not in groups'
ansible.builtin.add_host:
name: "{{ item }}.utility"
group: routers
loop: "{{ routers_list }}"

- name: Check SSH connectivity
delegate_to: hypervisor
ansible.builtin.wait_for:
port: 22
host: "{{ item }}.utility"
search_regex: OpenSSH
delay: 10
timeout: 120
loop: "{{ fabric_list }}"

- name: Common spines and leaves configuration
hosts: "spines,leafs{{ router_bool | default(false) | ternary(',routers', '') }}"
tasks:
Expand Down Expand Up @@ -183,10 +239,13 @@
autoconnect: true
conn_name: "{{ item }}"
type: ethernet
ifname: "{{ router_downlink_ifs[loop_index | int] }}"
method4: disabled
method6: link-local
state: present
loop: "{{ router_downlink_conns }}"
loop_control:
index_var: loop_index

# uplink router IPv4 is configured for both IPv4 and IPv6 jobs
- name: Configure uplink router connections with nmcli when IPv4
Expand Down Expand Up @@ -453,6 +512,8 @@
autoconnect: true
conn_name: "{{ item }}"
ip4: "{{ leaf_ds_ip4 }}/30"
type: ethernet
ifname: "{{ downlink_ifs_rack3[loop_index | int] }}"
method4: manual
method6: link-local
state: present
Expand All @@ -470,6 +531,8 @@
autoconnect: true
conn_name: "{{ item }}"
ip4: "{{ leaf_ds_ip4 }}/30"
type: ethernet
ifname: "{{ leaf_downlink_ifs[loop_index | int] }}"
method4: manual
method6: link-local
state: present
Expand Down Expand Up @@ -513,6 +576,8 @@
conn_name: "{{ item }}"
ip4: "{{ _leaf_ds_ip4 }}/30"
ip6: "{{ _leaf_ds_ip6 }}/126"
type: ethernet
ifname: "{{ leaf_downlink_ifs[loop_index | int] }}"
method4: manual
method6: manual
state: present
Expand Down Expand Up @@ -549,8 +614,12 @@
conn_name: "{{ item }}"
method4: disabled
method6: link-local
type: ethernet
ifname: "{{ uplink_ifs[loop_index | int] }}"
state: present
loop: "{{ uplink_conns }}"
loop_control:
index_var: loop_index

- name: Enable FRR Zebra daemon
become: true
Expand Down
3 changes: 3 additions & 0 deletions roles/adoption_osp_deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ configure the OSP17.1 deployment.
* `cifmw_adoption_osp_deploy_overcloud_extra_args`: (String) The content of a
file which will be used with the -e option in the overcloud deploy command.
This is useful to specify private/restricted parameters.
* `cifmw_adoption_osp_deploy_bgp`: (Boolean) Enable BGP support for the OSP
deployment. When enabled, uses BGP-specific network configurations and
templates. Defaults to `false`.

### Break point

Expand Down
2 changes: 2 additions & 0 deletions roles/adoption_osp_deploy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ cifmw_adoption_osp_deploy_adoption_vars_exclude_nets:
- "{{ cifmw_libvirt_manager_pub_net | default('ocpbm') }}"

cifmw_adoption_osp_deploy_overcloud_extra_args: ''

cifmw_adoption_osp_deploy_bgp: false
10 changes: 10 additions & 0 deletions roles/adoption_osp_deploy/files/bgp-tht-cinder-patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- cinder-api-container-puppet.yaml.bkp 2025-08-29 18:07:23.465927047 +0000
+++ cinder-api-container-puppet.yaml 2025-08-29 18:07:57.061261925 +0000
@@ -434,6 +434,7 @@
- {get_param: RootStackName}
name: "{{ item.service_name }}"
service_type: "{{ item.service_type }}"
+ timeout: 300
state: absent
loop:
- {service_name: cinderv2, service_type: volumev2}
14 changes: 14 additions & 0 deletions roles/adoption_osp_deploy/files/bgp-tht-frr-patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/deployment/frr/frr-container-ansible.yaml
+++ b/deployment/frr/frr-container-ansible.yaml
@@ -327,6 +327,11 @@ outputs:
- name: Wait to give FRR time to converge
wait_for:
timeout: {get_param: FrrConvergeTimeout}
+ - name: Remove temporary route
+ become: true
+ ansible.builtin.shell: |
+ sudo ip r del default
+ changed_when: false
update_tasks:
- name: Update FRR
when:
9 changes: 9 additions & 0 deletions roles/adoption_osp_deploy/tasks/config_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@
register: _original_config_download
delegate_to: "localhost"

- name: Copy config download file as is (bgp)
when: cifmw_adoption_osp_deploy_bgp | bool
delegate_to: "osp-undercloud-0"
ansible.builtin.copy:
content: "{{ _original_config_download['content'] |b64decode | from_yaml | to_nice_yaml(indent=2, sort_keys=false) }}"
dest: "{{ ansible_user_dir }}/config_download_{{ _stack.stackname }}.yaml"
mode: "0644"

- name: Generate config download file
when: not (cifmw_adoption_osp_deploy_bgp | bool)
vars:
_ctlplane_net: "{{ cifmw_networking_env_definition.networks.ctlplane }}"
_hostname_map_translation: >-
Expand Down
20 changes: 20 additions & 0 deletions roles/adoption_osp_deploy/tasks/generate_adoption_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- user_dir

- name: Generate adoption vars file
when: not (cifmw_adoption_osp_deploy_bgp | bool)
delegate_to: "controller-0"
vars:
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
Expand All @@ -44,3 +45,22 @@
src: "adoption_vars.yaml.j2"
dest: "{{ ansible_user_dir }}/adoption_vars.yaml"
mode: "0644"


- name: Generate adoption vars file (BGP)
when: cifmw_adoption_osp_deploy_bgp | bool
delegate_to: "controller-0"
vars:
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
_undercloud_net: "{{ cifmw_networking_env_definition.instances[_undercloud_name] }}"
_undercloud_ip: "{{ _undercloud_net.networks.ctlplaner0[ip_version|default('ip_v4')] }}"
_controller_1_name: "{{ _vm_groups['osp-r0-controllers'] | first }}"
_controller_1_net: "{{ cifmw_networking_env_definition.instances[_controller_1_name] }}"
_controller_1_internalapi_ip: "99.99.0.9"
_compute_1_name: "{{ _vm_groups['osp-r0-computes'] | first }}"
_compute_1_net: "{{ cifmw_networking_env_definition.instances[_compute_1_name] }}"
_compute_1_ip: "{{ _compute_1_net.networks.ctlplaner0[ip_version|default('ip_v4')] }}"
ansible.builtin.template:
src: "adoption_vars_bgp.yaml.j2"
dest: "{{ ansible_user_dir }}/adoption_vars.yaml"
mode: "0644"
Loading
Loading