Skip to content

Commit 69da205

Browse files
committed
different DNS servers per rack
1 parent e17c629 commit 69da205

File tree

5 files changed

+73
-13
lines changed

5 files changed

+73
-13
lines changed

playbooks/bgp/prepare-bgp-spines-leaves.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,13 @@
239239
autoconnect: true
240240
conn_name: "{{ item }}"
241241
type: ethernet
242+
ifname: "{{ router_downlink_ifs[loop_index | int] }}"
242243
method4: disabled
243244
method6: link-local
244245
state: present
245246
loop: "{{ router_downlink_conns }}"
247+
loop_control:
248+
index_var: loop_index
246249

247250
# uplink router IPv4 is configured for both IPv4 and IPv6 jobs
248251
- name: Configure uplink router connections with nmcli when IPv4
@@ -509,6 +512,8 @@
509512
autoconnect: true
510513
conn_name: "{{ item }}"
511514
ip4: "{{ leaf_ds_ip4 }}/30"
515+
type: ethernet
516+
ifname: "{{ downlink_ifs_rack3[loop_index | int] }}"
512517
method4: manual
513518
method6: link-local
514519
state: present
@@ -526,6 +531,8 @@
526531
autoconnect: true
527532
conn_name: "{{ item }}"
528533
ip4: "{{ leaf_ds_ip4 }}/30"
534+
type: ethernet
535+
ifname: "{{ leaf_downlink_ifs[loop_index | int] }}"
529536
method4: manual
530537
method6: link-local
531538
state: present
@@ -569,6 +576,8 @@
569576
conn_name: "{{ item }}"
570577
ip4: "{{ _leaf_ds_ip4 }}/30"
571578
ip6: "{{ _leaf_ds_ip6 }}/126"
579+
type: ethernet
580+
ifname: "{{ leaf_downlink_ifs[loop_index | int] }}"
572581
method4: manual
573582
method6: manual
574583
state: present
@@ -605,8 +614,12 @@
605614
conn_name: "{{ item }}"
606615
method4: disabled
607616
method6: link-local
617+
type: ethernet
618+
ifname: "{{ uplink_ifs[loop_index | int] }}"
608619
state: present
609620
loop: "{{ uplink_conns }}"
621+
loop_control:
622+
index_var: loop_index
610623

611624
- name: Enable FRR Zebra daemon
612625
become: true

roles/adoption_osp_deploy/tasks/prepare_overcloud.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,37 @@
195195
loop_var: overcloud_vm
196196
when: not bgp
197197

198+
- name: Obtain IPs whose routes need to be added to the undercloud (bgp)
199+
when: bgp
200+
delegate_to: "{{ overcloud_vm }}"
201+
ansible.builtin.getent:
202+
database: ahosts
203+
key: "{{ item }}"
204+
register: _ips_for_oc_routes_getent
205+
loop:
206+
- registry.redhat.io
207+
- cdn.redhat.com
208+
- access.redhat.com
209+
- cdn01.quay.io
210+
198211
- name: Generate os-net-config file for overcloud nodes (bgp)
199212
become: true
200213
delegate_to: "{{ overcloud_vm }}"
201214
vars:
202215
_node_net: "{{ cifmw_networking_env_definition.instances[overcloud_vm] }}"
203216
_dns_server: "{{ _ctlplane_net.[dns_version|default('dns_v4')] }}"
204217
_interface_mtu: 1500
218+
_ips_for_oc_routes_list: >-
219+
{{
220+
_ips_for_oc_routes_getent.results |
221+
map(attribute='ansible_facts.getent_ahosts') |
222+
map('dict2items') |
223+
flatten |
224+
map(attribute='key') |
225+
reject('match', '.*:.*') |
226+
list |
227+
unique
228+
}}
205229
vms:
206230
osp-r0-compute-0:
207231
ctlplane: '192.168.122.100'

roles/adoption_osp_deploy/tasks/prepare_undercloud.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,16 @@
125125

126126
- name: Obtain IPs whose routes need to be added to the undercloud (bgp)
127127
when: bgp
128-
ansible.builtin.shell: |
129-
getent ahosts {{ item }} | grep STREAM | awk '{print $1}' | grep -v :
130-
register: _ips_for_uc_routes_output
128+
ansible.builtin.getent:
129+
database: ahosts
130+
key: "{{ item }}"
131+
register: _ips_for_uc_routes_getent
131132
loop:
132133
- registry.redhat.io
133134
- cdn.redhat.com
134135
- access.redhat.com
135136
- cdn01.quay.io
136137

137-
- name: Create list with the previous IPs
138-
when: bgp
139-
ansible.builtin.set_fact:
140-
ips_for_uc_routes_list: "{{ (ips_for_uc_routes_list | default([]) + item.stdout_lines) | ansible.builtin.unique }}"
141-
loop: "{{ _ips_for_uc_routes_output.results }}"
142-
143138
- name: Generate os-net-config file (bgp)
144139
when: bgp
145140
become: true
@@ -153,7 +148,17 @@
153148
_gateway_ip: "{{ _ctlplane_net[gw_version|default('gw_v4')] }}"
154149
_interface_mtu: "{{ _undercloud_net.networks.ctlplaner0.mtu }}"
155150
_ctlplane_cidr: "{{ _undercloud_net.networks.ctlplaner0[prefix_length_version|default('prefix_length_v4')] }}"
156-
_ips_for_uc_routes_list: "{{ ips_for_uc_routes_list }}"
151+
_ips_for_uc_routes_list: >-
152+
{{
153+
_ips_for_uc_routes_getent.results |
154+
map(attribute='ansible_facts.getent_ahosts') |
155+
map('dict2items') |
156+
flatten |
157+
map(attribute='key') |
158+
reject('match', '.*:.*') |
159+
list |
160+
unique
161+
}}
157162
ansible.builtin.template:
158163
src: "os_net_config_undercloud_bgp.yml.j2"
159164
dest: /etc/os-net-config/tripleo_config.yaml

roles/adoption_osp_deploy/templates/os_net_config_overcloud_bgp.yml.j2

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@ network_config:
55
mtu: {{ _interface_mtu }}
66
use_dhcp: true
77
defroute: false
8-
routes: []
8+
routes:
9+
{% for _ip in _ips_for_oc_routes_list %}
10+
- ip_netmask: {{ _ip }}/32
11+
next_hop: 192.168.111.1
12+
{% endfor %}
913
- type: interface
1014
name: nic2
1115
mtu: {{ _interface_mtu }}
16+
{% if 'r0' in overcloud_vm %}
1217
dns_servers: ['192.168.122.1', '192.168.125.1']
18+
{% elif 'r1' in overcloud_vm %}
19+
dns_servers: ['192.168.123.1', '192.168.125.1']
20+
{% else %}
21+
dns_servers: ['192.168.124.1', '192.168.125.1']
22+
{% endif %}
1323
domain: []
1424
routes:
1525
{% if 'r0' in overcloud_vm %}

scenarios/reproducers/bgp-l3-xl.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,11 @@ cifmw_libvirt_manager_configuration:
563563
- "l01-node1"
564564
r1-compute:
565565
amount: 0
566-
root_part_id: "{{ cifmw_root_partition_id }}"
566+
root_part_id: >-
567+
{{
568+
(cifmw_repo_setup_os_release is defined and cifmw_repo_setup_os_release == 'rhel') |
569+
ternary(4, 1)
570+
}}
567571
uefi: "{{ cifmw_use_uefi }}"
568572
image_url: "{{ cifmw_discovered_image_url }}"
569573
sha256_image_name: "{{ cifmw_discovered_hash }}"
@@ -584,7 +588,11 @@ cifmw_libvirt_manager_configuration:
584588
- "l11-node1"
585589
r2-compute:
586590
amount: 0
587-
root_part_id: "{{ cifmw_root_partition_id }}"
591+
root_part_id: >-
592+
{{
593+
(cifmw_repo_setup_os_release is defined and cifmw_repo_setup_os_release == 'rhel') |
594+
ternary(4, 1)
595+
}}
588596
uefi: "{{ cifmw_use_uefi }}"
589597
image_url: "{{ cifmw_discovered_image_url }}"
590598
sha256_image_name: "{{ cifmw_discovered_hash }}"

0 commit comments

Comments
 (0)