Skip to content

Commit

Permalink
fixed lab dns problem
Browse files Browse the repository at this point in the history
  • Loading branch information
mukrishn committed Mar 22, 2024
1 parent 2a2d055 commit ce8d718
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 23 deletions.
33 changes: 30 additions & 3 deletions ansible-ipi-install/roles/bootstrap/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,43 +30,70 @@ scale:
1029p:
pub_nic: eno1
prov_nic: ens2f1
bm_nic: ens2f2
bm_nic_2: ens2f3
1029u:
pub_nic: eno1
bm_nic: ens2f0
bm_nic_2: ens2f1
6048r:
pub_nic: eno1
prov_nic: ens4s0f1
bm_nic: enp131s0f0
bm_nic_2: enp131s0f1
5039ms:
pub_nic: enp2s0f0
prov_nic: enp1s0f1
bm_nic: enp2s0f1
6049p:
pub_nic: ens5f0
prov_nic: ens3f1
bm_nic: ens2f0
bm_nic_2: ens2f0
6018r:
pub_nic: eno1
prov_nic: enp4s0f1
bm_nic: enp4s0f2
bm_nic_2: enp4s0f3
dell:
r620:
pub_nic: eno3
prov_nic: enp66s0f3
bm_nic: eno1
bm_nic_2: eno2
r630:
pub_nic: enp3s0f0
prov_nic: eno2
bm_nic: eno3
bm_nic_2: eno4
r730xd:
pub_nic: em3
prov_nic: em2
r720xd:
pub_nic: em3
prov_nic: p4p2
bm_nic: enp130s0f0
bm_nic_2: enp130s0f1
r750xd:
pub_nic: eno12399np0
prov_nic: ens3f1
bm_nic: ens6f0
bm_nic_2: ens6f1
r930:
pub_nic: em3
prov_nic: eno2
bm_nic: enp10s0f0
bm_nic_2: enp10s0f1
fc640:
pub_nic: eno1
prov_nic: ens2f0
bm_nic: ens2f1
bm_nic_2: eth1
r640:
pub_nic: eno1np0
prov_nic: ens1f1
bm_nic: ens2f0np0
bm_nic_2: eno2np1
prov_nic_f18: ens3f1
r650:
pub_nic: eno12399np0
prov_nic: ens1f1
bm_nic: ens2f0
bm_nic_2: eno12409np1
19 changes: 12 additions & 7 deletions ansible-ipi-install/roles/bootstrap/tasks/55_add_ocp_masters.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
- name: add masters to inventory file
add_host:
hostname: "master-{{ item }}"
name: master-{{ item }}
hostname: "master-{{ node_index }}"
name: master-{{ node_index }}
groups: masters
role: master
ipmi_user: "{{ lab_ipmi_user }}"
ipmi_password: "{{ lab_ipmi_password }}"
ipmi_address: "{{ master_mgmts[item | int] }}"
ipmi_user: "{{ node_item.pm_user }}"
ipmi_password: "{{ node_item.pm_password }}"
ipmi_address: "{{ node_item.pm_addr }}"
ipmi_port: 623
provision_mac: "{{ master_prov_macs[item | int] }}"
provision_mac: "{{ node_item.prov_mac }}"
provision_nic: "{{ node_item.prov_nic }}"
baremetal_nic: "{{ node_item.bm_nic }}"
hardware_profile: "default"
poweroff: true
with_sequence: start=0 end=2
loop: "{{ deploying_master_nodes_content }}"
loop_control:
index_var: node_index
loop_var: node_item

19 changes: 12 additions & 7 deletions ansible-ipi-install/roles/bootstrap/tasks/60_add_ocp_workers.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
- name: add workers to inventory file
add_host:
hostname: worker-{{ item }}
name: worker-{{ item }}
hostname: worker-{{ node_index }}
name: worker-{{ node_index }}
groups: workers
role: worker
ipmi_user: "{{ lab_ipmi_user }}"
ipmi_password: "{{ lab_ipmi_password }}"
ipmi_address: "{{ worker_mgmts[item | int] }}"
ipmi_user: "{{ node_item.pm_user }}"
ipmi_password: "{{ node_item.pm_password }}"
ipmi_address: "{{ node_item.pm_addr }}"
ipmi_port: 623
provision_mac: "{{ worker_prov_macs[item | int] }}"
provision_mac: "{{ node_item.prov_mac }}"
provision_nic: "{{ node_item.prov_nic }}"
baremetal_nic: "{{ node_item.bm_nic }}"
hardware_profile: "unknown"
poweroff: true
with_sequence: start=0 end={{ worker_mgmts | length - 1 if worker_mgmts|length > 0 }}
loop: "{{ deploying_worker_nodes_content }}"
loop_control:
index_var: node_index
loop_var: node_item
14 changes: 9 additions & 5 deletions ansible-ipi-install/roles/bootstrap/templates/node_inv.j2
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"nodes": [
{% for key in ocp_node_content| json_query(query) -%}
{% set machine_type = key.pm_addr.split('.')[0].split('-')[4] if lab_name == 'scale' else key.pm_addr.split('.')[0].split('-')[3] -%}
{% if lab_name == 'scale' -%}
{% set vendor = 'supermicro' if machine_type in scale['machine_types']['supermicro'] else 'dell' -%}
{% else -%}
{% set vendor = 'supermicro' if machine_type in alias['machine_types']['supermicro'] else 'dell' -%}
{% endif %}
{
"ext_ip": "{{ extcidrnet | next_nth_usable(loop.index0 + 10 + ip_nth|default(0)|int) }}",
"host_name": {% if node == 'worker' %}"worker{{ '%03d' % (loop.index0 + wrkr_index|default(0)|int) }}-{{ key.pm_addr.split('.')[0].split('-')[4] if lab_name == 'scale' else key.pm_addr.split('.')[0].split('-')[3] }}"{% else %}"master-{{ loop.index0 }}"{% endif %},
{% if routable_api %}
"bm_mac": "{{ key.mac[-1] }}",
{% else %}
"bm_mac": "{{ key.mac[2] }}",
{% endif %}
"bm_mac": {% if routable_api %}"{{ key.mac[-1] }}"{% else %}"{{ key.mac[2] }}"{% endif %},
"bm_nic": {% if routable_api %}"{{ scale['machine_types'][vendor][machine_type]['bm_nic_2'] if lab_name == 'scale' else alias['machine_types'][vendor][machine_type]['bm_nic_2'] }}"{% else %}"{{ scale['machine_types'][vendor][machine_type]['bm_nic'] if lab_name == 'scale' else alias['machine_types'][vendor][machine_type]['bm_nic'] }}"{% endif %},
"prov_nic": {{ scale['machine_types'][vendor][machine_type]['prov_nic'] if lab_name == 'scale' else alias['machine_types'][vendor][machine_type]['prov_nic'] }},
"prov_mac": "{{ key.mac[1] }}",
"pm_addr": "{{ key.pm_addr }}",
"pm_password": "{{ key.pm_password }}",
Expand Down
14 changes: 14 additions & 0 deletions ansible-ipi-install/roles/shared-labs-prep/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@
manifest_path: "{{ collection_dir }}/redhatci/ocp/roles/installer/files/openshift/"
customize_extramanifestsopenshift_path: "{{ collection_dir }}/redhatci/ocp/roles/installer/files/openshift/"
customize_extramanifests_path: "{{ collection_dir }}/redhatci/ocp/roles/installer/files/manifests/"
master_network_config_template: "{{ collection_dir }}/redhatci/ocp/roles/installer/files/master_nmstate_file.yaml"
worker_network_config_template: "{{ collection_dir }}/redhatci/ocp/roles/installer/files/worker_nmstate_file.yaml"

- name: Clean up any existing manifest content
file:
Expand Down Expand Up @@ -341,6 +343,18 @@
when:
- sctp | bool

- name: Copy master nmstate file
template:
src: "ocp4-lab.nmstate.conf.j2"
dest: "{{ collection_dir }}/redhatci/ocp/roles/installer/files/{{ node_item }}_nmstate_file.yaml"
mode: 0644
force: true
with_items:
- "master"
- "worker"
loop_control:
loop_var: node_item

delegate_to: localhost

- name: Copy the approve_csr script from the local machine to the remote server
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
interfaces:
{% for nic in disable_nics %}
- name: {{ nic }}
state: down
ipv4:
enabled: false
ipv6:
enabled: false
{% endfor %}
{% raw -%}
- name: {{ provision_nic }}
state: up
type: ethernet
ipv4:
enabled: true
dhcp: true
auto-dns: true
auto-gateway: true
auto-routes: true
ipv6:
enabled: true
autoconf: false
dhcp: false
- name: {{ baremetal_nic }}
state: up
type: ethernet
ipv4:
enabled: true
dhcp: true
auto-dns: true
auto-gateway: true
auto-routes: true
ipv6:
enabled: true
autoconf: false
dhcp: false
{% endraw %}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% for nic in disable_nics %}
ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="{{ nic }}", RUN+="/bin/sh -c 'echo 1 > /sys$DEVPATH/device/remove'"
ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="{{ nic }}", RUN+="/bin/sh -c 'echo 1 > /sys$env{DEVPATH}/device/remove'"
{% endfor %}

0 comments on commit ce8d718

Please sign in to comment.