diff --git a/ansible/inventory/genestack/group_vars/all/all.yml b/ansible/inventory/genestack/group_vars/all/all.yml index e6b52210..615135af 100644 --- a/ansible/inventory/genestack/group_vars/all/all.yml +++ b/ansible/inventory/genestack/group_vars/all/all.yml @@ -124,8 +124,8 @@ kube_webhook_token_auth_url_skip_tls_verify: false ## NTP Settings # Start the ntpd or chrony service and enable it at system boot. -ntp_enabled: true -ntp_manage_config: true +ntp_enabled: false +ntp_manage_config: false ntp_servers: - "0.pool.ntp.org iburst" - "1.pool.ntp.org iburst" diff --git a/ansible/roles/host_setup/defaults/main.yml b/ansible/roles/host_setup/defaults/main.yml index f9beef4c..21934cf2 100644 --- a/ansible/roles/host_setup/defaults/main.yml +++ b/ansible/roles/host_setup/defaults/main.yml @@ -128,3 +128,8 @@ host_specific_kernel_modules: [] # Optional user defined list of sysctl options in the same dict item format as # above. user_kernel_options: [] + +# Limited to two servers, the first one is the primary and the second one is the backup. +host_ntp_server: + - 0.pool.ntp.org + - 1.pool.ntp.org diff --git a/ansible/roles/host_setup/handlers/main.yml b/ansible/roles/host_setup/handlers/main.yml index 9fc3f70f..4c33c49f 100644 --- a/ansible/roles/host_setup/handlers/main.yml +++ b/ansible/roles/host_setup/handlers/main.yml @@ -38,3 +38,9 @@ name: "queue_max.service" state: "restarted" enabled: true + +- name: Reload systemd-timesyncd + ansible.builtin.systemd: + name: systemd-timesyncd.service + state: restarted + enabled: true diff --git a/ansible/roles/host_setup/tasks/main.yml b/ansible/roles/host_setup/tasks/main.yml index 365ea75e..ec93fcc5 100644 --- a/ansible/roles/host_setup/tasks/main.yml +++ b/ansible/roles/host_setup/tasks/main.yml @@ -122,11 +122,16 @@ retries: 5 delay: 2 -# this is added to remove conflicts with systemd-timesyncd and ntpsec with kubespray installation -- name: Ensure conflicting time synchronization packages are removed - package: - name: - - ntpsec - - systemd-timesyncd - state: absent - purge: yes +- name: Ensure timesyncd is running + ansible.builtin.service: + name: systemd-timesyncd + state: started + enabled: true + notify: Reload systemd-timesyncd + +- name: Create systemd-timesyncd configuration file + ansible.builtin.template: + src: timesyncd.conf.j2 + dest: /etc/systemd/timesyncd.conf + mode: "0644" + notify: Reload systemd-timesyncd diff --git a/ansible/roles/host_setup/templates/timesyncd.conf.j2 b/ansible/roles/host_setup/templates/timesyncd.conf.j2 new file mode 100644 index 00000000..7b33bee6 --- /dev/null +++ b/ansible/roles/host_setup/templates/timesyncd.conf.j2 @@ -0,0 +1,8 @@ +[Time] +NTP={{ host_ntp_server | first }} +FallbackNTP={{ host_ntp_server | last }} +#RootDistanceMaxSec=5 +#PollIntervalMinSec=32 +#PollIntervalMaxSec=2048 +#ConnectionRetrySec=30 +#SaveIntervalSec=60 diff --git a/ansible/roles/host_setup/vars/ubuntu.yml b/ansible/roles/host_setup/vars/ubuntu.yml index a3e9b6ad..3e547cac 100644 --- a/ansible/roles/host_setup/vars/ubuntu.yml +++ b/ansible/roles/host_setup/vars/ubuntu.yml @@ -55,6 +55,7 @@ _host_distro_packages: - rsync - software-properties-common - sysstat + - systemd-timesyncd - time - vlan - wget diff --git a/docs/openstack-data-disk-recovery.md b/docs/openstack-data-disk-recovery.md index 0c1ab901..6839240b 100644 --- a/docs/openstack-data-disk-recovery.md +++ b/docs/openstack-data-disk-recovery.md @@ -38,7 +38,7 @@ modprobe nbd max_part=8 ### Connect qemu-nbd to the Disk File ``` shell -qemu-nbd --connect=/dev/nbd0 /var/lib/nova/instances/00000000-0000-0000-0000-000000000000 +qemu-nbd --connect=/dev/nbd0 /var/lib/nova/instances/00000000-0000-0000-0000-000000000000/disk ``` - This command associates the instance disk file with the `/dev/nbd0` block device.