diff options
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__": |
