8383 is ignored.
8484 default: configured by vyos_config
8585 type: str
86+ confirm:
87+ description:
88+ - The C(confirm) argument will tell vyos to revert to the previous configuration
89+ if not explicitly confirmed after applying the new config. When set to C(automatic)
90+ this module will automatically confirm the configuration, if the current session
91+ remains working with the new config. When set to C(manual), this module does
92+ not issue the confirmation itself.
93+ type: str
94+ default: none
95+ choices:
96+ - automatic
97+ - manual
98+ - none
99+ confirm_timeout:
100+ description:
101+ - Minutes to wait for confirmation before reverting the configuration. Does
102+ not apply when C(confirm) is set to C(none) .
103+ type: int
104+ default: 10
86105 config:
87106 description:
88107 - The C(config) argument specifies the base configuration to use to compare against
141160 vyos.vyos.vyos_config:
142161 src: vyos_template.j2
143162
163+ - name: revert after one minute, if connection is lost
164+ vyos.vyos.vyos_config:
165+ src: vyos_template.j2
166+ confirm: yes
167+
144168- name: for idempotency, use full-form commands
145169 vyos.vyos.vyos_config:
146170 lines:
@@ -310,10 +334,15 @@ def run(module, result):
310334
311335 commit = not module .check_mode
312336 comment = module .params ["comment" ]
337+ confirm = None
338+ if module .params ["confirm" ] == "automatic" or module .params ["confirm" ] == "manual" :
339+ confirm = module .params ["confirm_timeout" ]
313340
314341 diff = None
315342 if commands :
316- diff = load_config (module , commands , commit = commit , comment = comment )
343+ diff = load_config (module , commands , commit = commit , comment = comment , confirm = confirm )
344+ if module .params ["confirm" ] == "automatic" :
345+ run_commands (module , ["configure" , "confirm" , "exit" ])
317346
318347 if result .get ("filtered" ):
319348 result ["warnings" ].append (
@@ -334,6 +363,8 @@ def main():
334363 lines = dict (type = "list" , elements = "str" ),
335364 match = dict (default = "line" , choices = ["line" , "none" ]),
336365 comment = dict (default = DEFAULT_COMMENT ),
366+ confirm = dict (choices = ["automatic" , "manual" , "none" ], default = 'none' ),
367+ confirm_timeout = dict (type = "int" , default = 10 ),
337368 config = dict (),
338369 backup = dict (type = "bool" , default = False ),
339370 backup_options = dict (type = "dict" , options = backup_spec ),
0 commit comments