Skip to content

Commit

Permalink
Allow the default VM nic to be adjusted for all ACM/ZTP manifests and…
Browse files Browse the repository at this point in the history
… set it to `enp1s0` (#555)
  • Loading branch information
akrzos authored Sep 25, 2024
1 parent f85a67b commit 8573a5e
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 30 deletions.
2 changes: 2 additions & 0 deletions ansible/roles/hv-vm-manifests-compact/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

hv_vm_manifests_directory: /root/hv-vm

vm_nic_interface: enp1s0

# 64 is a prefix for ipv6, 24 would work for ipv4
compact_cluster_network_host_prefix: 64

Expand Down
12 changes: 6 additions & 6 deletions ansible/roles/hv-vm-manifests-compact/templates/manifest.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ spec:
# spec:
# config:
# interfaces:
# - name: enp1s0
# - name: {{ vm_nic_interface }}
# type: ethernet
# state: up
# {{ "ipv6" if hostvars[groups['hv_vm'][vm]]['ip'] | ansible.utils.ipv6 else "ipv4" }}:
Expand All @@ -211,10 +211,10 @@ spec:
# - destination: {{ "::/0" if hostvars[groups['hv_vm'][vm]]['ip'] | ansible.utils.ipv6 else "0.0.0.0/0" }}
# metric: 1
# next-hop-address: {{ hostvars[groups['hv_vm'][vm]]['gateway'] }}
# next-hop-interface: enp1s0
# next-hop-interface: {{ vm_nic_interface }}
# table-id: 254
# interfaces:
# - name: "enp1s0"
# - name: {{ vm_nic_interface }}
# macAddress: {{ hostvars[groups['hv_vm'][vm]]['mac_address'] }}
{% else %}
---
Expand All @@ -228,7 +228,7 @@ metadata:
spec:
config:
interfaces:
- name: enp1s0
- name: {{ vm_nic_interface }}
type: ethernet
state: up
{{ "ipv6" if hostvars[groups['hv_vm'][vm]]['ip'] | ansible.utils.ipv6 else "ipv4" }}:
Expand All @@ -248,10 +248,10 @@ spec:
- destination: {{ "::/0" if hostvars[groups['hv_vm'][vm]]['ip'] | ansible.utils.ipv6 else "0.0.0.0/0" }}
metric: 1
next-hop-address: {{ hostvars[groups['hv_vm'][vm]]['gateway'] }}
next-hop-interface: enp1s0
next-hop-interface: {{ vm_nic_interface }}
table-id: 254
interfaces:
- name: "enp1s0"
- name: {{ vm_nic_interface }}
macAddress: {{ hostvars[groups['hv_vm'][vm]]['mac_address'] }}
{% endif %}
{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ spec:
{% endif %}
nodeNetwork:
interfaces:
- name: eno1
- name: {{ vm_nic_interface }}
macAddress: {{ hostvars[groups['hv_vm'][vm]]['mac_address'] }}
config:
interfaces:
- name: eno1
- name: {{ vm_nic_interface }}
type: ethernet
state: up
{% if hostvars[groups['hv_vm'][vm]]['hv_ip'] | ansible.utils.ipv4 %}
Expand Down Expand Up @@ -134,7 +134,7 @@ spec:
routes:
config:
- destination: {{ "::/0" if hostvars[groups['hv_vm'][vm]]['hv_ip'] | ansible.utils.ipv6 else "0.0.0.0/0" }}
next-hop-interface: eno1
next-hop-interface: {{ vm_nic_interface }}
next-hop-address: {{ hostvars[groups['hv_vm'][vm]]['gateway'] }}
table-id: 254
{% endfor %}
2 changes: 2 additions & 0 deletions ansible/roles/hv-vm-manifests-jumbo/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ registry_path: /opt/registry
# Used with bmc-secret
bmc_username_base64: "{{ 'redhat' | b64encode }}"
bmc_password_base64: "{{ 'password' | b64encode }}"

vm_nic_interface: enp1s0
12 changes: 6 additions & 6 deletions ansible/roles/hv-vm-manifests-jumbo/templates/manifest.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ spec:
# spec:
# config:
# interfaces:
# - name: enp1s0
# - name: {{ vm_nic_interface }}
# type: ethernet
# state: up
# {{ "ipv6" if hostvars[vm]['ip'] | ansible.utils.ipv6 else "ipv4" }}:
Expand All @@ -210,10 +210,10 @@ spec:
# - destination: {{ "::/0" if hostvars[vm]['ip'] | ansible.utils.ipv6 else "0.0.0.0/0" }}
# metric: 1
# next-hop-address: {{ hostvars[vm]['gateway'] }}
# next-hop-interface: enp1s0
# next-hop-interface: {{ vm_nic_interface }}
# table-id: 254
# interfaces:
# - name: "enp1s0"
# - name: {{ vm_nic_interface }}
# macAddress: {{ hostvars[vm]['mac_address'] }}
{% else %}
---
Expand All @@ -227,7 +227,7 @@ metadata:
spec:
config:
interfaces:
- name: enp1s0
- name: {{ vm_nic_interface }}
type: ethernet
state: up
{{ "ipv6" if hostvars[vm]['ip'] | ansible.utils.ipv6 else "ipv4" }}:
Expand All @@ -245,10 +245,10 @@ spec:
- destination: {{ "::/0" if hostvars[vm]['ip'] | ansible.utils.ipv6 else "0.0.0.0/0" }}
metric: 1
next-hop-address: {{ hostvars[vm]['gateway'] }}
next-hop-interface: enp1s0
next-hop-interface: {{ vm_nic_interface }}
table-id: 254
interfaces:
- name: "enp1s0"
- name: {{ vm_nic_interface }}
macAddress: {{ hostvars[vm]['mac_address'] }}
{% endif %}
{% endfor %}
2 changes: 2 additions & 0 deletions ansible/roles/hv-vm-manifests-sno/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ registry_path: /opt/registry
bmc_username_base64: "{{ 'redhat' | b64encode }}"
bmc_password_base64: "{{ 'password' | b64encode }}"

vm_nic_interface: enp1s0

# Used in conjunction with including the PerformanceProfile in the DU profile
siteconfig_enable_cpuset: false
siteconfig_cpuset: "0-3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ metadata:
spec:
config:
interfaces:
- name: enp1s0
- name: {{ vm_nic_interface }}
type: ethernet
state: up
{{ "ipv6" if hostvars[inventory_hostname]['ip'] | ansible.utils.ipv6 else "ipv4" }}:
Expand All @@ -46,10 +46,10 @@ spec:
- destination: {{ "::/0" if hostvars[inventory_hostname]['ip'] | ansible.utils.ipv6 else "0.0.0.0/0" }}
metric: 1
next-hop-address: {{ hostvars[inventory_hostname]['gateway'] }}
next-hop-interface: enp1s0
next-hop-interface: {{ vm_nic_interface }}
table-id: 254
interfaces:
- name: "enp1s0"
- name: {{ vm_nic_interface }}
macAddress: {{ hostvars[inventory_hostname]['mac_address'] }}
---
apiVersion: v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ spec:
{% endif %}
nodeNetwork:
interfaces:
- name: eno1
- name: {{ vm_nic_interface }}
macAddress: {{ hostvars[inventory_hostname]['mac_address'] }}
config:
interfaces:
- name: eno1
- name: {{ vm_nic_interface }}
type: ethernet
state: up
{% if hostvars[inventory_hostname]['ip'] | ansible.utils.ipv4 %}
Expand Down Expand Up @@ -169,6 +169,6 @@ spec:
routes:
config:
- destination: {{ "::/0" if hostvars[inventory_hostname]['ip'] | ansible.utils.ipv6 else "0.0.0.0/0" }}
next-hop-interface: eno1
next-hop-interface: {{ vm_nic_interface }}
next-hop-address: {{ hostvars[inventory_hostname]['gateway'] }}
table-id: 254
2 changes: 2 additions & 0 deletions ansible/roles/hv-vm-manifests-standard/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ registry_path: /opt/registry
bmc_username_base64: "{{ 'redhat' | b64encode }}"
bmc_password_base64: "{{ 'password' | b64encode }}"

vm_nic_interface: enp1s0

# Used in conjunction with including the PerformanceProfile in the DU profile
siteconfig_enable_cpuset: false
siteconfig_cpuset: "0-3"
Expand Down
12 changes: 6 additions & 6 deletions ansible/roles/hv-vm-manifests-standard/templates/manifest.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ spec:
# spec:
# config:
# interfaces:
# - name: enp1s0
# - name: {{ vm_nic_interface }}
# type: ethernet
# state: up
# {{ "ipv6" if hostvars[groups['hv_vm'][vm]]['ip'] | ansible.utils.ipv6 else "ipv4" }}:
Expand All @@ -224,10 +224,10 @@ spec:
# - destination: {{ "::/0" if hostvars[groups['hv_vm'][vm]]['ip'] | ansible.utils.ipv6 else "0.0.0.0/0" }}
# metric: 1
# next-hop-address: {{ hostvars[groups['hv_vm'][vm]]['gateway'] }}
# next-hop-interface: enp1s0
# next-hop-interface: {{ vm_nic_interface }}
# table-id: 254
# interfaces:
# - name: "enp1s0"
# - name: {{ vm_nic_interface }}
# macAddress: {{ hostvars[groups['hv_vm'][vm]]['mac_address'] }}
{% else %}
---
Expand All @@ -241,7 +241,7 @@ metadata:
spec:
config:
interfaces:
- name: enp1s0
- name: {{ vm_nic_interface }}
type: ethernet
state: up
{{ "ipv6" if hostvars[groups['hv_vm'][vm]]['ip'] | ansible.utils.ipv6 else "ipv4" }}:
Expand All @@ -261,10 +261,10 @@ spec:
- destination: {{ "::/0" if hostvars[groups['hv_vm'][vm]]['ip'] | ansible.utils.ipv6 else "0.0.0.0/0" }}
metric: 1
next-hop-address: {{ hostvars[groups['hv_vm'][vm]]['gateway'] }}
next-hop-interface: enp1s0
next-hop-interface: {{ vm_nic_interface }}
table-id: 254
interfaces:
- name: "enp1s0"
- name: {{ vm_nic_interface }}
macAddress: {{ hostvars[groups['hv_vm'][vm]]['mac_address'] }}
{% endif %}
{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ spec:
{% endif %}
nodeNetwork:
interfaces:
- name: eno1
- name: {{ vm_nic_interface }}
macAddress: {{ hostvars[groups['hv_vm'][vm]]['mac_address'] }}
config:
interfaces:
- name: eno1
- name: {{ vm_nic_interface }}
type: ethernet
state: up
{% if hostvars[groups['hv_vm'][vm]]['hv_ip'] | ansible.utils.ipv4 %}
Expand Down Expand Up @@ -139,7 +139,7 @@ spec:
routes:
config:
- destination: {{ "::/0" if hostvars[groups['hv_vm'][vm]]['hv_ip'] | ansible.utils.ipv6 else "0.0.0.0/0" }}
next-hop-interface: eno1
next-hop-interface: {{ vm_nic_interface }}
next-hop-address: {{ hostvars[groups['hv_vm'][vm]]['gateway'] }}
table-id: 254
{% endfor %}

0 comments on commit 8573a5e

Please sign in to comment.