Skip to main content

Update

Update NTP configuration on a target host. The server list is rewritten to /etc/chrony/conf.d/osapi-ntp.conf and chrony is reloaded immediately. Fails if NTP configuration is not currently managed -- use create first:

$ osapi client node ntp update --target web-01 \
--servers ntp.example.com

Job ID: 550e8400-e29b-41d4-a716-446655440000

STATUS CHANGED ERROR
ok true

If the server list is already identical, changed: false is returned and the file is not rewritten:

$ osapi client node ntp update --target web-01 \
--servers ntp.example.com

Job ID: 550e8400-e29b-41d4-a716-446655440000

STATUS CHANGED ERROR
ok false

Broadcast to all hosts at once:

$ osapi client node ntp update --target _all \
--servers 0.pool.ntp.org --servers 1.pool.ntp.org

Job ID: 550e8400-e29b-41d4-a716-446655440000

HOSTNAME STATUS CHANGED ERROR
web-01 ok true
web-02 ok true

JSON Output

Use --json to get the full API response:

$ osapi client node ntp update --target web-01 \
--servers ntp.example.com --json
{"results":[{"hostname":"web-01","changed":true,"status":"ok"}],"job_id":"..."}

Flags

FlagDescriptionDefault
--serversNTP server addresses (repeatable)required
-T, --targetTarget: _any, _all, hostname, or label (group:web)_any
-j, --jsonOutput raw JSON response