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.pp47
1 files changed, 18 insertions, 29 deletions
diff --git a/manifests/os/debian.pp b/manifests/os/debian.pp
index ff687dd..e7e7a21 100644
--- a/manifests/os/debian.pp
+++ b/manifests/os/debian.pp
@@ -1,10 +1,12 @@
# TODO rename this to image-setup
define nspawn::os::debian (
String $os_version,
- String $machine = $name,
+ String $template_name = $name,
+ String $template_dir = $nspawn::template_dir,
) {
- $root = "/var/lib/machines/debian-${os_version}.base"
+ $root = "${template_dir}/${template_name}"
+ $pkg_pos = 'var/tmp'
ensure_packages(['debootstrap'])
@@ -13,34 +15,35 @@ define nspawn::os::debian (
}
$puppet_deb = "puppet7-release-${os_version}.deb"
- $puppet_deb_path = "${root}/opt/${puppet_deb}"
+ $puppet_deb_path = "${root}/${pkg_pos}/${puppet_deb}"
file { $puppet_deb_path:
ensure => file,
source => "https://apt.puppet.com/${puppet_deb}"
}
- $running = $facts['machined-info'][$machine] != undef and $facts['machined-info'][$machine]['State'] == 'running'
+ $running = $facts['machined-info'][$template_name] != undef
+ and $facts['machined-info'][$template_name]['State'] == 'running'
if $running {
# TODO
- notify { "Notify skipping ${machine} setup":
- message => "Skipping setup for ${machine}, already running",
+ notify { "Notify skipping ${template_name} setup":
+ message => "Skipping setup for ${template_name}, already running",
}
} else {
- exec { "Set up puppet repo for ${machine}":
+ exec { "Set up puppet repo for ${template_name}":
subscribe => File[$puppet_deb_path],
command => [ '/usr/bin/systemd-nspawn',
- '-M', $machine,
+ '-M', $template_name,
'--quiet',
'/bin/sh', '-c',
- "dpkg -i '/opt/puppet7-release-${os_version}.deb' && apt update"
+ "dpkg -i '/${pkg_pos}/puppet7-release-${os_version}.deb' && apt update"
],
}
- exec { "install puppet-agent on ${machine}":
+ exec { "install puppet-agent on ${template_name}":
command => [ '/usr/bin/systemd-nspawn',
- '-M', $machine,
+ '-M', $template_name,
'--quiet',
'apt', 'install', 'puppet-agent',
],
@@ -48,24 +51,10 @@ define nspawn::os::debian (
}
}
-
- exec { "Enable puppet on ${machine}":
- command => [ '/usr/bin/systemd-nspawn',
- '-M', $machine,
- '--quiet',
- 'systemctl', 'enable', 'puppet',
- ],
- creates => "${root}/etc/systemd/system/multi-user.target.wants/puppet.service",
+ nspawn::util::disable_networking { $template_name:
+ template_dir => $template_dir,
}
-
- file { "${root}/etc/puppetlabs/puppet/puppet.conf":
- ensure => file,
- content => @(EOF)
- [main]
- server = busting.adrift.space
- | EOF
+ nspawn::util::enable_networkd { $template_name:
+ template_dir => $template_dir,
}
-
- nspawn::util::disable_networking { $machine: }
- nspawn::util::enable_networkd { $machine: }
}