|
|
@ -113,9 +113,9 @@ options:
|
|
|
|
the modified lines are pushed to the device in configuration
|
|
|
|
the modified lines are pushed to the device in configuration
|
|
|
|
mode. If the replace argument is set to I(block) then the entire
|
|
|
|
mode. If the replace argument is set to I(block) then the entire
|
|
|
|
command block is pushed to the device in configuration mode if any
|
|
|
|
command block is pushed to the device in configuration mode if any
|
|
|
|
line is not correct. I(replace config) is supported on Nexus 9K device.
|
|
|
|
line is not correct. I(replace config) is supported only on Nexus 9K device.
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: lineo
|
|
|
|
default: line
|
|
|
|
choices: ['line', 'block', 'config']
|
|
|
|
choices: ['line', 'block', 'config']
|
|
|
|
force:
|
|
|
|
force:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -290,6 +290,7 @@ backup_path:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
|
|
|
|
from ansible.module_utils.connection import ConnectionError
|
|
|
|
from ansible.module_utils.network.common.config import NetworkConfig, dumps
|
|
|
|
from ansible.module_utils.network.common.config import NetworkConfig, dumps
|
|
|
|
from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands
|
|
|
|
from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands
|
|
|
|
from ansible.module_utils.network.nxos.nxos import get_capabilities
|
|
|
|
from ansible.module_utils.network.nxos.nxos import get_capabilities
|
|
|
@ -390,12 +391,18 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
config = None
|
|
|
|
config = None
|
|
|
|
|
|
|
|
|
|
|
|
info = get_capabilities(module).get('device_info', {})
|
|
|
|
try:
|
|
|
|
os_platform = info.get('network_os_platform', '')
|
|
|
|
info = get_capabilities(module)
|
|
|
|
|
|
|
|
api = info.get('network_api', 'nxapi')
|
|
|
|
|
|
|
|
device_info = info.get('device_info', {})
|
|
|
|
|
|
|
|
os_platform = device_info.get('network_os_platform', '')
|
|
|
|
|
|
|
|
except ConnectionError:
|
|
|
|
|
|
|
|
api = ''
|
|
|
|
|
|
|
|
os_platform = ''
|
|
|
|
|
|
|
|
|
|
|
|
if module.params['replace'] == 'config':
|
|
|
|
if api == 'cliconf' and module.params['replace'] == 'config':
|
|
|
|
if '9K' not in os_platform:
|
|
|
|
if '9K' not in os_platform:
|
|
|
|
module.fail_json(msg='replace: config is supported only for Nexus 9K series switches')
|
|
|
|
module.fail_json(msg='replace: config is supported only on Nexus 9K series switches')
|
|
|
|
|
|
|
|
|
|
|
|
if module.params['replace_src']:
|
|
|
|
if module.params['replace_src']:
|
|
|
|
if module.params['replace'] != 'config':
|
|
|
|
if module.params['replace'] != 'config':
|
|
|
|