Skip to content

Commit 0072df7

Browse files
committed
Add bgp-l3-xl-adoption job
1 parent a57402f commit 0072df7

File tree

14 files changed

+1449
-4
lines changed

14 files changed

+1449
-4
lines changed

common-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ kubernetes-validate==1.31.0
55
openstacksdk==4.1.0
66
jsonschema==4.23.0
77
pyOpenSSL==24.2.1
8+
dnspython==2.7.0 # required by community.general.dig
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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: Install bind-utils
22+
become: true
23+
delegate_to: osp-undercloud-0
24+
ansible.builtin.dnf:
25+
name: bind-utils
26+
state: present
27+
28+
- name: Add routes to registry to undercloud
29+
delegate_to: osp-undercloud-0
30+
ansible.builtin.shell:
31+
cmd: |
32+
set -e -o pipefail
33+
for IP in $(host registry.redhat.io | awk '/has address/ {print $NF}'); do
34+
if [ "$(ip route show ${IP}/32)" == "" ]; then
35+
sudo ip route add ${IP}/32 via 192.168.111.1
36+
fi
37+
done

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: bgp
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 bgp
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 bgp
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: bgp
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.29"
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: 85 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 bgp
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: bgp
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,82 @@
184193
loop: "{{ _tripleo_nodes_stack[_overcloud_name] }}"
185194
loop_control:
186195
loop_var: overcloud_vm
196+
when: not bgp
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+
_registry_ips: "{{ lookup('community.general.dig', 'registry.redhat.io', wantlist=true) | list }}"
206+
_cdn_ips: "{{ lookup('community.general.dig', 'cdn.redhat.com', wantlist=true) | list }}"
207+
_access_ips: "{{ lookup('community.general.dig', 'access.redhat.com', wantlist=true) | list }}"
208+
_cdn01_ips: "{{ lookup('community.general.dig', 'cdn01.quay.io', wantlist=true) | list }}"
209+
vms:
210+
osp-r0-compute-0:
211+
ctlplane: '192.168.122.100'
212+
left: '100.64.0.2'
213+
right: '100.65.0.2'
214+
main: '99.99.0.2'
215+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0004'
216+
osp-r0-compute-1:
217+
ctlplane: '192.168.122.101'
218+
left: '100.64.0.6'
219+
right: '100.65.0.6'
220+
main: '99.99.0.6'
221+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0005'
222+
osp-r1-compute-0:
223+
ctlplane: '192.168.123.105'
224+
left: '100.64.1.2'
225+
right: '100.65.1.2'
226+
main: '99.99.1.2'
227+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0006'
228+
osp-r1-compute-1:
229+
ctlplane: '192.168.123.106'
230+
left: '100.64.1.6'
231+
right: '100.65.1.6'
232+
main: '99.99.1.6'
233+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0007'
234+
osp-r2-compute-0:
235+
ctlplane: '192.168.124.110'
236+
left: '100.64.2.2'
237+
right: '100.65.2.2'
238+
main: '99.99.2.2'
239+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0008'
240+
osp-r2-compute-1:
241+
ctlplane: '192.168.124.111'
242+
left: '100.64.2.6'
243+
right: '100.65.2.6'
244+
main: '99.99.2.6'
245+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0009'
246+
osp-r0-controller-0:
247+
ctlplane: '192.168.122.140'
248+
left: '100.64.0.30'
249+
right: '100.65.0.30'
250+
main: '99.99.0.29'
251+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0001'
252+
osp-r1-controller-0:
253+
ctlplane: '192.168.123.142'
254+
left: '100.64.1.30'
255+
right: '100.65.1.30'
256+
main: '99.99.1.29'
257+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0002'
258+
osp-r2-controller-0:
259+
ctlplane: '192.168.124.144'
260+
left: '100.64.2.30'
261+
right: '100.65.2.30'
262+
main: '99.99.2.29'
263+
main6: 'f00d:f00d:f00d:f00d:f00d:f00d:f00d:0003'
264+
ansible.builtin.template:
265+
src: "os_net_config_overcloud_bgp.yml.j2"
266+
dest: /etc/os-net-config/tripleo_config.yaml
267+
mode: "0644"
268+
loop: "{{ _tripleo_nodes_stack }}"
269+
loop_control:
270+
loop_var: overcloud_vm
271+
when: bgp
187272

188273
- name: Configure network interfaces for overcloud nodes
189274
become: true

roles/adoption_osp_deploy/tasks/prepare_undercloud.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
mode: '0755'
9797

9898
- name: Generate os-net-config file
99+
when: not bgp
99100
become: true
100101
vars:
101102
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
@@ -112,6 +113,28 @@
112113
dest: /etc/os-net-config/tripleo_config.yaml
113114
mode: "0644"
114115

116+
- name: Generate os-net-config file (bgp)
117+
when: bgp
118+
become: true
119+
vars:
120+
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
121+
_undercloud_net: "{{ cifmw_networking_env_definition.instances[_undercloud_name] }}"
122+
_ctlplane_ip: "{{ _undercloud_net.networks.ctlplaner0[ip_version|default('ip_v4')] }}"
123+
_ctlplane_vip: "{{ cifmw_adoption_osp_deploy_scenario.undercloud.ctlplane_vip }}"
124+
_ctlplane_net: "{{ cifmw_networking_env_definition.networks.ctlplaner0}}"
125+
_dns_server: "{{ _ctlplane_net[dns_version|default('dns_v4')] }}"
126+
_gateway_ip: "{{ _ctlplane_net[gw_version|default('gw_v4')] }}"
127+
_interface_mtu: "{{ _undercloud_net.networks.ctlplaner0.mtu }}"
128+
_ctlplane_cidr: "{{ _undercloud_net.networks.ctlplaner0[prefix_length_version|default('prefix_length_v4')] }}"
129+
_registry_ips: "{{ lookup('community.general.dig', 'registry.redhat.io', wantlist=true) | list }}"
130+
_cdn_ips: "{{ lookup('community.general.dig', 'cdn.redhat.com', wantlist=true) | list }}"
131+
_access_ips: "{{ lookup('community.general.dig', 'access.redhat.com', wantlist=true) | list }}"
132+
_cdn01_ips: "{{ lookup('community.general.dig', 'cdn01.quay.io', wantlist=true) | list }}"
133+
ansible.builtin.template:
134+
src: "os_net_config_undercloud_bgp.yml.j2"
135+
dest: /etc/os-net-config/tripleo_config.yaml
136+
mode: "0644"
137+
115138
- name: Copy undercloud.conf file to location to edit it
116139
ansible.builtin.copy:
117140
src: "/usr/share/python-tripleoclient/undercloud.conf.sample"
@@ -120,6 +143,7 @@
120143
mode: "0644"
121144

122145
- name: Add environment specific vars for undercloud
146+
when: not bgp
123147
vars:
124148
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
125149
_undercloud_net: "{{ cifmw_networking_env_definition.instances[_undercloud_name] }}"
@@ -175,6 +199,33 @@
175199
combine(_env_undercloud, recursive=true, list_merge="append_rp")
176200
}}
177201
202+
- name: Add environment specific vars for undercloud (bgp)
203+
when: bgp
204+
vars:
205+
_undercloud_name: "{{ _vm_groups['osp-underclouds'] | first }}"
206+
_undercloud_net: "{{ cifmw_networking_env_definition.instances[_undercloud_name] }}"
207+
_undercloud_ip: "{{ _undercloud_net.networks.ctlplaner0[ip_version|default('ip_v4')] }}"
208+
_undercloud_net_prefix: "{{ _undercloud_net.networks.ctlplaner0[prefix_length_version|default('prefix_length_v4')] }}"
209+
_ctlplane_cidr: "{{ cifmw_networking_env_definition.networks.ctlplaner0[network_version|default('network_v4')] }}"
210+
_interface_mtu: "{{ _undercloud_net.networks.ctlplaner0.mtu }}"
211+
_env_undercloud:
212+
config:
213+
- section: DEFAULT
214+
option: undercloud_ntp_servers
215+
value: "{{ cifmw_adoption_osp_deploy_ntp_server }}"
216+
- section: DEFAULT
217+
option: container_images_file
218+
value: "{{ ansible_user_dir }}/containers-prepare-parameters.yaml"
219+
- section: DEFAULT
220+
option: net_config_override
221+
value: "/etc/os-net-config/tripleo_config.yaml"
222+
ansible.builtin.set_fact:
223+
_undercloud_conf: >-
224+
{{
225+
cifmw_adoption_osp_deploy_scenario.undercloud |
226+
combine(_env_undercloud, recursive=true, list_merge="append_rp")
227+
}}
228+
178229
- name: Copy undercloud overrides file if present and amend undercloud conf
179230
when: cifmw_adoption_osp_deploy_scenario.undercloud.undercloud_parameters_override is defined
180231
vars:

0 commit comments

Comments
 (0)