From: Felix Dörre Date: Sat, 22 Dec 2018 12:19:13 +0000 (+0100) Subject: chg: extract lxc-bind-mounts to own resources X-Git-Url: https://code.wpia.club/?p=infra.git;a=commitdiff_plain;h=ac350060d6f6a22c08b2d324ea6bbb57124bb995 chg: extract lxc-bind-mounts to own resources Change-Id: Iaf0e30fa582131d02488f6cda44f416d729f78c9 --- diff --git a/modules/lxc/manifests/init.pp b/modules/lxc/manifests/init.pp index 0f4101d..3693966 100644 --- a/modules/lxc/manifests/init.pp +++ b/modules/lxc/manifests/init.pp @@ -23,6 +23,20 @@ class lxc { refreshonly => true, subscribe => File['/etc/network/interfaces.d/lxcbr0'] } + + define container_bind($container, $out = $name, $target, $option = ""){ + file{"/var/lib/lxc/$container/rootfs/$target": + ensure => directory, + require => File_line["lxc-$container-conf5"], + before => Exec["lxc-$container-started"] + }-> + file_line { "lxc-$container-mount-$out": + path => "/var/lib/lxc/$container/config", + line => "lxc.mount.entry = $out $target none bind$option 0 0", + require=> [File_line["lxc-$container-conf5"], File["$out"]], + notify => Exec["lxc-$container-started"], + } + } define container ($contname, $ip, $dir = [], $bind = {}, $confline = []) { exec {"lxc-$contname-issue-cert": command => "/usr/bin/puppet ca destroy \"$contname\";/usr/bin/puppet ca generate \"$contname\"",