From ac350060d6f6a22c08b2d324ea6bbb57124bb995 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20D=C3=B6rre?= Date: Sat, 22 Dec 2018 13:19:13 +0100 Subject: [PATCH] chg: extract lxc-bind-mounts to own resources Change-Id: Iaf0e30fa582131d02488f6cda44f416d729f78c9 --- modules/lxc/manifests/init.pp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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\"", -- 2.39.2