summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/fragements/prevent-vyos_config-saving-in-check-mode.yaml3
-rw-r--r--plugins/modules/vyos_config.py3
2 files changed, 5 insertions, 1 deletions
diff --git a/changelogs/fragements/prevent-vyos_config-saving-in-check-mode.yaml b/changelogs/fragements/prevent-vyos_config-saving-in-check-mode.yaml
new file mode 100644
index 0000000..d03856e
--- /dev/null
+++ b/changelogs/fragements/prevent-vyos_config-saving-in-check-mode.yaml
@@ -0,0 +1,3 @@
+---
+bugfixes:
+ - vyos_config - fixed issue where config could be saved while in check mode (https://github.com/ansible-collections/vyos.vyos/pull/53)
diff --git a/plugins/modules/vyos_config.py b/plugins/modules/vyos_config.py
index 893cd64..5e4836d 100644
--- a/plugins/modules/vyos_config.py
+++ b/plugins/modules/vyos_config.py
@@ -349,7 +349,8 @@ def main():
if module.params["save"]:
diff = run_commands(module, commands=["configure", "compare saved"])[1]
if diff != "[edit]":
- run_commands(module, commands=["save"])
+ if not module.check_mode:
+ run_commands(module, commands=["save"])
result["changed"] = True
run_commands(module, commands=["exit"])