aboutsummaryrefslogblamecommitdiffstats
path: root/roles/fedora/tasks/timesyncd.yml
blob: 0d6ac875c904cb4e9a826f4bccbb35091ff8cbb2 (plain) (tree)
1
2
3
4
5
6
7
8
9
   


                                                                               




                                             

                                                                       



                                   
                                        






                                                             
                                                                                                
              

                        
---
- name: Configure timesyncd.conf
  vars:
    timesyncd_conf: '{{ timesyncd_conf_default|combine(timesyncd_conf_role) }}'
  ini_file:
    path: '/etc/systemd/timesyncd.conf'
    no_extra_spaces: yes
    section: "{{ item.key.split('.',1)[0] }}"
    option:  "{{ item.key.split('.',1)[1] }}"
    value:   "{{ (item.value is string)|ternary(item.value,omit) }}"
    state:   "{{ (item.value is string)|ternary('present','absent') }}"
  with_dict: '{{ timesyncd_conf }}'
  when: use_timesyncd
  notify: restart timesyncd

- name: Enable/disable systemd-timesyncd
  systemd:
    name: systemd-timesyncd.service
    enabled: "{{ use_timesyncd|ternary('yes','no') }}"
    masked: no
    state: "{{ use_timesyncd|ternary('started','stopped') }}"
  when: not chroot
- name: '- when in chroot'
  command: "systemctl {{ use_timesyncd|ternary('enable','disable') }} systemd-timesyncd.service"
  when: chroot

# vim: set ts=2 sw=2 et: