Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PTP refactor #380

Merged
merged 3 commits into from
Feb 14, 2024
Merged
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
31 changes: 25 additions & 6 deletions playbooks/cluster_setup_network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
- not apply_config
- ptp_interface.changed
when:
- ptp_vlan_interface is defined
- ptp_vlan is defined
- ptp_vlan_address is defined
- name: Restart systemd-networkd
Expand All @@ -104,14 +103,36 @@
name: systemd-timesyncd.service
enabled: no
state: stopped
- name: Add the ptp4l configuration file
copy:
src: ../src/ptp4l.conf
dest: /etc/ptp4l.conf
owner: root
group: root
mode: 0644
- name: Ensure /etc/systemd/system/[email protected] directory exists
file:
path: /etc/systemd/system/[email protected]
state: directory
owner: root
group: root
mode: 0755
- name: Configure ptp4l service to use a configuration file
copy:
src: ../src/ptp4l.service.override
dest: /etc/systemd/system/[email protected]/override.conf
owner: root
group: root
mode: 0644
- name: Enable ptp service
ansible.builtin.systemd:
name: [email protected]
enabled: yes
daemon_reload: yes
- name: Start ptp service
ansible.builtin.systemd:
name: [email protected]
state: started
state: restarted
when: apply_config or (need_reboot is defined and not need_reboot)
- name: Enable phc2sys service
ansible.builtin.systemd:
Expand All @@ -120,12 +141,10 @@
- name: Start phc2sys service
ansible.builtin.systemd:
name: [email protected]
state: started
state: restarted
when: apply_config or (need_reboot is defined and not need_reboot)

when:
- ptp_vlan_interface is defined
- ptp_vlan is defined
when: ptp_vlan is defined

- name: Configure hostname
hosts:
Expand Down
26 changes: 26 additions & 0 deletions src/ptp4l.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[Global]
slaveOnly 1
gmCapable 1

domainNumber 0

# Announce interval: 1s
logAnnounceInterval 0

# Sync interval: 1 s
logSyncInterval 0

# Pdelay interval: 1 s
logMinPdelayReqInterval 0

# Announce receipt time-out: 3 s (fixed)
announceReceiptTimeout 3

priority1 255
priority2 255
# Default clock class : any specialised clock will be better (ie a GPS Grand Master Clock)
network_transport L2
delay_mechanism P2P
clockClass 248
clockAccuracy 0xFE
offsetScaledLogVariance 0xFFFF
3 changes: 3 additions & 0 deletions src/ptp4l.service.override
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Service]
ExecStart=
ExecStart=/usr/sbin/ptp4l -q -m -f /etc/ptp4l.conf -i %I
2 changes: 1 addition & 1 deletion vars/network_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
_systemd_networkd_network_custom: ["{{ custom_network | default([]) }}"]
_systemd_networkd_netdev_custom: ["{{ custom_netdev | default([]) }}"]

_vlan_conditionnal: "{% if ptp_vlan is defined %}[{'VLAN': 'ptp'}]{% else %}[]{% endif %}"
_vlan_conditionnal: "{% if ptp_vlan is defined and ptp_vlan_interface and ptp_vlan_interface == network_interface %}[{'VLAN': 'ptp'}]{% else %}[]{% endif %}"

_network_common:
- Gateway: "{{ gateway_addr }}"
Expand Down