diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-01 23:00:13 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-01 23:00:13 +0100 |
commit | eac7bbacc7175c8c8853f431a17750bf24e3a159 (patch) | |
tree | 8830c2c331b642bf0b89b99669dd43c81c200160 /modules/nspawn/manifests/os/debian.pp | |
parent | Add node classifier. (diff) | |
download | webdav_server-eac7bbacc7175c8c8853f431a17750bf24e3a159.tar.gz webdav_server-eac7bbacc7175c8c8853f431a17750bf24e3a159.tar.xz |
Setup nspawn?
Diffstat (limited to 'modules/nspawn/manifests/os/debian.pp')
-rw-r--r-- | modules/nspawn/manifests/os/debian.pp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/modules/nspawn/manifests/os/debian.pp b/modules/nspawn/manifests/os/debian.pp new file mode 100644 index 0000000..c821ba6 --- /dev/null +++ b/modules/nspawn/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", + } +} |