openstack-ansible-lxc_hosts/templates/lxc-dnsmasq-systemd-init.j2
Mohammed Naser c5a8965557 Switch lxc-dnsmasq to start before lxc
The current state of lxc-dnsmasq starts it after the network
subsystem is started (but not necessarily up) and it could
possibly start after lxc.  This changes things to reflect how
lxc-net upstream systemd file sets up dependencies[1].

[1]: https://github.com/lxc/lxc/blob/master/config/init/systemd/lxc-net.service.in

Change-Id: If378446333dd09e378b3acd297c58fd59ce04789
2018-06-05 12:37:24 -04:00

44 lines
1.0 KiB
Django/Jinja

# {{ ansible_managed }}
[Unit]
Description=lxc dnsmasq service
After=network-online.target
Before=lxc.service
[Service]
Type=simple
User=root
{% if lxc_net_manage_iptables | bool %}
ExecStartPre=/usr/local/bin/lxc-system-manage iptables-create
{% endif %}
ExecStartPre=-/usr/bin/killall -u lxc-dnsmasq --regexp "^dnsmasq"
ExecStart=/usr/local/bin/lxc-system-manage dnsmasq-start
ExecStop=-/usr/local/bin/lxc-system-manage dnsmasq-stop
{% if lxc_net_manage_iptables | bool %}
ExecStopPost=-/usr/local/bin/lxc-system-manage iptables-remove
{% endif %}
PIDFile=/run/lxc/dnsmasq.pid
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=120
Restart=on-failure
RestartSec=2
# This creates a specific slice which all services will operate from
# The accounting options give us the ability to see resource usage through
# the `systemd-cgtop` command.
Slice=lxc-dnsmasq.slice
CPUAccounting=true
BlockIOAccounting=true
MemoryAccounting=false
TasksAccounting=true
[Install]
WantedBy=multi-user.target