{% from "ntp/map.jinja" import ntp with context %}
collectd_restart:
  cmd.wait:
    - name: service collectd restart
    - watch:
      - pkg: ntp
      
ntp:
  pkg.installed:
    - version: {{ ntp.version }}
  service.running:
    - watch:
      - file: /etc/ntp.conf
  file.managed:
    - name: /etc/ntp.conf
    - source: salt://ntp/templates/ntp.conf
    - mode: 644
    - template: jinja
    - require:
      - pkg: ntp

{% from "ntp/map.jinja" import ntp with context %}
{% if salt['status.pid']('collectd') %}
collectd_restart:
  cmd.wait:
    - name: service collectd restart
    - watch:
      - pkg: ntp
{% endif %}

ntp:
  pkg.installed:
    - version: {{ ntp.version }}
  service.running:
    - watch:
      - file: /etc/ntp.conf
  file.managed:
    - name: /etc/ntp.conf
    - source: salt://ntp/templates/ntp.conf
    - mode: 644
    - template: jinja
    - require:
      - pkg: ntp

Fix collectd restart on ntp installation
Fix collectd restart on ntp installation

We attempt to restart collectd whether or not its installed. This change
makes it so we check for the pid of a running collectd process before
attemption a restart.

ministryofjustice/ntp-formula