added chrony salt state

This commit is contained in:
Jonas Forsberg 2021-09-22 09:49:42 +02:00
parent 4020121517
commit cb7abf7c82
8 changed files with 61 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
salt/pillars/local.sls

6
salt/pillars/chrony.sls Normal file
View File

@ -0,0 +1,6 @@
chrony:
pool:
- 0.se.pool.ntp.org
- 1.se.pool.ntp.org
- 2.se.pool.ntp.org
- 3.se.pool.ntp.org

8
salt/pillars/network.sls Normal file
View File

@ -0,0 +1,8 @@
network:
domain: suse.lan
address: 192.168.0.0
netmask: 24
interface:
internal: eth0
external: eth0.1000

7
salt/pillars/top.sls Normal file
View File

@ -0,0 +1,7 @@
base:
'*':
- network
- chrony
{% if salt['file.file_exists']('local.sls') %}
- local
{% endif %}

View File

@ -0,0 +1,2 @@
local stratum 10
allow {{ pillar['network']['address'] }}/{{ pillar['network']['netmask'] }}

View File

@ -0,0 +1,3 @@
{% for pool in pillar['chrony']['pool'] -%}
server {{ pool }} iburst
{% endfor %}

View File

@ -0,0 +1,31 @@
install chrony:
pkg.installed:
- name: chrony
create chrony pool configuration:
file.managed:
- name: /etc/chrony.d/pool.conf
- source: salt://chrony/files/pool.conf.jinja
- template: jinja
- user: root
- group: chrony
- mode: "0640"
create chrony local configuration:
file.managed:
- name: /etc/chrony.d/local.conf
- source: salt://chrony/files/local.conf.jinja
- template: jinja
- user: root
- group: chrony
- mode: "0640"
start chronyd:
service.running:
- name: chronyd
- enable: True
- require:
- pkg: install chrony
- watch:
- file: create chrony pool configuration
- file: create chrony local configuration

3
salt/states/top.sls Normal file
View File

@ -0,0 +1,3 @@
base:
'*':
- chrony