ntpd: Initial version of role
This commit is contained in:
parent
e1edd338aa
commit
554e3f9701
4 changed files with 35 additions and 0 deletions
3
roles/ntpd/defaults/main.yml
Normal file
3
roles/ntpd/defaults/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
ntpd_servers:
|
||||
- time.foo.sh
|
5
roles/ntpd/handlers/main.yml
Normal file
5
roles/ntpd/handlers/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Restart ntpd
|
||||
ansible.builtin.service:
|
||||
name: ntpd
|
||||
state: restarted
|
16
roles/ntpd/tasks/main.yml
Normal file
16
roles/ntpd/tasks/main.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
- name: Create config
|
||||
ansible.builtin.template:
|
||||
dest: /etc/ntpd.conf
|
||||
src: ntpd.conf.j2
|
||||
mode: "0644"
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
validate: "/usr/sbin/ntpd -f %s -n"
|
||||
notify: Restart ntpd
|
||||
|
||||
- name: Enable service
|
||||
ansible.builtin.service:
|
||||
name: ntpd
|
||||
state: started
|
||||
enabled: true
|
11
roles/ntpd/templates/ntpd.conf.j2
Normal file
11
roles/ntpd/templates/ntpd.conf.j2
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% if ntpd_listen is defined %}
|
||||
# listen to network
|
||||
{% for listen in ntpd_listen %}
|
||||
listen on {{ listen }}
|
||||
{% endfor %}
|
||||
|
||||
{% endif %}
|
||||
# remote servers
|
||||
{% for server in ntpd_servers %}
|
||||
server {{ server }}
|
||||
{% endfor %}
|
Loading…
Add table
Add a link
Reference in a new issue