Add new zones to dedicated file instead of /etc/named.conf

kristian

Verified User
Joined
Nov 4, 2005
Messages
489
Location
Norway
Hi,

I'm in the process of automating as much as possible of our DA servers with Ansible, and I'd like to manage /etc/named.conf with automation. Since DA writes new zones to the bottom of this file, this is slightly difficult.

Is there a way to have DA write the new zone definitions to a separate file instead, that is included from /etc/named.conf?
 
You can use the script domain_create_post.sh to change how DA act.

In the specific, you may add an include in named.conf to load domain.conf (for example), than with domain_create_post.sh script (i think you will have to use also domain_destroy_post.sh) you can simply remove the line from named.conf that DA did add and add it to domain.conf file.

Regards
 
Hello,

As Andrea already mentioned you can use post scripts. Alternatively you can achieve this the following way.


1. Change directadmin to use another, fake named.conf, for example /etc/named.conf.fake

Code:
# touch /etc/named.conf.fake
# echo "namedconfig=/etc/named.conf.fake" >>  /usr/local/directadmin/conf/directadmin.conf

restart directadmin and check:

Code:
# /usr/local/directadmin/directadmin c | grep namedconfig
namedconfig=/etc/named.conf.fake

Make sure to copy zones from /etc/named.conf into /etc/named.conf.fake.

2. Fill the file /etc/named.conf with your own instructions. It won't be touched by Directadmin since that.
 
Back
Top