From fe040d1aa9a01e14c882ead7cb09303aef588804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 13 Jan 2022 12:59:43 +0100 Subject: Rewrote mots of nspawn. --- manifests/util/disable_networking.pp | 3 ++- manifests/util/enable_networkd.pp | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'manifests/util') diff --git a/manifests/util/disable_networking.pp b/manifests/util/disable_networking.pp index 4a9b31b..ac55951 100644 --- a/manifests/util/disable_networking.pp +++ b/manifests/util/disable_networking.pp @@ -3,8 +3,9 @@ define nspawn::util::disable_networking ( String $machine_path = "/var/lib/machines/${machine}", ) { + $running = $facts['machined-info'][$machine] != undef and $facts['machined-info'][$machine]['State'] == 'running' - $cmd = if $facts['machined-info'][$machine]['State'] == 'running' { + $cmd = if $running { [ 'systemctl', '-M', $machine, 'disable', 'networking' ] } else { [ 'systemd-nspawn', '-M', $machine, '--quiet', diff --git a/manifests/util/enable_networkd.pp b/manifests/util/enable_networkd.pp index 8e447b9..f9b4d2e 100644 --- a/manifests/util/enable_networkd.pp +++ b/manifests/util/enable_networkd.pp @@ -3,9 +3,8 @@ define nspawn::util::enable_networkd ( String $machine_path = "/var/lib/machines/${machine}", ) { - # TODO only do this if the directory is empty networking::networkd_instance { "Initial networking on ${machine}": - priority => 50, + priority => 99, filename => 'puppet-initial', path => "${machine_path}/${networking::networkd::path}", content => { @@ -19,7 +18,7 @@ define nspawn::util::enable_networkd ( }, } - $running = $facts['machined-info'][$machine] != Undef or $facts['machined-info'][$machine]['State'] == 'running' + $running = $facts['machined-info'][$machine] != undef and $facts['machined-info'][$machine]['State'] == 'running' $cmd = if $running { [ 'systemctl', '-M', $machine, 'enable', 'systemd-networkd' ] -- cgit v1.2.3