Rolle: ntp (#14)

Rolle neu

base_timezone --> ntp_timezone

Doku

mgrote.set_timezone --> mgrote.ntp

Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#14
Co-Authored-By: mg <mg@noreply.git.mgrote.net>
Co-Committed-By: mg <mg@noreply.git.mgrote.net>
This commit is contained in:
Michael Grote 2021-03-06 15:12:30 +01:00
parent e794108547
commit d2f11ddd1d
11 changed files with 73 additions and 20 deletions

View file

@ -55,7 +55,7 @@
- username: mg
password: "{{ lookup('keepass', 'mg_linux_password_hash', 'password') }}"
update_password: on_create
ssh_key: "{{ lookup('keepass', 'mg_ssh_pubkey', 'password') }}" #generieren: ssh-keygen -o; für putty andern https://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/ggcs/Change_private_key_format_for_Putty/Change_private_key_format_for_Putty.html#section2
ssh_key: "{{ lookup('keepass', 'mg_ssh_pubkey', 'password') }}" #generieren: ssh-keygen -o; für putty ändern https://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/ggcs/Change_private_key_format_for_Putty/Change_private_key_format_for_Putty.html#section2
use_sudo: yes
use_sudo_nopass: yes
user_state: present

View file

@ -1,6 +1,6 @@
---
- hosts: all
roles:
- { role: mgrote.set_timezone, tags: "timezone" }
- { role: mgrote.ntp, tags: "ntp" }
- { role: mgrote.restic, tags: "restic" }
- { role: ryandaniels.create_users, tags: "user", become: yes }

View file

@ -0,0 +1,10 @@
## mgrote.ntp
### Beschreibung
Installiert ntp-client, setzt die Zeitserver und konfiguriert die Zeitzone.
### Funktioniert auf
- [x] Ubuntu (>=18.04)
- [x] ProxMox ()>=6.1)
### Variablen + Defaults
see [defaults](./defaults/main.yml)

View file

@ -0,0 +1,16 @@
---
ntp_timezone: "Europe/Berlin" #Zeitzone in der sich der Cpmputer befindet
ntp_driftfile_directory: "/var/lib/ntp" # Ordner für das driftfile
ntp_servers: # welche Server sollen befragt werden
- address: ptbtime1.ptb.de
options: iburst #optionaler parameter
- address: ptbtime2.ptb.de
options: iburst
- address: ptbtime3.ptb.de
options: iburst
- address: time3.google.com
options: iburst
- address: ntp0.fau.de
options: iburst
ntp_daemon_user: ntp # Nutzer + Gruppe für den Dienst
ntp_daemon_group: ntp # Nutzer + Gruppe für den Dienst

View file

@ -0,0 +1,7 @@
---
- name: restart ntpd
become: yes
systemd:
name: ntp
enabled: yes
state: restarted

View file

@ -0,0 +1,31 @@
---
- name: install ntp packages
become: yes
ansible.builtin.package:
name:
- ntp
- ntpdate
state: present
- name: Create ntp driftfile folder
become: yes
file:
state: directory
path: "{{ ntp_driftfile_directory }}"
mode: 0644
owner: "{{ ntp_daemon_user }}"
group: "{{ ntp_daemon_group }}"
- name: create ntp.conf
become: yes
template:
src: "ntp.conf.j2"
dest: "/etc/ntp.conf"
mode: 0644
notify:
- restart ntpd
- name: set Zeitzone to {{ ntp_timezone }}
become: yes
ansible.builtin.timezone:
name: "{{ ntp_timezone }}"

View file

@ -0,0 +1,7 @@
# Servers
{% for item in ntp_servers %}
server {{ item.address }} {{ item.options |default() }}
{% endfor %}
# Drift file
driftfile {{ ntp_driftfile_directory }}/drift

View file

@ -1,12 +0,0 @@
## mgrote.set_timezone
### Beschreibung
setzt die Zeitzone
### Funktioniert auf
- [x] Ubuntu (>=18.04)
- [x] Debian
### Variablen + Defaults
##### Zeitzone:
base_timezone: "Europe/Berlin"

View file

@ -1,2 +0,0 @@
---
base_timezone: "Europe/Berlin"

View file

@ -1,4 +0,0 @@
- name: Setze Zeitzone auf {{ base_timezone }}
become: yes
ansible.builtin.timezone:
name: "{{ base_timezone }}"