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.pp61
1 files changed, 61 insertions, 0 deletions
diff --git a/manifests/os/debian.pp b/manifests/os/debian.pp
new file mode 100644
index 0000000..c821ba6
--- /dev/null
+++ b/manifests/os/debian.pp
@@ -0,0 +1,61 @@
+define nspawn::os::debian (
+ String $os_version,
+ String $machine = $name,
+) {
+ ensure_packages(['debootstrap'])
+
+ exec { "/usr/bin/deboostrap ${os_version} /var/lib/machines/${machine}":
+ creates => "/var/lib/machines/${machine}/etc/os-release",
+ }
+
+ file { "/var/lib/machines/${machine}/etc/network/interfaces":
+ ensure => file,
+ content => @(EOF)
+ # File managed by puppet
+ # See interfaces(5)
+ source-directory /etc/network/interfaces.d
+ | EOF
+ }
+
+ file { "/var/lib/machines/${machine}/etc/network/interfaces.d":
+ ensure => directory,
+ }
+
+ file { "/var/lib/machines/${machine}/etc/network/interfaces.d/puppet":
+ ensure => file,
+ content => @(EOF)
+ # File managed by puppet
+ auto host0
+ # allow-hotplug host0
+
+ iface host0 inet static
+ address 10.0.0.42/23
+ gateway 10.0.0.1
+
+ iface host0 inet6 auto
+ private 0
+ | EOF
+ }
+
+ file { "/var/lib/machines/${machine}/tmp/puppet7-release/${os_version}.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",
+ }
+}