def run(module, result): # get the current active config from the node or passed in via # the config param config = module.params['config'] or get_config(module) # create the candidate config object from the arguments candidate = get_candidate(module) # create loadable config that includes only the configuration updates commands = diff_config(candidate, config) sanitize_config(commands, result) result['commands'] = commands commit = not module.check_mode comment = module.params['comment'] if commands: load_config(module, commands, commit=commit, comment=comment) if result.get('filtered'): result['warnings'].append('Some configuration commands were ' 'removed, please see the filtered key') result['changed'] = True
def run(module, result): # get the current active config from the node or passed in via # the config param config = module.params['config'] or get_config(module) # create the candidate config object from the arguments candidate = get_candidate(module) # create loadable config that includes only the configuration updates commands = diff_config(candidate, config) result['commands'] = commands commit = not module.check_mode comment = module.params['comment'] if commands: load_config(module, commands, commit=commit, comment=comment) result['changed'] = True