1

In /etc/ntp.conf would I like to change all servers to just

server ntp.example.com

in just one command line.

I can do it with ssh like so

augtool --autosave --noautoload --transform "ssh incl /etc/ssh/ssh_config" set "/files/etc/ssh/ssh_config/ServerAliveInterval" 60

Can something similar be done for server in /etc/ntp.conf?

Jasmine Lognnes
  • 2,520
  • 8
  • 33
  • 51

1 Answers1

3

Considering there are likely more than one server entries in your file originally, you need two commands to achieve this:

rm /files/etc/ntp.conf/server
set /files/etc/ntp.conf/server ntp.example.com

and augtool can only take one command as a one-liner.

What you can do however is to use stdin for this, e.g.:

echo -e "rm /files/etc/ntp.conf/server\nset /files/etc/ntp.conf/server ntp.example.com" | augtool -sAt "Ntp incl /etc/ntp.conf"
raphink
  • 11,987
  • 6
  • 37
  • 48