#12777·vagrant

Setting a static IP on opensuse/MicroOS fails, uses DHCP instead

Author: malcolmlewisCreated May 24, 2022Updated Jul 4, 2026
Labelsguest/susenetworking

Now that openSUSE Tumbleweed has switch from Wicked to NetworkManager provisioning a static ip address fails. Earlier boxes using Wicked work as expected.

Vagrant version

Vagrant 2.2.19

Host operating system

openSUSE Tumbleweed (20220522)

Guest operating system

opensuse/MicroOS.x86_64 (libvirt, 16.0.0.20220521)

Vagrantfile

ruby
# Use libvirt for the provider
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'libvirt'

# Configure the nodes
cluster_nodes = [
   { :host => "node-11",
     :type => "master",
     :box => "opensuse/MicroOS.x86_64",
     :ip => "192.168.10.186",
     :cpu => 2,
     :ram => 2048
   },
   { :host => "node-12",
     :type => "node",
     :box => "opensuse/MicroOS.x86_64",
     :ip => "192.168.10.187",
     :cpu => 2,
     :ram => 2048
   },
   { :host => "node-13",
     :type => "node",
     :box => "opensuse/MicroOS.x86_64",
     :ip => "192.168.10.188",
     :cpu => 2,
     :ram => 2048
   },
]

# Configure the domain to use
varDomain = "homelinux.org"

# Bring up the node loop
Vagrant.configure("2") do |config|

   # The 'config' loop for all nodes in the cluster
#   config.vm.box_version = "16.0.0.20220218"
   config.vm.provision "file", source: "/data/vagrant/fuel-ignition/K3s_hosts", destination: "/tmp/k3s_hosts"
   config.vm.synced_folder ".", "/vagrant", disabled: true
   # Setup the timezone
   config.vm.provision "shell", inline: "timedatectl set-timezone America/Chicago"
   # The main cluster node loop
   cluster_nodes.each do |node|

      # The per node 'config' loop
      config.vm.define node[:host] do |node_config|

         # Setup the node distribution and network
         node_config.vm.box = node[:box]
         node_config.vm.network "public_network", :dev => "enp0s20u4", ip: node[:ip], :netmask => "255.255.255.0"
         node_config.vm.hostname = "#{node[:host]}.#{varDomain}"
         # The node specific configuration loop based on type
         if node[:type] == "master"
            node_config.vm.provision "shell", inline: <<-SHELL
            echo "Configure Master..."
            nmcli connection reload
            systemctl restart network.service
            cat /tmp/k3s_hosts >> /etc/hosts
            #curl https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc
            #chmod 0755 /usr/local/bin/mc
            NODE_NAME=`hostnamectl --transient`
            NODE_IP=$(grep `hostnamectl --transient` /etc/hosts | awk '{print $1}' | tail -n1)
            curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --cluster-init \
            --node-ip $NODE_IP --node-external-ip $NODE_IP" \
            K3S_TOKEN_FILE=/etc/rancher/k3s/node-token-seed \
            K3S_NODE_NAME=$NODE_NAME sh -s -
            SHELL
         end
         if node[:type] == "node"
            node_config.vm.provision "shell", inline: <<-SHELL
            echo "Configure Node..."
            cat /tmp/k3s_hosts >> /etc/hosts
            curl https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc
            chmod 0755 /usr/local/bin/mc
            NODE_NAME=`hostnamectl --transient`
            NODE_IP=$(grep `hostnamectl --transient` /etc/hosts | awk '{print $1}' | tail -n1)
            curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --server \
            https://node-1:6443 --node-ip $NODE_IP --node-external-ip $NODE_IP" \
            K3S_TOKEN_FILE=/etc/rancher/k3s/node-token-seed K3S_NODE_NAME=$NODE_NAME sh -
            SHELL
         end
         if node[:type] == "worker"
            node_config.vm.provision "shell", inline: <<-SHELL
            echo "Configure Worker..."
            cat /tmp/k3s_hosts >> /etc/hosts
            NODE_NAME=`hostnamectl --transient`
            NODE_IP=$(grep `hostnamectl --transient` /etc/hosts | awk '{print $1}' | tail -n1)
            curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="agent --server \
            https://node-1:6443 --node-ip $NODE_IP --node-external-ip $NODE_IP" \
            K3S_TOKEN_FILE=/etc/rancher/k3s/node-token-seed K3S_NODE_NAME=$NODE_NAME sh -
            SHELL
         end

         # The node libvirt provisioning loop
         node_config.vm.provider :libvirt do |libvirt|
            libvirt.cpus = "#{node[:cpu]}"
            libvirt.memory = "#{node[:ram]}"
            # Add ignition iso to set root password, ssh key, ssh options and node-token-seed
            libvirt.storage :file, :device => :cdrom, :path => '/data/vagrant/fuel-ignition/ignition.iso'
         end

      end

   end

end

Debug output

https://gist.github.com/malcolmlewis/158112bcf9f45aea1dd92d30c7ebdecd

Expected behavior

The guest should receive a static IP the same as if using wicked.

Actual behavior

The guest receives a dynamic IP via DHCP instead and then bails when trying to provision a static ip address.

Steps to reproduce

Create an ignition iso image and run vagrant up

References

  • GH-12762