Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- debian-10
- debian-11
- debian-12
- debian-13
- ubuntu-18.04
- ubuntu-20.04
- ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*.retry
/ubuntu*.log
/.idea
/.ansible
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Supported versions
| Debian Buster (10) | Yes | Yes |
| Debian Bullseye (11) | Yes | Yes |
| Debian Bookworm (12) | Yes | Yes |
| Debian Trixie (13) | Experimental | No |
| Devuan Ascii (2) | Yes | No |
| Raspbian Stretch (9) | Experimental | No |
| Raspbian Buster (10) | Experimental | No |
Expand Down Expand Up @@ -170,7 +171,7 @@ vagrant up docker-debian-bullseye # with docker
Install:

```commandline
pip install molecule molecule[docker]
pip install molecule molecule-plugins[docker]
```

Run:
Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dbs_ntp_hosts:
- '1.europe.pool.ntp.org'
- '2.europe.pool.ntp.org'
- '3.europe.pool.ntp.org'
dbs_ntp_pkg: 'ntp'
dbs_ntp_pkg: 'chrony'

# -------------------------
# Users/Groups
Expand Down
4 changes: 4 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
name: ntp
state: restarted

- name: Reload chrony sources
ansible.builtin.command: chronyc reload sources
changed_when: true

- name: restart cron
ansible.builtin.service:
name: cron
Expand Down
13 changes: 13 additions & 0 deletions molecule/debian-13/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---

platforms:
- name: debian-13
image: dokken/debian-13
command: /lib/systemd/systemd
dockerfile: ../_shared/Dockerfile.j2
capabilities:
- SYS_ADMIN
cgroupns_mode: host
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
privileged: true
4 changes: 2 additions & 2 deletions tasks/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
repo: "deb {{ item }}"
state: absent
when: item not in dbs_repo_new
loop: "{{ dbs_repo_old }}"
loop: "{{ dbs_repo_old | list }}"

- name: APT_REPOSITORY | Delete old deb-src repo
ansible.builtin.apt_repository:
repo: "deb-src {{ item }}"
state: absent
when: item not in dbs_repo_new
loop: "{{ dbs_repo_old }}"
loop: "{{ dbs_repo_old | list }}"

- name: APT_REPOSITORY | Add repositories
ansible.builtin.apt_repository:
Expand Down
20 changes: 19 additions & 1 deletion tasks/ntp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: ASSERT | validated package
ansible.builtin.assert:
that: 'dbs_ntp_pkg == "openntpd" or dbs_ntp_pkg == "ntp"'
that: 'dbs_ntp_pkg == "openntpd" or dbs_ntp_pkg == "ntp" or dbs_ntp_pkg == "chrony"'

- name: APT | Install NTP daemon
ansible.builtin.apt:
Expand All @@ -28,3 +28,21 @@
group: root
notify: restart ntp
when: dbs_ntp_pkg == 'ntp'

- name: BLOCK | Setup Chrony
when: dbs_ntp_pkg == 'chrony'
block:
- name: TEMPLATE | Deploy Chrony configuration file
ansible.builtin.template:
src: etc/chrony/sources.d/__tpl.sources.j2
dest: /etc/chrony/sources.d/default.sources
mode: 0644
owner: root
group: root
notify: Reload chrony sources

- name: SERVICE | Ensure Chrony is started and enabled
ansible.builtin.service:
name: chrony
state: started
enabled: true
7 changes: 7 additions & 0 deletions templates/etc/chrony/sources.d/__tpl.sources.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# {{ ansible_managed }}
#

{% for h in dbs_ntp_hosts %}
server {{ h }} iburst
{% endfor %}
Loading