Make BIND /var dir persistent

BIND stores dynamically created zones in /var/named by default,
which means that this directory needs to be persistent across
container restarts.  However, we can't just bind mount /var/named
into the container because /var/named is empty on the host, but in
the container the BIND package populates some necessary initial files
in it.

To address this, we can point BIND at /var/named-persistent and
copy all of the initial config from /var/named at container start,
just like we do for other configs.

Change-Id: Ic17fb812468f2eb66d9c348b51dfa73a1f216a70
This commit is contained in:
Ben Nemec 2018-06-15 14:08:19 -05:00
parent cf2be03500
commit 21bb3bac56
2 changed files with 11 additions and 1 deletions

View File

@ -113,11 +113,15 @@ outputs:
dest: "/"
merge: true
preserve_properties: true
- source: "/var/named/*"
dest: "/var/named-persistent/"
merge: true
preserve_properties: true
permissions:
- path: /var/log/designate
owner: designate:designate
recurse: true
- path: /var/named
- path: /var/named-persistent
owner: root:named
perm: '0770'
docker_config:
@ -152,6 +156,7 @@ outputs:
- /var/lib/kolla/config_files/designate_backend_bind9.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/designate/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/designate:/var/log/designate
- /var/named-persistent:/var/named-persistent
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
@ -166,3 +171,7 @@ outputs:
Log files from designate containers can be found under
/var/log/containers/designate.
ignore_errors: true
- name: create persistent named directory
file:
path: /var/named-persistent
state: directory

View File

@ -69,6 +69,7 @@ outputs:
map_merge:
- get_attr: [DesignateBase, role_data, config_settings]
- designate::worker::worker_notify: true
dns::vardir: /var/named-persistent
dns::additional_options:
listen-on:
str_replace: