Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust wants/requires to ensure services run as expected #18

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions roles/dhcpd/templates/dhcpd-announce.service.j2
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[Unit]
Description=Announce dhcpd
BindsTo=dhcpd.service
After=dhcpd.service

[Service]
ExecStart=/bin/sh -c "while true; do /usr/bin/etcdctl set {{ lochness_etcd_prefix }}/services/dhcpd/{{machine_id}} '{ \"target\": \"{{machine_id}}\", \"port\": 67 }' --ttl 60 > /dev/null; sleep 30; done"
ExecStop=/usr/bin/etcdctl rm {{ lochness_etcd_prefix }}/services/dhcpd/{{machine_id}}
User=nobody
RestartSec=10s
Restart=always
Restart=always
3 changes: 2 additions & 1 deletion roles/dhcpd/templates/dhcpd.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Description=IPv4 DHCP server
Wants=network.target
After=network.target
BindsTo=dhcpd-announce.service

[Service]
ExecStart=/usr/bin/dhcpd -4 -d -q -f -cf /etc/dhcpd/dhcpd.conf
Expand All @@ -11,4 +12,4 @@ RestartSec=5s
Restart=always

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
1 change: 0 additions & 1 deletion roles/dhcrelay/templates/dhcrelay-announce.service.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[Unit]
Description=Announce dhcrelay
BindsTo=dhcrelay.service
After=dhcrelay.service

[Service]
ExecStart=/bin/sh -c "while true; do /usr/bin/etcdctl set {{ lochness_etcd_prefix }}/services/dhcrelay/{{machine_id}} '{ \"target\": \"{{machine_id}}\", \"port\": 67 }' --ttl 60 > /dev/null; sleep 30; done"
Expand Down
1 change: 1 addition & 0 deletions roles/dhcrelay/templates/dhcrelay.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Description=IPv4 DHCP relay
Wants=network.target
After=network.target
BindsTo=dhcrelay-announce.service

[Service]
EnvironmentFile=/etc/sysconfig/isc-dhcp-relay
Expand Down
1 change: 1 addition & 0 deletions roles/dns/templates/named.service.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[Unit]
Description=Berkeley Internet Name Domain (DNS)
After=network.target
Wants=dns-announce.service

[Service]
ExecStart=/usr/sbin/named -u {{ dns_user }} -c /etc/named/named.conf -g
Expand Down
4 changes: 3 additions & 1 deletion roles/dns/templates/queensland.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Description=Queensland DNS Server
Wants=network.target
After=network.target
Requires=etcd.service
Wants=etcd.service
Wants=dns-announce.service

[Service]
ExecStart=/usr/sbin/queensland -domain {{ lochness_domain }}. -prefix {{ lochness_etcd_prefix }}
Expand All @@ -13,3 +14,4 @@ Restart=always

[Install]
WantedBy=multi-user.target
WantedBy=etcd.service
1 change: 0 additions & 1 deletion roles/enfield/templates/enfield-announce.service.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[Unit]
Description=Announce enfield
BindsTo=enfield.service
After=enfield.service

[Service]
ExecStart=/bin/sh -c "while true; do /usr/bin/etcdctl set {{ lochness_etcd_prefix }}/services/ipxe/{{machine_id}} '{ \"target\": \"{{machine_id}}\", \"port\": 67 }' --ttl 60 > /dev/null; sleep 30; done"
Expand Down
2 changes: 2 additions & 0 deletions roles/enfield/templates/enfield.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Description=Enfield iPXE Config server
Wants=network.target
After=network.target
BindsTo=enfield-annnounce.service

[Service]
ExecStart=/usr/sbin/enfield -base http://ipxe.services.{{ lochness_domain }}:8888 -options "noapic acpi=off ramdisk_size=200000 rw mistify.zfs=auto"
Expand All @@ -12,3 +13,4 @@ Restart=always

[Install]
WantedBy=multi-user.target
WantedBy=etcd.service
3 changes: 2 additions & 1 deletion roles/lochness/templates/node-announce.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Description=Announce Node
ExecStart=/bin/sh -c "while true; do /usr/bin/etcdctl set {{ lochness_etcd_prefix }}/nodes/{{machine_id}} '{ \"ip\": \"{{ ansible_default_ipv4.address }}\" }' > /dev/null; sleep 300; done"
User=nobody
RestartSec=30s
Restart=always
Restart=always

1 change: 0 additions & 1 deletion roles/tftpd/templates/tftpd-announce.service.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[Unit]
Description=Announce tftpd
BindsTo=tftpd.service
After=tftpd.service

[Service]
ExecStart=/bin/sh -c "while true; do /usr/bin/etcdctl set {{ lochness_etcd_prefix }}/services/tftpd/{{machine_id}} '{ \"target\": \"{{machine_id}}.nodes.\", \"port\": 67 }' --ttl 60 > /dev/null; sleep 30; done"
Expand Down
5 changes: 5 additions & 0 deletions roles/tftpd/templates/tftpd.service.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
[Unit]
Description=TFTP Daemon
BindsTo=tftpd-announce.service

[Service]
ExecStart=/usr/bin/in.tftpd -s {{ tftpd_dir }}
StandardInput=socket
StandardOutput=inherit
StandardError=journal

[Install]
WantedBy=multi-user.target