Keeping the time in sync for all your hosts with multiple major versions of one operating system can be challenging. Luckily, there's the linux-system-roles.timesync-role which will take care of pretty much everything using ansible.
First, let's add the roles/requirements.yml file and install the role:
[archy@ansible01 ~]$ vim roles/requirements.yml
---
- src: https://github.com/linux-system-roles/timesync.git
scm: git
name: linux-system-roles.timesync
...
[archy@ansible01 ~]$ ansible-galaxy role install -r roles/requirements.yml -p ./roles/ --force
Now with the roles being present, create a playbook that will use the role and run on every host on your inventory. I'll just extend my base-playbook which will do basic configurations on all systems:
[archy@ansible01 ~]$ vim deploy_base.yml
- hosts: all:!ipa[0-9][0-9].archyslife.lan
user: ansible-executor
become: true
gather_facts: true
vars:
timesync_ntp_servers:
- hostname: ipa01.archyslife.lan
minpoll: 6
maxpoll: 10
iburst: true
pool: false
- hostname: ipa02.archyslife.lan
minpoll: 6
maxpoll: 10
iburst: true
pool: false
timesync_dhcp_ntp_servers: false
timesync_min_sources: 1
timesync_ntp_provider: chrony
roles:
- linux-system-roles.timesync
I'm excluding my ipa-servers here since they will be the source for the environment and should not be configured as a chrony client. At the next run, all servers will be configured to use chrony as the timesync daemon and utilize both ipa-servers as timesources.
Feel free to comment and / or suggest a topic.
Comments
Post a Comment