summaryrefslogtreecommitdiff
path: root/manifests/os/debian.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/os/debian.pp')
-rw-r--r--manifests/os/debian.pp41
1 files changed, 25 insertions, 16 deletions
diff --git a/manifests/os/debian.pp b/manifests/os/debian.pp
index ac12988..b8a1bd4 100644
--- a/manifests/os/debian.pp
+++ b/manifests/os/debian.pp
@@ -37,25 +37,34 @@ define nspawn::os::debian (
| EOF
}
- file { "/var/lib/machines/${machine}/tmp/puppet7-release-${os_version}.deb":
+ $puppet_deb = "/var/lib/machines/${machine}/tmp/puppet7-release-${os_version}.deb"
+ file { $puppet_deb:
ensure => file,
source => "https://apt.puppet.com/puppet7-release-${os_version}.deb"
}
- ~> exec { "Set up puppet repo for ${machine}":
- command => [ '/usr/bin/systemd-nspawn',
- '-M', $machine,
- '--quiet',
- '/bin/sh', '-c',
- "dpkg -i '/tmp/puppet7-release-${os_version}.deb' && apt update"
- ],
- }
- exec { "install puppet-agent on ${machine}":
- command => [ '/usr/bin/systemd-nspawn',
- '-M', $machine,
- '--quiet',
- 'apt', 'install', 'puppet-agent',
- ],
- creates => "/var/lib/machines/${machine}/opt/puppetlabs/bin/puppet",
+ if $facts['machined-info'][$machine]['State'] == 'running' {
+ notify { "Notify skipping ${machine} setup":
+ message => "Skipping setup for ${machine}, already running",
+ }
+ } else {
+ exec { "Set up puppet repo for ${machine}":
+ subscribe => File[$puppet_deb],
+ command => [ '/usr/bin/systemd-nspawn',
+ '-M', $machine,
+ '--quiet',
+ '/bin/sh', '-c',
+ "dpkg -i '/tmp/puppet7-release-${os_version}.deb' && apt update"
+ ],
+ }
+
+ exec { "install puppet-agent on ${machine}":
+ command => [ '/usr/bin/systemd-nspawn',
+ '-M', $machine,
+ '--quiet',
+ 'apt', 'install', 'puppet-agent',
+ ],
+ creates => "/var/lib/machines/${machine}/opt/puppetlabs/bin/puppet",
+ }
}
}