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 }}"'
|
||||
|
||||
- name: Create systemd service
|
||||
file:
|
||||
path: "{{ bind_systemd_service_path }}"
|
||||
template:
|
||||
src: bind9.service.j2
|
||||
dest: "{{ bind_systemd_service_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
state: touch
|
||||
register: create_bind_systemd
|
||||
|
||||
- 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
|
||||
force: yes
|
||||
backup: yes
|
||||
notify: restart bind
|
||||
|
||||
- name: Create directories
|
||||
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