add local.conf for each lxc-container

This commit is contained in:
Jörg Thalheim 2015-01-30 09:56:58 +00:00
parent 51aff603ff
commit b89cb8bba3
4 changed files with 18 additions and 5 deletions

View File

@ -1,7 +1,7 @@
{
"zone": {
"soa": "ns1.higgsboson.tk.",
"serial": 116,
"serial": 124,
"refresh": "1H",
"hostmaster": "hostmaster.higgsboson.tk",
"domain": "eve.higgsboson.tk",
@ -325,7 +325,9 @@
"ipv6": "2a01:4f8:210:31fd:1::20/128",
"group": "php",
"vars": {
"php_extensions": []
"php_extensions": [
]
}
},
"phonefinder": {
@ -333,8 +335,10 @@
"ipv6": "2a01:4f8:210:31fd:1::21/128",
"group": "php",
"vars": {
"php_extensions": []
"php_extensions": [
]
}
}
}
}
}

View File

@ -1,6 +1,7 @@
require "erb"
require "netaddr"
require "pathname"
require "fileutils"
module Lxc
class Container
@ -55,6 +56,13 @@ module Lxc
c["dn42_ipv6"] = NetAddr::CIDR.create(@dn42_ipv6).to_s(Short: true)
end
config_dir = File.dirname(config_path)
local_conf = File.join(config_dir, "local.conf")
unless File.exists?(local_conf)
FileUtils.touch(local_conf)
end
opts[:local_conf] = local_conf
templ = Template.new(CONFIG_ROOT.join("templates", "config.erb"))
templ.write(config_path, opts)
end

View File

@ -1,4 +1,5 @@
lxc.include = /etc/lxc/default.conf
lxc.include = <%= local_conf %>
lxc.utsname = <%= name %>
lxc.rootfs = <%= rootfs %>
lxc.network.ipv4 = <%= ipv4 %>

View File

@ -21,6 +21,6 @@
<% end -%>
<% end -%>
<% pointers do |addr, name| -%>
<% zone.pointers do |name, addr| -%>
<%= addr %> PTR <%= name %>.<%= data["zone"]["domain"] %>.
<% end -%>