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\"",
} -> exec {"lxc-$contname-started":
path => '/usr/bin',
refreshonly => true,
- refresh => "/usr/bin/lxc-stop -n $contname ; /usr/bin/lxc-start -dn $contname",
+ refresh => "/usr/bin/lxc-stop -n $contname ; /usr/bin/lxc-start -dn $contname; /usr/bin/lxc-attach -n $contname -- bash -c 'while ! [[ -S /run/systemd/private ]]; do sleep 1; done'",
}-> exec {"lxc-$contname-started1":
- command => "/usr/bin/lxc-start -dn $contname",
+ command => "/usr/bin/lxc-start -dn $contname; /usr/bin/lxc-attach -n $contname -- bash -c 'while ! [[ -S /run/systemd/private ]]; do sleep 1; done'",
unless => "/usr/bin/[ \"\$(lxc-info -Hsn $contname)\" != \"STOPPED\" ]",
}
$dir.each |String $in| {