blob: 2f6084dbec9d349328575e8742d0a2cc9c6e224b [file] [log] [blame]
{% from "ntp/map.jinja" import client with context %}
{%- if client.enabled %}
{%- if grains.os_family == 'Arch' %}
ntp_remove_packages:
pkg.removed:
- names:
- openntpd
- require_in:
- pkg: ntp_packages
{%- endif %}
ntp_packages:
pkg.installed:
- name: ntp
{%- if grains.os_family == "RedHat" %}
ntp_client_group_and_user:
group.present:
- name: ntp
- require:
- pkg: ntp_packages
user.present:
- name: ntp
- shell: /sbin/nologin
- home: /etc/ntp
- groups:
- ntp
- require:
- group: ntp
- require_in:
- file: /etc/ntp.conf
{%- endif %}
/etc/ntp.conf:
file.managed:
- source: salt://ntp/files/ntp.conf
- template: jinja
- require:
- pkg: ntp_packages
ntp_service:
service.running:
- enable: true
- name: {{ client.service }}
- watch:
- file: /etc/ntp.conf
{%- endif %}