Skip to content

Commit

Permalink
Defer DHCP on eth1 to fasten deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Bischoff committed Sep 10, 2024
1 parent 70523ba commit 35c90a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
11 changes: 5 additions & 6 deletions backend_modules/libvirt/host/combustion
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ type=ethernet
interface-name=$2
[ipv4]
dhcp-timeout=1
method=auto
method=$3
[ipv6]
addr-gen-mode=eui64
Expand All @@ -25,17 +24,17 @@ EOF

# Name the Network Manager connections (preparation phase in initrd)
if [ "$${1-}" = "--prepare" ]; then
nm_config 1 eth0
nm_config 2 eth1
nm_config 1 eth0 auto
nm_config 2 eth1 manual
exit 0
fi

# Redirect output to the console
exec > >(exec tee -a /var/log/combustion) 2>&1

# Name the Network Manager connections (final phase on real filesystem)
nm_config 1 eth0
nm_config 2 eth1
nm_config 1 eth0 auto
nm_config 2 eth1 manual

# Set linux as password for root
echo 'root:$6$3aQC9rrDLHiTf1yR$NoKe9tko0kFIpu0rQ2y/OzOOtbVvs0Amr2bx0T4cGf6aq8PG74EmVy8lSDJdbLVVFpOSzwELWyReRCiPHa7DG0' | chpasswd -e
Expand Down
13 changes: 12 additions & 1 deletion salt/default/network.sls
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ipv6_accept_ra_{{ iface }}:
{% endfor %}

{% if grains['osfullname'] in ['SLE Micro', 'openSUSE Leap Micro'] and (grains['osrelease'] != '5.1' and grains['osrelease'] != '5.2') %}
{% set conname = salt['cmd.run']('nmcli -g GENERAL.CONNECTION device show eth0') %}
{% set conname = salt.cmd.run_stdout('nmcli -g GENERAL.CONNECTION device show eth0') %}
avoid_network_manager_messing_up:
cmd.run:
- name: |
Expand Down Expand Up @@ -73,6 +73,17 @@ ipv6_disable_all:

{% endif %}

{% if grains['osfullname'] in ['SLE Micro', 'openSUSE Leap Micro'] and (grains['osrelease'] != '5.1' and grains['osrelease'] != '5.2') %}
{% set conname2 = salt.cmd.run_stdout('nmcli -g GENERAL.CONNECTION device show eth1') %}
{% if conname2 != '' %}
enable_dhcp_on_eth1:
cmd.run:
- name: |
nmcli connection modify "{{ conname2 }}" ipv4.method auto
nmcli device modify eth1 ipv4.method auto
{% endif %}
{% endif %}

{% if grains['os_family'] == 'RedHat' and grains.get('osmajorrelease', None)|int() == 6 %}
mdns_iptables:
iptables.insert:
Expand Down

0 comments on commit 35c90a3

Please sign in to comment.