summaryrefslogtreecommitdiffstats
path: root/roles/dns/templates
diff options
context:
space:
mode:
authorJan Provaznik <jprovazn@redhat.com>2016-03-31 10:57:30 +0200
committerJan Provaznik <jprovazn@redhat.com>2016-04-26 13:57:29 +0200
commitc76ae7d9398e3a04ded06c7e54811ad7a379921a (patch)
treeab357af1c7c0dec843279afdcd2c35974d6a5ec5 /roles/dns/templates
parent7c6d0d70e2371bd9abb6feb4e6c098ae4ddb5143 (diff)
downloadopenshift-c76ae7d9398e3a04ded06c7e54811ad7a379921a.tar.gz
openshift-c76ae7d9398e3a04ded06c7e54811ad7a379921a.tar.bz2
openshift-c76ae7d9398e3a04ded06c7e54811ad7a379921a.tar.xz
openshift-c76ae7d9398e3a04ded06c7e54811ad7a379921a.zip
Allow containerized deployment of dns role
If containerized, docker image for bind service is built during ansible run. The default named systemd unit file triggers named-checkconf on named service start so it's not neccessary to include this validation when copying file templates (equivalent named-checkconf is included in the containerized named unit file too).
Diffstat (limited to 'roles/dns/templates')
-rw-r--r--roles/dns/templates/Dockerfile11
-rw-r--r--roles/dns/templates/named.service.j215
2 files changed, 26 insertions, 0 deletions
diff --git a/roles/dns/templates/Dockerfile b/roles/dns/templates/Dockerfile
new file mode 100644
index 000000000..cdff0a228
--- /dev/null
+++ b/roles/dns/templates/Dockerfile
@@ -0,0 +1,11 @@
+FROM {{ base_docker_image }}
+MAINTAINER Jan Provaznik <jprovazn@redhat.com>
+
+# install main packages:
+RUN yum -y update; yum clean all;
+RUN yum -y install bind-utils bind
+
+EXPOSE 53
+
+# start services:
+CMD ["/usr/sbin/named", "-f"]
diff --git a/roles/dns/templates/named.service.j2 b/roles/dns/templates/named.service.j2
new file mode 100644
index 000000000..566739f25
--- /dev/null
+++ b/roles/dns/templates/named.service.j2
@@ -0,0 +1,15 @@
+[Unit]
+Requires=docker.service
+After=docker.service
+PartOf=docker.service
+
+[Service]
+Type=simple
+TimeoutStartSec=5m
+ExecStartPre=/usr/bin/docker run --rm -v /etc/named.conf:/etc/named.conf -v /var/named:/var/named:z bind named-checkconf -z /etc/named.conf
+ExecStartPre=-/usr/bin/docker rm -f bind
+ExecStart=/usr/bin/docker run --name bind -p 53:53/udp -v /var/log:/var/log -v /etc/named.conf:/etc/named.conf -v /var/named:/var/named:z bind
+ExecStop=/usr/bin/docker stop bind
+
+[Install]
+WantedBy=docker.service