diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-02 02:42:48 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-02 02:47:35 +0100 |
commit | 91e5a78ba96645794c8e5742265e17dca83d664f (patch) | |
tree | 3abed904b2a709766c936d4ccaa3c329a7387860 /modules/nspawn/manifests/os/arch.pp | |
parent | Add systemd-machined facts. (diff) | |
download | webdav_server-91e5a78ba96645794c8e5742265e17dca83d664f.tar.gz webdav_server-91e5a78ba96645794c8e5742265e17dca83d664f.tar.xz |
Only run nspawn stuff if machine not running.
Diffstat (limited to 'modules/nspawn/manifests/os/arch.pp')
-rw-r--r-- | modules/nspawn/manifests/os/arch.pp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/modules/nspawn/manifests/os/arch.pp b/modules/nspawn/manifests/os/arch.pp index 5fbf5d1..0affee1 100644 --- a/modules/nspawn/manifests/os/arch.pp +++ b/modules/nspawn/manifests/os/arch.pp @@ -20,14 +20,19 @@ define nspawn::os::arch ( | EOF } - exec { "Enable systemd-networkd on ${machine}": - command => [ '/usr/bin/systemd-nspawn', - '-M', $machine, - '--quiet', - 'systemctl', 'enable', 'systemd-networkd', - ], - # among others - creates => "/var/lib/machines/${machine}/etc/systemd/system/multi-user.target.wants/systemd-networkd.service", + if $facts['machined-info'][$machine]['State'] == 'running' { + notify { "Notify skipping ${machine} setup": + message => "Skipping setup for ${machine}, already running", + } + } else { + exec { "Enable systemd-networkd on ${machine}": + command => [ '/usr/bin/systemd-nspawn', + '-M', $machine, + '--quiet', + 'systemctl', 'enable', 'systemd-networkd', + ], + # among others + creates => "/var/lib/machines/${machine}/etc/systemd/system/multi-user.target.wants/systemd-networkd.service", + } } - } |