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

Restart services after modifying #26

Open
IamEnTm opened this issue May 9, 2021 · 1 comment
Open

Restart services after modifying #26

IamEnTm opened this issue May 9, 2021 · 1 comment

Comments

@IamEnTm
Copy link

IamEnTm commented May 9, 2021

I might be missing something, but it seems the chrony service is never restarted, which means that any changes made on the configuration file won't be applied when this role has finished running. I think adding a restart when this service is mentioned as the 'ubuntu2004cis_time_synchronization', is a good idea.
I came across this issue while configuring the chrony service, but it might occur on other services as well.

*Edit: the chrony service is used in 'section2'.

@ljluestc
Copy link

---
- name: Configure and restart chrony service
  hosts: your_target_hosts
  tasks:
    - name: Ensure chrony package is installed
      apt:
        name: chrony
        state: present

    - name: Configure chrony.conf
      template:
        src: chrony.conf.j2
        dest: /etc/chrony/chrony.conf
      notify: Restart chrony service

  handlers:
    - name: Restart chrony service
      systemd:
        name: chrony
        state: restarted

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

2 participants