From 0d3bff5765fed72642b551964d6d953a7735949f Mon Sep 17 00:00:00 2001 From: ss75710541 <75710541@qq.com> Date: Fri, 22 Apr 2022 14:32:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20public=20network=20?= =?UTF-8?q?node=20chronyd=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/host-init/tasks/apt.yml | 1 + roles/host-init/tasks/publicInterface.yml | 3 +++ roles/host-init/templates/chrony.client.conf.j2 | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/roles/host-init/tasks/apt.yml b/roles/host-init/tasks/apt.yml index ee33812..17de3e8 100644 --- a/roles/host-init/tasks/apt.yml +++ b/roles/host-init/tasks/apt.yml @@ -44,6 +44,7 @@ - ca-certificates - gnupg - lsb-release + - network-manager update_cache: yes tags: install-base-tools diff --git a/roles/host-init/tasks/publicInterface.yml b/roles/host-init/tasks/publicInterface.yml index 2e46665..9317b28 100644 --- a/roles/host-init/tasks/publicInterface.yml +++ b/roles/host-init/tasks/publicInterface.yml @@ -1,3 +1,6 @@ +- name: Enabled NetworkManager + service: name=NetworkManager state=started enabled=yes + - name: Configure the public network card shell: nmcli connection add type tun ifname pip0 con-name pip0 mode tap ip4 {{ advertise_address }}/24 tags: publicNetwork diff --git a/roles/host-init/templates/chrony.client.conf.j2 b/roles/host-init/templates/chrony.client.conf.j2 index 524dfc5..ed4aca4 100644 --- a/roles/host-init/templates/chrony.client.conf.j2 +++ b/roles/host-init/templates/chrony.client.conf.j2 @@ -1,4 +1,8 @@ +{% if public_network_node %} +server {{ master_vip_advertise_address }} minpoll 4 maxpoll 10 iburst +{% else %} server {{ master_vip }} minpoll 4 maxpoll 10 iburst +{% endif %} driftfile /var/lib/chrony/drift makestep 10 3 rtcsync