Issue
Syncing Pis to a Master in Arch Linux Bash.
I am trying to configure a master Pi as an ntp server (which uses an external pool for time).
I have several child Pis that I need to configure to use the master Pi as their sync source.
Ideally I would like to have the master be able to get all the pi's connected to it as a time source, and gather the results from ntpq -pn
on all pis from the master.
I have setup the configuration on the master to use the pool to get the time. I have three child Pis that are configured to get time from the master's ip.
Any ideas on how to do this or links would be greatly appreciated.
Thanks, Ron
Solution
It sounds like you're trying to gather results of running ntpq -pn
on all of the PIs. This kind of problem is not NTP-specific, but rather a general remote-execution task. SSH is well-documented and standard. Salt Stack is more advanced and powerful.
SSH
- Setup SSH keys between the master and all other PIs.
- Loop over the hosts with:
for h in child1 child2; do ssh $h ntp -pn > ${h}.output; done
Salt Stack
- Setup the Salt Master on the master PI.
- Setup the child PIs as Salt Minions. (blog)
- Use Salt to run a command on all minions:
salt '*' cmd.run 'ntpq -pn'
Answered By - Eric Bolinger Answer Checked By - Dawn Plyler (WPSolving Volunteer)