diff options
| author | omnom62 <omnom62@outlook.com> | 2026-04-15 07:24:24 +1000 |
|---|---|---|
| committer | omnom62 <omnom62@outlook.com> | 2026-04-15 07:24:24 +1000 |
| commit | c3671c4e3e2ad7efa119982f2ee41334fcacd073 (patch) | |
| tree | 0084638d1b9f71b6be671324779238439f9da5d6 /plugins/modules/vyos_ntp_global.py | |
| parent | c9e5c5f6d91bae587a6ce8b7f055b0d068129fe2 (diff) | |
| download | rest.vyos-c3671c4e3e2ad7efa119982f2ee41334fcacd073.tar.gz rest.vyos-c3671c4e3e2ad7efa119982f2ee41334fcacd073.zip | |
Rest API module
Diffstat (limited to 'plugins/modules/vyos_ntp_global.py')
| -rw-r--r-- | plugins/modules/vyos_ntp_global.py | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/plugins/modules/vyos_ntp_global.py b/plugins/modules/vyos_ntp_global.py index d970142..bcfdd3b 100644 --- a/plugins/modules/vyos_ntp_global.py +++ b/plugins/modules/vyos_ntp_global.py @@ -362,23 +362,52 @@ def main(): # diff engine # -------------------------------------------------------- - commands = build_commands(desired, existing, state) + # commands = build_commands(desired, existing, state) - result["before"] = existing + # result["before"] = existing - result["commands"] = commands + # result["commands"] = commands - if commands: + # if commands: + + # result["changed"] = True + + # if not module.check_mode: - result["changed"] = True + # vyos.apply_commands(commands) - if not module.check_mode: + # result["after"] = desired - vyos.apply_commands(commands) + # module.exit_json(**result) - result["after"] = desired + commands = build_commands(desired, existing, state) + + if module.check_mode: + module.exit_json( + changed=bool(commands), + commands=commands, + before=existing, + ) - module.exit_json(**result) + if commands: + response = vyos.apply_commands(commands) + saved = vyos.save_config() + + module.exit_json( + changed=True, + before=existing, + after=desired, + commands=commands, + saved=saved, + response=response, + ) + + module.exit_json( + changed=False, + before=existing, + after=existing, + commands=[], + ) if __name__ == "__main__": |
