Filip Pytloun | 10e4d6c | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1 | {% from "ntp/map.jinja" import client with context %} |
| 2 | |
| 3 | {%- if client.enabled %} |
| 4 | |
| 5 | {%- if grains.os_family == 'Arch' %} |
| 6 | |
| 7 | ntp_remove_packages: |
| 8 | pkg.removed: |
| 9 | - names: |
| 10 | - openntpd |
| 11 | - require_in: |
| 12 | - pkg: ntp_packages |
| 13 | |
| 14 | {%- endif %} |
| 15 | |
| 16 | ntp_packages: |
| 17 | pkg.installed: |
| 18 | - name: ntp |
| 19 | |
| 20 | {%- if grains.os_family == "RedHat" %} |
| 21 | |
| 22 | ntp_client_group_and_user: |
| 23 | group.present: |
| 24 | - name: ntp |
| 25 | - require: |
| 26 | - pkg: ntp_packages |
| 27 | user.present: |
| 28 | - name: ntp |
| 29 | - shell: /sbin/nologin |
| 30 | - home: /etc/ntp |
| 31 | - groups: |
| 32 | - ntp |
| 33 | - require: |
| 34 | - group: ntp |
| 35 | - require_in: |
| 36 | - file: /etc/ntp.conf |
| 37 | |
| 38 | {%- endif %} |
| 39 | |
| 40 | /etc/ntp.conf: |
| 41 | file.managed: |
| 42 | - source: salt://ntp/files/ntp.conf |
| 43 | - template: jinja |
| 44 | - require: |
| 45 | - pkg: ntp_packages |
| 46 | |
| 47 | ntp_service: |
| 48 | service.running: |
| 49 | - enable: true |
| 50 | - name: {{ client.service }} |
| 51 | - watch: |
| 52 | - file: /etc/ntp.conf |
| 53 | |
| 54 | {%- endif %} |