{"id":19871853,"url":"https://github.com/saltstack-formulas/napalm-ntp-formula","last_synced_at":"2026-03-11T15:37:33.240Z","repository":{"id":98895878,"uuid":"79236724","full_name":"saltstack-formulas/napalm-ntp-formula","owner":"saltstack-formulas","description":"Formula to manage the NTP configuration on network devices, following the OpenConfig system YANG model: http://ops.openconfig.net/branches/master/openconfig-interfaces.html","archived":false,"fork":false,"pushed_at":"2017-09-25T09:01:21.000Z","size":17,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-05-02T09:48:44.979Z","etag":null,"topics":["automation","formula","napalm","network","ntp","openconfig","salt","saltstack","yang","yang-model"],"latest_commit_sha":null,"homepage":"https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saltstack-formulas.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-01-17T14:41:37.000Z","updated_at":"2019-07-02T00:08:05.000Z","dependencies_parsed_at":"2024-01-07T18:07:57.444Z","dependency_job_id":"1515a86a-285b-4e4b-8c96-1060a1e4b7fb","html_url":"https://github.com/saltstack-formulas/napalm-ntp-formula","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/saltstack-formulas/napalm-ntp-formula","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saltstack-formulas%2Fnapalm-ntp-formula","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saltstack-formulas%2Fnapalm-ntp-formula/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saltstack-formulas%2Fnapalm-ntp-formula/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saltstack-formulas%2Fnapalm-ntp-formula/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saltstack-formulas","download_url":"https://codeload.github.com/saltstack-formulas/napalm-ntp-formula/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saltstack-formulas%2Fnapalm-ntp-formula/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30386183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T14:10:17.325Z","status":"ssl_error","status_checked_at":"2026-03-11T14:09:37.934Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","formula","napalm","network","ntp","openconfig","salt","saltstack","yang","yang-model"],"created_at":"2024-11-12T16:13:48.631Z","updated_at":"2026-03-11T15:37:33.220Z","avatar_url":"https://github.com/saltstack-formulas.png","language":"HTML","funding_links":[],"categories":["Pre-written Salt States (Formulas)"],"sub_categories":["NETCONF"],"readme":"==================\nnapalm-ntp-formula\n==================\n\nSalt formula to manage the NTP configuration on network devices, managed via\n`NAPALM \u003chttps://napalm-automation.net\u003e`_,\neither running under a `proxy minion \u003chttps://docs.saltstack.com/en/develop/ref/proxy/all/salt.proxy.napalm.html\u003e`_,\nor installing the ``salt-minion`` directly on the network device (if the operating system permits).\n\nCheck the `Salt Formulas instructions \u003chttps://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html\u003e`_ to understand how to install and use formulas.\n\nAvailable states\n================\n\n.. contents::\n    :local:\n\n``netconfig``\n-------------\n\nGenerate the configuration using Jinja templates and load the rendered configuration on the network device. The\ntemplates are pre-written for several operating systems:\n\n- Junos\n- Cisco IOS-XR\n- Arista EOS\n- Cisco IOS\n- Cisco NX-OS\n\nIf you have a different operating system not covered yet, please submit a PR to add it.\n\nPillar\n======\n\nThe pillar has the same structure in both cases, following the hierarchy of the\n`openconfig-system YANG model \u003chttp://ops.openconfig.net/branches/master/openconfig-system.html\u003e`_, e.g.:\n\n.. code-block:: yaml\n\n    openconfig-system:\n      system:\n        ntp:\n          config:\n            ntp_source_address: 10.10.10.1\n            ntp_source_interface: Loopback0\n            ntp_serve_all: true\n            ntp_update_calendar: true\n          ntp_keys:\n            ntp_key:\n              1:\n                config:\n                  key_type: md5\n                  key_value: secretntpkey\n          servers:\n            server:\n              172.17.19.1:\n                config:\n                  association_type: SERVER\n                  prefer: true\n                  iburst: true\n              172.17.19.2:\n                config:\n                  association_type: PEER\n                  version: 2\n\n.. note::\n    Some platforms may not support several options, e.g.:\n\n    - ``iburst`` is not available on Junos and NX-OS.\n    - ``ntp-keys`` is ignored on IOS-XR.\n    - ``version`` is not available on NX-OS.\n    - ``ntp_source_interface`` is not available on Junos.\n    - ``ntp_serve_all`` is only available on EOS: Permit NTP requests received on any interface.\n    - ``ntp_update_calendar`` is only available on IOS-XR: Periodically update calendar with NTP time.\n\nUsage\n=====\n\nAfter configuring the pillar data (and refresh it to the minions, i.e. ``$ sudo salt '*' saltutil.refresh_pillar``),\nyou can run this formula:\n\n.. code-block:: bash\n\n    $ sudo salt '*' state.sls ntp.netconfig\n\nOutput Example:\n\n.. code-block:: bash\n\n    $ sudo salt vmx1 state.sls ntp.netconfig\n    vmx1:\n    ----------\n              ID: oc_ntp_netconfig\n        Function: netconfig.managed\n          Result: True\n         Comment: Configuration changed!\n         Started: 14:43:55.454470\n        Duration: 3884.221 ms\n         Changes:\n                  ----------\n                  diff:\n                      [edit system]\n                      +   ntp {\n                      +       server 172.17.19.1;\n                      +       peer 172.17.19.2;\n                      +   }\n\n    Summary for vmx1\n    ------------\n    Succeeded: 1 (changed=1)\n    Failed:    0\n    ------------\n    Total states run:     1\n    Total run time:   3.884 s\n\n\n``test_netconfig``\n------------------\n\nTo avoid testing the state directly on the network device, you can use this\nstate to save the contents in a temporary file, and display the rendered content\non the command line:\n\n.. code-block:: bash\n\n    $ sudo salt '*' state.sls ntp.test_netconfig\n\nOutput example:\n\n.. code-block:: bash\n\n    $ sudo salt vmx state.sls ntp.test_netconfig\n    vmx1:\n    ----------\n              ID: file.read\n        Function: module.run\n          Result: True\n         Comment: Module function file.read executed\n         Started: 16:18:49.456620\n        Duration: 0.884 ms\n         Changes:\n                  ----------\n                  ret:\n                      system {\n                        replace:\n                        ntp {\n                          source-address 10.10.10.1;\n                          authentication-key 1 type md5 value secretntpkey;\n                          server 172.17.19.1 prefer version 4;\n                          peer 172.17.19.2 version 2;\n                        }\n                      }\n\n``netyang``\n-----------\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaltstack-formulas%2Fnapalm-ntp-formula","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaltstack-formulas%2Fnapalm-ntp-formula","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaltstack-formulas%2Fnapalm-ntp-formula/lists"}