Ansible-chrony時間同期サービスの導入を完了

1005 ワード

1.サービス側、手動構成
`#   chrony           ,             
sed -i '/^#allow 192/aallow 172.16.1.0/24' /etc/chrony.conf

`#           
systemctl start chronyd
systemctl enable chronyd

2.クライアントの一括実行、roles/chrony/tasks/main.yml
`#          
sed  -i '/server [0-3]./s/^//g' /etc/chrony.conf
sed  -i '/#server 3./aserver 172.16.1.41 iburst' /etc/chrony.conf

`#           
systemctl start chronyd
systemctl enable chronyd
- name: Edit chrony_server configure
  copy:
    src: chrony.conf
    dest: /etc/chrony.conf
  notify: Restart chronyd

- name: Start chrony
  systemd:
    name: chronyd
    state: started
    enabled: yes

3.クライアントバッチ実行、roles/chrony/hanlers/main.yml
#   chronyd     
systemctl restart chronyd
- name: Restart chronyd
  systemd:
    name: chronyd
    state: restarted

4.クライアント一括実行、roles/chrony/files/
chrony.conf