-
- execute "networkctl-delete-#{interface[:interface]}" do
- action :nothing
- command "networkctl delete #{interface[:interface]}"
- only_if { ::File.exist?("/sys/class/net/#{interface[:interface]}") }
- end
- elsif interface[:interface] =~ /^bond\d+$/
- template "/etc/systemd/network/10-#{interface[:interface]}.netdev" do
- source "bond.netdev.erb"
- owner "root"
- group "root"
- mode "644"
- variables :interface => interface
- notifies :run, "execute[networkctl-delete-#{interface[:interface]}]"
- notifies :run, "notify_group[networkctl-reload]"
- end
-
- execute "networkctl-delete-#{interface[:interface]}" do
- action :nothing
- command "networkctl delete #{interface[:interface]}"
- only_if { ::File.exist?("/sys/class/net/#{interface[:interface]}") }
- end
-
- interface[:bond][:slaves].each do |slave|
- file "/run/systemd/network/10-netplan-#{slave}.network" do
- action :delete
- end
-
- template "/etc/systemd/network/10-#{slave}.network" do
- source "slave.network.erb"
- owner "root"
- group "root"
- mode "644"
- variables :master => interface, :slave => slave
- notifies :run, "notify_group[networkctl-reload]"
- end
- end
- end
-
- file "/run/systemd/network/10-netplan-#{interface[:interface]}.network" do
- action :delete
- end
-
- template "/etc/systemd/network/10-#{interface[:interface]}.network" do
- source "network.erb"
- owner "root"
- group "root"
- mode "644"
- variables :interface => interface
- notifies :run, "notify_group[networkctl-reload]"