forked from evolix/ansible-roles
bind: extract systemd service file in a template
This commit is contained in:
parent
a798bf0ebc
commit
2f7116f676
|
@ -10,32 +10,15 @@
|
||||||
replace: 'OPTIONS="-u bind -t {{ bind_chroot_root }}"'
|
replace: 'OPTIONS="-u bind -t {{ bind_chroot_root }}"'
|
||||||
|
|
||||||
- name: Create systemd service
|
- name: Create systemd service
|
||||||
file:
|
template:
|
||||||
path: "{{ bind_systemd_service_path }}"
|
src: bind9.service.j2
|
||||||
|
dest: "{{ bind_systemd_service_path }}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
state: touch
|
force: yes
|
||||||
register: create_bind_systemd
|
backup: yes
|
||||||
|
notify: restart bind
|
||||||
- name: "Fill out systemd service"
|
|
||||||
blockinfile:
|
|
||||||
dest: "{{ bind_systemd_service_path }}"
|
|
||||||
block: |
|
|
||||||
[Unit]
|
|
||||||
Description=BIND Domain Name Server
|
|
||||||
Documentation=man:named(8)
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
EnvironmentFile=-/etc/default/bind9
|
|
||||||
ExecStart=/usr/sbin/named -f $OPTIONS
|
|
||||||
ExecReload=/usr/sbin/rndc reload
|
|
||||||
ExecStop=/usr/sbin/rndc stop
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
when: create_bind_systemd | changed
|
|
||||||
|
|
||||||
- name: Create directories
|
- name: Create directories
|
||||||
file:
|
file:
|
||||||
|
|
15
bind/templates/bind9.service.j2
Normal file
15
bind/templates/bind9.service.j2
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=BIND Domain Name Server
|
||||||
|
Documentation=man:named(8)
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
EnvironmentFile=-/etc/default/bind9
|
||||||
|
ExecStart=/usr/sbin/named -f $OPTIONS
|
||||||
|
ExecReload=/usr/sbin/rndc reload
|
||||||
|
ExecStop=/usr/sbin/rndc stop
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in a new issue