1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Remove deprecated params from module argspec nxos modules (#34911)

* Remove deprecated param from module argspec nxos modules

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* fix nxos_vrrp syntaxerror

* Add choices for version _nxos_ip_interface

* remove check_args function

* remove include_defaults
This commit is contained in:
Trishna Guha 2018-01-16 18:23:58 +05:30 committed by GitHub
parent 0196b6bb69
commit a727930f07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 85 additions and 254 deletions

View file

@ -50,6 +50,12 @@ options:
- IPv4 or IPv6 Address.
required: false
default: null
version:
description:
- Version of IP address. If the IP address is IPV4 version should be v4.
If the IP address is IPV6 version should be v6.
default: v4
choices: ['v4', 'v6']
mask:
description:
- Subnet mask for IPv4 or IPv6 Address in decimal format.
@ -73,11 +79,6 @@ options:
required: false
default: false
version_added: "2.4"
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: true
type: bool
state:
description:
- Specify desired state of the resource.
@ -532,10 +533,7 @@ def main():
state=dict(required=False, default='present',
choices=['present', 'absent']),
allow_secondary=dict(required=False, default=False,
type='bool'),
include_defaults=dict(default=True),
config=dict(),
save=dict(type='bool', default=False)
type='bool')
)
argument_spec.update(nxos_argument_spec)

View file

@ -68,11 +68,6 @@ options:
required: false
choices: ['true', 'false']
default: false
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: false
type: bool
state:
description:
- Manage the state of the resource.
@ -444,9 +439,6 @@ def main():
members=dict(required=False, default=None, type='list'),
force=dict(required=False, default='false', type='str', choices=['true', 'false']),
state=dict(required=False, choices=['absent', 'present'], default='present'),
include_defaults=dict(default=False),
config=dict(),
save=dict(type='bool', default=False)
)
argument_spec.update(nxos_argument_spec)

View file

@ -192,11 +192,6 @@ options:
choices: ['af11', 'af12', 'af13', 'af21', 'af22', 'af23','af31','af32',
'af33', 'af41', 'af42', 'af43', 'cs1', 'cs2', 'cs3', 'cs4',
'cs5', 'cs6', 'cs7', 'default', 'ef']
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: false
type: bool
state:
description:
- Specify desired state of the resource.
@ -433,14 +428,7 @@ def main():
'cs1', 'cs2', 'cs3', 'cs4',
'cs5', 'cs6', 'cs7', 'default',
'ef']),
state=dict(choices=['absent', 'present', 'delete_acl'], default='present'),
protocol=dict(choices=['http', 'https'], default='http'),
host=dict(required=True),
username=dict(type='str'),
password=dict(no_log=True, type='str'),
include_defaults=dict(default=False),
config=dict(),
save=dict(type='bool', default=False)
state=dict(choices=['absent', 'present', 'delete_acl'], default='present')
)
argument_spec.update(nxos_argument_spec)

View file

@ -71,6 +71,10 @@ options:
required: false
choices: ['true','false']
default: null
bestpath_compare_neighborid:
description:
- Enable/Disable neighborid. Use this when more paths available than max path config.
choices: ['true', 'false']
bestpath_cost_community_ignore:
description:
- Enable/Disable Ignores the cost community for BGP best-path

View file

@ -446,8 +446,7 @@ def main():
timers_holdtime=dict(required=False, type='str'),
transport_passive_only=dict(required=False, type='bool'),
update_source=dict(required=False, type='str'),
m_facts=dict(required=False, default=False, type='bool'),
state=dict(choices=['present', 'absent'], default='present', required=False),
state=dict(choices=['present', 'absent'], default='present', required=False)
)
argument_spec.update(nxos_argument_spec)

View file

@ -44,6 +44,7 @@ options:
device config parser.
required: false
default: null
aliases: ['commands']
parents:
description:
- The ordered set of parents that uniquely identify the section
@ -287,7 +288,6 @@ backup_path:
sample: /playbooks/ansible/backup/nxos_config.2016-07-16@22:28:34
"""
import os
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.common.config import NetworkConfig, dumps

View file

@ -57,20 +57,9 @@ from ansible.module_utils.network.nxos.nxos import get_config, load_config
from ansible.module_utils.network.nxos.nxos import get_capabilities, nxos_argument_spec
def check_args(module, warnings):
for key in ('include_defaults', 'config', 'save'):
if module.params[key] is not None:
warnings.append('argument %s is no longer supported, ignoring value' % key)
def main():
argument_spec = dict(
nv_overlay_evpn=dict(required=True, type='bool'),
# deprecated in Ans2.3
include_defaults=dict(),
config=dict(),
save=dict()
)
argument_spec.update(nxos_argument_spec)
@ -80,7 +69,6 @@ def main():
result = {'changed': False}
warnings = list()
check_args(module, warnings)
if warnings:
result['warnings'] = warnings

View file

@ -74,11 +74,6 @@ options:
- Sets the route-target 'import' extended communities.
required: false
default: null
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: true
type: bool
state:
description:
- Determines whether the config should be present or not
@ -243,10 +238,7 @@ def main():
route_target_both=dict(required=False, type='list'),
route_target_import=dict(required=False, type='list'),
route_target_export=dict(required=False, type='list'),
state=dict(choices=['present', 'absent'], default='present', required=False),
include_defaults=dict(default=True),
config=dict(),
save=dict(type='bool', default=False)
state=dict(choices=['present', 'absent'], default='present', required=False)
)
argument_spec.update(nxos_argument_spec)

View file

@ -76,12 +76,6 @@ from ansible.module_utils.network.nxos.nxos import load_config, run_commands
from ansible.module_utils.network.nxos.nxos import get_capabilities, nxos_argument_spec
def check_args(module, warnings):
for key in ('include_defaults', 'config', 'save'):
if module.params[key] is not None:
warnings.append('argument %s is no longer supported, ignoring value' % key)
def get_available_features(feature, module):
available_features = {}
feature_regex = r'(?P<feature>\S+)\s+\d+\s+(?P<state>.*)'
@ -213,12 +207,7 @@ def validate_feature(module, mode='show'):
def main():
argument_spec = dict(
feature=dict(type='str', required=True),
state=dict(choices=['enabled', 'disabled'], default='enabled'),
# deprecated in Ans2.3
include_defaults=dict(),
config=dict(),
save=dict()
state=dict(choices=['enabled', 'disabled'], default='enabled')
)
argument_spec.update(nxos_argument_spec)
@ -226,7 +215,6 @@ def main():
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
warnings = list()
check_args(module, warnings)
results = dict(changed=False, warnings=warnings)
feature = validate_feature(module)

View file

@ -53,18 +53,6 @@ options:
required: false
default: present
choices: ['present','absent']
include_defaults:
description:
- Specify to retrieve or not the complete running configuration
for module operations.
required: false
default: false
choices: ['true','false']
config:
description:
- Specify the configuration string to be used for module operations.
required: false
default: null
'''
EXAMPLES = '''
@ -74,16 +62,11 @@ EXAMPLES = '''
commands:
- router eigrp 11
- isolate
host: "{{ inventory_hostname }}"
username: "{{ un }}"
password: "{{ pwd }}"
# Remove the maintenance-mode profile
- nxos_gir_profile_management:
mode: maintenance
state: absent
host: "{{ inventory_hostname }}"
username: "{{ un }}"
password: "{{ pwd }}"
'''
RETURN = '''
@ -120,7 +103,7 @@ changed:
import re
from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.common.config import CustomNetworkConfig
@ -175,10 +158,7 @@ def main():
argument_spec = dict(
commands=dict(required=False, type='list'),
mode=dict(required=True, choices=['maintenance', 'normal']),
state=dict(choices=['absent', 'present'],
default='present'),
include_defaults=dict(default=False),
config=dict()
state=dict(choices=['absent', 'present'], default='present')
)
argument_spec.update(nxos_argument_spec)
@ -187,7 +167,6 @@ def main():
supports_check_mode=True)
warnings = list()
check_args(module, warnings)
state = module.params['state']
commands = module.params['commands'] or []

View file

@ -61,6 +61,10 @@ options:
- HSRP priority.
required: false
default: null
preempt:
description:
- Enable/Disable preempt.
choices: ['enabled', 'disabled']
vip:
description:
- HSRP virtual IP address.

View file

@ -59,11 +59,6 @@ options:
required: false
default: null
choices: ['true', 'false']
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: false
type: bool
state:
description:
- Manages desired state of the resource.
@ -75,18 +70,15 @@ EXAMPLES = '''
- name: Default igmp global params (all params except restart)
nxos_igmp:
state: default
host: "{{ inventory_hostname }}"
- name: Ensure the following igmp global config exists on the device
nxos_igmp:
flush_routes: true
enforce_rtr_alert: true
host: "{{ inventory_hostname }}"
- name: Restart the igmp process
nxos_igmp:
restart: true
host: "{{ inventory_hostname }}"
'''
RETURN = '''
@ -121,12 +113,7 @@ def main():
flush_routes=dict(type='bool'),
enforce_rtr_alert=dict(type='bool'),
restart=dict(type='bool', default=False),
state=dict(choices=['present', 'default'], default='present'),
include_defaults=dict(default=False),
config=dict(),
save=dict(type='bool', default=False)
state=dict(choices=['present', 'default'], default='present')
)
argument_spec.update(nxos_argument_spec)

View file

@ -159,11 +159,6 @@ options:
required: false
choices: ['true', 'false']
default: null
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: true
type: bool
state:
description:
- Manages desired state of the resource.
@ -176,11 +171,7 @@ EXAMPLES = '''
interface: ethernet1/32
startup_query_interval: 30
state: present
username: "{{ un }}"
password: "{{ pwd }}"
host: "{{ inventory_hostname }}"
'''
RETURN = '''
proposed:
description: k/v pairs of parameters passed into module
@ -539,10 +530,7 @@ def main():
oif_source=dict(required=False, type='str'),
restart=dict(type='bool', default=False),
state=dict(choices=['present', 'absent', 'default'],
default='present'),
include_defaults=dict(default=True),
config=dict(),
save=dict(type='bool', default=False)
default='present')
)
argument_spec.update(nxos_argument_spec)

View file

@ -129,6 +129,11 @@ options:
required: true
default: present
choices: ['present','absent','default']
delay:
description:
- Time in seconds to wait before checking for the operational state on remote
device. This wait is applicable for operational state arguments.
default: 10
"""
EXAMPLES = """

View file

@ -111,11 +111,6 @@ options:
- Specifies the message_digest password. Valid value is a string.
required: false
default: null
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: true
type: bool
state:
description:
- Determines whether the config should be present or not
@ -386,10 +381,7 @@ def main():
message_digest_algorithm_type=dict(required=False, type='str', choices=['md5']),
message_digest_encryption_type=dict(required=False, type='str', choices=['cisco_type_7', '3des']),
message_digest_password=dict(required=False, type='str', no_log=True),
state=dict(choices=['present', 'absent'], default='present', required=False),
include_defaults=dict(default=True),
config=dict(),
save=dict(type='bool', default=False)
state=dict(choices=['present', 'absent'], default='present', required=False)
)
argument_spec.update(nxos_argument_spec)

View file

@ -68,6 +68,10 @@ options:
required: false
default: present
choices: ['present','absent']
purge:
description:
- Purge links not defined in the I(aggregate) parameter.
default: no
"""
EXAMPLES = """

View file

@ -45,7 +45,8 @@ options:
- Facility name for logging.
dest_level:
description:
- Set logging severity levels. C(alias level).
- Set logging severity levels.
aliases: ['level']
facility_level:
description:
- Set logging serverity levels for facility based log messages.

View file

@ -153,10 +153,6 @@ def check_args(module, warnings):
warnings.append('state=stopped is deprecated and will be removed in a '
'a future release. Please use state=absent instead')
for key in ['config']:
if module.params[key]:
warnings.append('argument %s is deprecated and will be ignored' % key)
for key in ['http_port', 'https_port']:
if module.params[key] is not None:
if not 1 <= module.params[key] <= 65535:
@ -271,15 +267,9 @@ def main():
argument_spec = dict(
http=dict(aliases=['enable_http'], type='bool'),
http_port=dict(type='int'),
https=dict(aliases=['enable_https'], type='bool'),
https_port=dict(type='int'),
sandbox=dict(aliases=['enable_sandbox'], type='bool'),
# deprecated (Ansible 2.3) arguments
config=dict(),
state=dict(default='present', choices=['started', 'stopped', 'present', 'absent'])
)

View file

@ -41,11 +41,6 @@ options:
required: false
default: present
choices: ['present','absent']
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: true
type: bool
'''
EXAMPLES = '''
@ -116,10 +111,7 @@ def state_absent(module, proposed, candidate):
def main():
argument_spec = dict(
ospf=dict(required=True, type='str'),
state=dict(choices=['present', 'absent'], default='present', required=False),
include_defaults=dict(default=True),
config=dict(),
save=dict(type='bool', default=False)
state=dict(choices=['present', 'absent'], default='present', required=False)
)
argument_spec.update(nxos_argument_spec)

View file

@ -120,11 +120,11 @@ options:
required: false
choices: ['true','false']
default: null
include_defaults:
state:
description:
- Specify if the complete running configuration for module operations should be used.
default: true
type: bool
- State of ospf vrf configuration.
default: present
choices: ['present', 'absent']
'''
EXAMPLES = '''
@ -361,10 +361,7 @@ def main():
timer_throttle_spf_max=dict(required=False, type='str'),
auto_cost=dict(required=False, type='str'),
passive_interface=dict(required=False, type='bool'),
state=dict(choices=['present', 'absent'], default='present', required=False),
include_defaults=dict(default=True),
config=dict(),
save=dict(type='bool', default=False)
state=dict(choices=['present', 'absent'], default='present', required=False)
)
argument_spec.update(nxos_argument_spec)

View file

@ -54,6 +54,9 @@ options:
required: false
default: true
choices: ['true', 'false']
dr_prio:
description:
- Configures priority for PIM DR election on interface.
hello_auth_key:
description:
- Authentication for hellos on this interface.

View file

@ -64,6 +64,12 @@ options:
required: false
choices: ['true','false']
default: null
state:
description:
- Specify desired state of the resource.
required: true
default: present
choices: ['present','absent','default']
'''
EXAMPLES = '''
- nxos_pim_rp_address:

View file

@ -47,9 +47,6 @@ options:
EXAMPLES = '''
- nxos_reboot:
confirm: true
host: "{{ inventory_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
'''
RETURN = '''
@ -74,7 +71,9 @@ def reboot(module):
def main():
argument_spec = {}
argument_spec = dict(
confirm=dict(default=False, type='bool')
)
argument_spec.update(nxos_argument_spec)
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
@ -83,9 +82,10 @@ def main():
check_args(module, warnings)
results = dict(changed=False, warnings=warnings)
if not module.check_mode:
reboot(module)
results['changed'] = True
if module.params['confirm']:
if not module.check_mode:
reboot(module)
results['changed'] = True
module.exit_json(**results)

View file

@ -50,11 +50,6 @@ options:
with checkpoint_file.
required: false
default: null
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: false
type: bool
'''
EXAMPLES = '''
@ -109,10 +104,7 @@ def rollback(filename, module):
def main():
argument_spec = dict(
checkpoint_file=dict(required=False),
rollback_to=dict(required=False),
include_defaults=dict(default=True),
config=dict(),
save=dict(type='bool', default=False)
rollback_to=dict(required=False)
)
argument_spec.update(nxos_argument_spec)

View file

@ -46,6 +46,10 @@ options:
required: false
default: v2c
choices: ['v2c', 'v3']
v3:
description:
- Use this when verion is v3. SNMPv3 Security level.
choices: ['noauth', 'auth', 'priv']
community:
description:
- Community string or v3 username.
@ -56,11 +60,11 @@ options:
- UDP port number (0-65535).
required: false
default: null
type:
snmp_type:
description:
- type of message to send to host.
required: false
default: traps
default: trap
choices: ['trap', 'inform']
vrf:
description:

View file

@ -347,7 +347,6 @@ def main():
name_servers=dict(type='list'),
system_mtu=dict(type='int'),
lookup_source=dict(),
state=dict(default='present', choices=['present', 'absent'])
)

View file

@ -88,6 +88,15 @@ options:
aggregate:
description: List of VLANs definitions.
version_added: "2.5"
purge:
description:
- Purge VLANs not defined in the I(aggregate) parameter.
default: no
delay:
description:
- Time in seconds to wait before checking for the operational state on remote
device. This wait is applicable for operational state arguments.
default: 10
'''
EXAMPLES = '''

View file

@ -95,6 +95,11 @@ options:
- Description of the VRF.
required: false
default: null
delay:
description:
- Time in seconds to wait before checking for the operational state on remote
device. This wait is applicable for operational state arguments.
default: 10
'''
EXAMPLES = '''

View file

@ -93,8 +93,6 @@ def main():
afi=dict(required=True, choices=['ipv4', 'ipv6']),
route_target_both_auto_evpn=dict(required=False, type='bool'),
state=dict(choices=['present', 'absent'], default='present'),
m_facts=dict(default=False, type='bool', removed_in_version="2.4"),
safi=dict(choices=['unicast', 'multicast'], removed_in_version="2.4"),
)

View file

@ -54,6 +54,10 @@ options:
- VRRP priority.
required: false
default: null
preempt:
description:
- Enable/Disable preempt.
choices: ['True', 'False']
vip:
description:
- VRRP virtual IP address.
@ -70,12 +74,6 @@ options:
required: false
choices: ['shutdown', 'no shutdown']
default: no shutdown
version_added: "2.2"
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: false
type: bool
state:
description:
- Specify desired state of the resource.
@ -338,10 +336,7 @@ def main():
choices=['shutdown', 'no shutdown'],
default='no shutdown'),
authentication=dict(required=False, type='str'),
state=dict(choices=['absent', 'present'], required=False, default='present'),
include_defaults=dict(default=False),
config=dict(),
save=dict(type='bool', default=False)
state=dict(choices=['absent', 'present'], required=False, default='present')
)
argument_spec.update(nxos_argument_spec)

View file

@ -1,68 +0,0 @@
---
- debug: msg="START {{ connection.transport }}/set_lookup_source.yaml"
- name: setup
nxos_config:
lines:
- no ip domain lookup source-interface
- vrf definition ansible
match: none
provider: "{{ connection }}"
- name: configure lookup_source
nxos_system:
lookup_source: Management1
provider: "{{ connection }}"
register: result
- assert:
that:
- result.changed == true
- "'ip domain lookup source-interface Management1' in result.commands"
- name: verify lookup_source
nxos_system:
lookup_source: Management1
provider: "{{ connection }}"
register: result
- assert:
that:
- result.changed == false
- name: change to vrf
nxos_system:
lookup_source:
- interface: Management1
vrf: ansible
provider: "{{ connection }}"
register: result
- assert:
that:
- result.changed == true
- "'no ip domain lookup source-interface Management1' in result.commands"
- "'ip domain lookup vrf ansible source-interface Management1' in result.commands"
- result.commands|length == 2
- name: verify change to vrf
nxos_system:
lookup_source:
- interface: Management1
vrf: ansible
provider: "{{ connection }}"
register: result
- assert:
that:
- result.changed == false
- name: teardown
nxos_config:
lines:
- no ip domain lookup source-interface
- no vrf definition ansible
match: none
provider: "{{ connection }}"
- debug: msg="END {{ connection.transport }}/set_lookup_source.yaml"