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:
parent
e794108547
commit
d2f11ddd1d
11 changed files with 73 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -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 }
|
||||
|
|
10
roles/mgrote.ntp/README.md
Normal file
10
roles/mgrote.ntp/README.md
Normal 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)
|
16
roles/mgrote.ntp/defaults/main.yml
Normal file
16
roles/mgrote.ntp/defaults/main.yml
Normal 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
|
7
roles/mgrote.ntp/handlers/main.yml
Normal file
7
roles/mgrote.ntp/handlers/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: restart ntpd
|
||||
become: yes
|
||||
systemd:
|
||||
name: ntp
|
||||
enabled: yes
|
||||
state: restarted
|
31
roles/mgrote.ntp/tasks/main.yml
Normal file
31
roles/mgrote.ntp/tasks/main.yml
Normal 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 }}"
|
7
roles/mgrote.ntp/templates/ntp.conf.j2
Normal file
7
roles/mgrote.ntp/templates/ntp.conf.j2
Normal 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
|
|
@ -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"
|
|
@ -1,2 +0,0 @@
|
|||
---
|
||||
base_timezone: "Europe/Berlin"
|
|
@ -1,4 +0,0 @@
|
|||
- name: Setze Zeitzone auf {{ base_timezone }}
|
||||
become: yes
|
||||
ansible.builtin.timezone:
|
||||
name: "{{ base_timezone }}"
|
Loading…
Reference in a new issue