diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index eaff792..b3fffff 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -17,6 +17,7 @@ jobs: - debian-10 - debian-11 - debian-12 + - debian-13 - ubuntu-18.04 - ubuntu-20.04 - ubuntu-22.04 diff --git a/.gitignore b/.gitignore index 515943d..b39e53a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.retry /ubuntu*.log /.idea +/.ansible diff --git a/README.md b/README.md index adb9c00..f9052a8 100644 --- a/README.md +++ b/README.md @@ -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 | @@ -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: diff --git a/defaults/main.yml b/defaults/main.yml index 1364525..8b0ec54 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/handlers/main.yml b/handlers/main.yml index 4df276e..5d4d972 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -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 diff --git a/molecule/debian-13/molecule.yml b/molecule/debian-13/molecule.yml new file mode 100644 index 0000000..18d1680 --- /dev/null +++ b/molecule/debian-13/molecule.yml @@ -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 diff --git a/tasks/apt.yml b/tasks/apt.yml index 0155b2a..e3cd657 100644 --- a/tasks/apt.yml +++ b/tasks/apt.yml @@ -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: diff --git a/tasks/ntp.yml b/tasks/ntp.yml index 5228e09..40581cc 100644 --- a/tasks/ntp.yml +++ b/tasks/ntp.yml @@ -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: @@ -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 diff --git a/templates/etc/chrony/sources.d/__tpl.sources.j2 b/templates/etc/chrony/sources.d/__tpl.sources.j2 new file mode 100644 index 0000000..7840ad6 --- /dev/null +++ b/templates/etc/chrony/sources.d/__tpl.sources.j2 @@ -0,0 +1,7 @@ +# +# {{ ansible_managed }} +# + +{% for h in dbs_ntp_hosts %} +server {{ h }} iburst +{% endfor %}