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

chrony.conf ubuntu crash #162

Open
MrOffline77 opened this issue Nov 30, 2022 · 4 comments
Open

chrony.conf ubuntu crash #162

MrOffline77 opened this issue Nov 30, 2022 · 4 comments

Comments

@MrOffline77
Copy link

The timesync role places the chrony.conf into /etc for each OS. Ubuntu (DEBIAN) expects the config in the /etc/chrony/ directory. Should be handled inside /tasks/main.yml as os specific variable.

- name: Generate chrony.conf file
  template:
    src: chrony.conf.j2
    dest: /etc/chrony.conf
    backup: true
    mode: 0644
  notify: restart {{ 'chronyd' if timesync_mode == 1 else 'timemaster' }}
  when:
    - timesync_mode != 2
    - timesync_ntp_provider == 'chrony'
    - "'chrony' in ansible_facts.packages"
@richm
Copy link
Collaborator

richm commented Nov 30, 2022

The directory should be set in a file in vars/ - we have a Debian file - https://github.com/linux-system-roles/timesync/blob/master/vars/Debian.yml - is it different than Ubuntu?

@MrOffline77
Copy link
Author

Ubuntu expects the chrony.conf as describe above in a different directory. The Path is hardcoded in the main.yml see template copy process I quoted above. Would be great if we could introduce an option to change the target path for the template within the debian vars file as you mentioned.

@richm
Copy link
Collaborator

richm commented Nov 30, 2022

Rather than add a "one-off" setting specifically for Ubuntu to tasks/main.yml, I would like to refactor the code to handle this case better:

We can then use this same approach for /etc/ntp.conf, /etc/ptp4l.conf, /etc/sysconfig/phc2sys, /etc/sysconfig/network, and any other platform differences.

One problem is that even though the code "supports" Debian, Ubuntu, etc., we have no CI testing on anything except RedHat os_family platforms, so we would have no way of knowing if the refactoring introduced any regressions.

@Thulium-Drake
Copy link
Contributor

I have made a PR addressing the location #187 as the role didn't crash on Debian, but the configuration wasn't effectuated after running the role 😅

That should fix this issue as well, as Ubuntu should match with os_family.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants