summaryrefslogtreecommitdiffstats
path: root/roles/dns/tasks
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/tasks
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/tasks')
-rw-r--r--roles/dns/tasks/main.yml34
1 files changed, 31 insertions, 3 deletions
diff --git a/roles/dns/tasks/main.yml b/roles/dns/tasks/main.yml
index af728585d..57a7e6269 100644
--- a/roles/dns/tasks/main.yml
+++ b/roles/dns/tasks/main.yml
@@ -1,18 +1,46 @@
- name: Install Bind
action: "{{ ansible_pkg_mgr }} name=bind"
+ when: not openshift.common.is_containerized | bool
+
+- name: Create docker build dir
+ file: path=/tmp/dockerbuild state=directory
+ when: openshift.common.is_containerized | bool
+
+- name: Install dockerfile
+ template:
+ dest: "/tmp/dockerbuild/Dockerfile"
+ src: Dockerfile
+ register: install_result
+ when: openshift.common.is_containerized | bool
+
+- name: Build Bind image
+ docker_image: path="/tmp/dockerbuild" name="bind" state=present
+ when: openshift.common.is_containerized | bool
+
+- name: Install bind service file
+ template:
+ dest: "/etc/systemd/system/named.service"
+ src: named.service.j2
+ register: install_result
+ when: openshift.common.is_containerized | bool
+
+- name: reload systemd
+ command: /usr/bin/systemctl --system daemon-reload
+ when: openshift.common.is_containerized | bool and install_result | changed
+
+- name: Create bind zone dir
+ file: path=/var/named state=directory
+ when: openshift.common.is_containerized | bool
- name: Configure Bind
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
- validate: "{{ item.validate }}"
with_items:
- src: openshift-cluster.zone
dest: /var/named/openshift-cluster.zone
- validate: "named-checkzone {{ dns_zones[0] }} %s"
- src: named.conf
dest: /etc/named.conf
- validate: "named-checkconf %s"
notify: restart bind
- name: Enable Bind