Skip to content

Commit

Permalink
Updated gateways_kea_build role:
Browse files Browse the repository at this point in the history
- Moved systemd files from external git repo to template files.
- Let start kea after postgres is started if leases backend is set to be psql
  • Loading branch information
descilla committed Apr 1, 2017
1 parent 2ca4df6 commit 1114e78
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 28 deletions.
33 changes: 5 additions & 28 deletions gateways_kea_build/tasks/main.yml
Expand Up @@ -37,32 +37,9 @@
- "make install"
- "ldconfig"

- name: Clone ISC KEA contrib git repo
git: repo=https://github.com/isc-projects/kea-contrib.git dest=/srv/kea-contrib clone=yes update=no

- name: copy systemd files
copy: src="/srv/kea-contrib/systemd/{{item}}.in" remote_src=True force=no dest="/lib/systemd/system/{{item}}"
with_items:
- kea-dhcp4.service
- kea-dhcp6.service
- kea-dhcp-ddns.service

- name: replace @sbindir@
replace: dest="/lib/systemd/system/{{item}}" regexp="\@sbindir\@" replace="/usr/local/sbin"
- name: Depoly systemd files
template: src="{{item}}" dest="/lib/systemd/system/{{item[:-3]}}"
with_items:
- kea-dhcp4.service
- kea-dhcp6.service
- kea-dhcp-ddns.service

- name: replace @sysconfdir@
replace: dest="/lib/systemd/system/{{item}}" regexp="\@sysconfdir\@" replace="/etc"
with_items:
- kea-dhcp4.service
- kea-dhcp6.service
- kea-dhcp-ddns.service

- name: create /etc/kea directory
file: path=/etc/kea state="directory"

- name: create /var/kea directory
file: path=/var/kea state="directory"
- kea-dhcp4.service.j2
- kea-dhcp6.service.j2
- kea-dhcp-ddns.service.j2
13 changes: 13 additions & 0 deletions gateways_kea_build/templates/kea-dhcp-ddns.service.j2
@@ -0,0 +1,13 @@
[Unit]
Description=Kea DHCP-DDNS Server
Documentation=man:kea-dhcp-ddns(8)
Wants=network-online.target{% if kea.database.type == "postgresql" %} postgresql.service{% endif %}

After=network-online.target time-sync.target{% if kea.database.type == "postgresql" %} postgresql.service{% endif %}


[Service]
ExecStart=/usr/local/sbin/kea-dhcp-ddns -c /etc/kea/kea.conf

[Install]
WantedBy=multi-user.target
13 changes: 13 additions & 0 deletions gateways_kea_build/templates/kea-dhcp4.service.j2
@@ -0,0 +1,13 @@
[Unit]
Description=Kea DHCPv4 Server
Documentation=man:kea-dhcp4(8)
Wants=network-online.target{% if kea.database.type == "postgresql" %} postgresql.service{% endif %}

After=network-online.target time-sync.target{% if kea.database.type == "postgresql" %} postgresql.service{% endif %}


[Service]
ExecStart=/usr/local/sbin/kea-dhcp4 -c /etc/kea/kea.conf

[Install]
WantedBy=multi-user.target
13 changes: 13 additions & 0 deletions gateways_kea_build/templates/kea-dhcp6.service.j2
@@ -0,0 +1,13 @@
[Unit]
Description=Kea DHCPv6 Server
Documentation=man:kea-dhcp6(8)
Wants=network-online.target{% if kea.database.type == "postgresql" %} postgresql.service{% endif %}

After=network-online.target time-sync.target{% if kea.database.type == "postgresql" %} postgresql.service{% endif %}


[Service]
ExecStart=/usr/local/sbin/kea-dhcp6 -c /etc/kea/kea.conf

[Install]
WantedBy=multi-user.target

0 comments on commit 1114e78

Please sign in to comment.