From 3f8f67e35971bd54770eeb34288165276ef8d1eb Mon Sep 17 00:00:00 2001 From: John Barker Date: Fri, 5 Aug 2016 13:01:13 +0100 Subject: [PATCH] NXOS Docs update --- .../modules/network/nxos/nxos_command.py | 8 +++--- .../modules/network/nxos/nxos_config.py | 12 ++++----- .../modules/network/nxos/nxos_facts.py | 4 ++- .../modules/network/nxos/nxos_feature.py | 10 ++++--- .../modules/network/nxos/nxos_interface.py | 8 +++--- .../modules/network/nxos/nxos_ip_interface.py | 12 +++++---- .../modules/network/nxos/nxos_nxapi.py | 14 ++++++++-- lib/ansible/modules/network/nxos/nxos_ping.py | 14 +++++----- .../modules/network/nxos/nxos_switchport.py | 18 ++++++------- .../modules/network/nxos/nxos_template.py | 14 +++++----- lib/ansible/modules/network/nxos/nxos_vlan.py | 16 ++++++------ lib/ansible/modules/network/nxos/nxos_vrf.py | 10 ++++--- .../network/nxos/nxos_vrf_interface.py | 16 +++++++----- lib/ansible/modules/network/nxos/nxos_vrrp.py | 26 ++++++++++--------- 14 files changed, 104 insertions(+), 78 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_command.py b/lib/ansible/modules/network/nxos/nxos_command.py index 9ad82f71c0..1c131a8bdd 100644 --- a/lib/ansible/modules/network/nxos/nxos_command.py +++ b/lib/ansible/modules/network/nxos/nxos_command.py @@ -23,8 +23,8 @@ version_added: "2.1" author: "Peter Sprygada (@privateip)" short_description: Run arbitrary command on Cisco NXOS devices description: - - Sends an aribtrary command to an NXOS node and returns the results - read from the device. The M(nxos_command) modulule includes an + - Sends an arbitrary command to an NXOS node and returns the results + read from the device. This module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met. extends_documentation_fragment: nxos @@ -50,8 +50,8 @@ options: description: - Specifies the number of retries a command should by tried before it is considered failed. The command is run on the - target device every retry and evaluated against the waitfor - conditionals + target device every retry and evaluated against the I(waitfor) + conditionals. required: false default: 10 interval: diff --git a/lib/ansible/modules/network/nxos/nxos_config.py b/lib/ansible/modules/network/nxos/nxos_config.py index 248d13ae20..4f6c0b66c2 100644 --- a/lib/ansible/modules/network/nxos/nxos_config.py +++ b/lib/ansible/modules/network/nxos/nxos_config.py @@ -23,8 +23,8 @@ version_added: "2.1" author: "Peter Sprygada (@privateip)" short_description: Manage Cisco NXOS configuration sections description: - - Cisco NXOS configurations use a simple block indent file sytanx - for segementing configuration into sections. This module provides + - Cisco NXOS configurations use a simple block indent file syntax + for segmenting configuration into sections. This module provides an implementation for working with NXOS configuration sections in a deterministic way. This module works with either CLI or NXAPI transports. @@ -52,7 +52,7 @@ options: a change needs to be made. This allows the playbook designer the opportunity to perform configuration commands prior to pushing any changes without affecting how the set of commands are matched - against the system + against the system. required: false default: null after: @@ -81,7 +81,7 @@ options: the modified lines are pushed to the device in configuration 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 - line is not correct + line is not correct. required: false default: line choices: ['line', 'block'] @@ -101,8 +101,8 @@ options: against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The I(config) argument allows the - implementer to pass in the configuruation to use as the base - config for comparision. + implementer to pass in the configuration to use as the base + config for comparison. required: false default: null """ diff --git a/lib/ansible/modules/network/nxos/nxos_facts.py b/lib/ansible/modules/network/nxos/nxos_facts.py index c37aa1af1f..54392c546b 100644 --- a/lib/ansible/modules/network/nxos/nxos_facts.py +++ b/lib/ansible/modules/network/nxos/nxos_facts.py @@ -24,7 +24,9 @@ short_description: Gets facts about NX-OS switches description: - Offers ability to extract facts from device extends_documentation_fragment: nxos -author: Jason Edelman (@jedelman8), Gabriele Gerbino (@GGabriele) +author: + - Jason Edelman (@jedelman8) + - Gabriele Gerbino (@GGabriele) ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/network/nxos/nxos_feature.py b/lib/ansible/modules/network/nxos/nxos_feature.py index 5998cd3360..efe512728b 100644 --- a/lib/ansible/modules/network/nxos/nxos_feature.py +++ b/lib/ansible/modules/network/nxos/nxos_feature.py @@ -24,15 +24,17 @@ short_description: Manage features in NX-OS switches description: - Offers ability to enable and disable features in NX-OS extends_documentation_fragment: nxos -author: Jason Edelman (@jedelman8), Gabriele Gerbino (@GGabriele) +author: + - Jason Edelman (@jedelman8) + - Gabriele Gerbino (@GGabriele) options: feature: description: - - Name of feature + - Name of feature. required: true state: description: - - Desired state of the feature + - Desired state of the feature. required: false default: 'enabled' choices: ['enabled','disabled'] @@ -89,7 +91,7 @@ feature: def execute_config_command(commands, module): try: module.configure(commands) - except ShellError: + except ShellError: clie = get_exception() module.fail_json(msg='Error sending CLI commands', error=str(clie), commands=commands) diff --git a/lib/ansible/modules/network/nxos/nxos_interface.py b/lib/ansible/modules/network/nxos/nxos_interface.py index 27562fc557..46b9f4ef8e 100644 --- a/lib/ansible/modules/network/nxos/nxos_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_interface.py @@ -39,24 +39,24 @@ options: default: null admin_state: description: - - Administrative state of the interface + - Administrative state of the interface. required: false default: up choices: ['up','down'] description: description: - - Interface description + - Interface description. required: false default: null mode: description: - - Manage Layer 2 or Layer 3 state of the interface + - Manage I(Layer2) or I(Layer3) state of the interface. required: false default: null choices: ['layer2','layer3'] state: description: - - Specify desired state of the resource + - Specify desired state of the resource. required: true default: present choices: ['present','absent','default'] diff --git a/lib/ansible/modules/network/nxos/nxos_ip_interface.py b/lib/ansible/modules/network/nxos/nxos_ip_interface.py index da4edb1f65..39dd7226b4 100644 --- a/lib/ansible/modules/network/nxos/nxos_ip_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_ip_interface.py @@ -24,7 +24,9 @@ short_description: Manages L3 attributes for IPv4 and IPv6 interfaces description: - Manages Layer 3 attributes for IPv4 and IPv6 interfaces extends_documentation_fragment: nxos -author: Jason Edelman (@jedelman8), Gabriele Gerbino (@GGabriele) +author: + - Jason Edelman (@jedelman8) + - Gabriele Gerbino (@GGabriele) notes: - Interface must already be a L3 port when using this module - Logical interfaces (po, loop, svi) must be created first @@ -35,21 +37,21 @@ notes: options: interface: description: - - Full name of interface, i.e. Ethernet1/1, vlan10 + - Full name of interface, i.e. Ethernet1/1, vlan10. required: true addr: description: - - IPv4 or IPv6 Address + - IPv4 or IPv6 Address. required: false default: null mask: description: - - Subnet mask for IPv4 or IPv6 Address in decimal format + - Subnet mask for IPv4 or IPv6 Address in decimal format. required: false default: null state: description: - - Specify desired state of the resource + - Specify desired state of the resource. required: false default: present choices: ['present','absent'] diff --git a/lib/ansible/modules/network/nxos/nxos_nxapi.py b/lib/ansible/modules/network/nxos/nxos_nxapi.py index fb480ac304..88b0b9150d 100644 --- a/lib/ansible/modules/network/nxos/nxos_nxapi.py +++ b/lib/ansible/modules/network/nxos/nxos_nxapi.py @@ -39,7 +39,7 @@ options: choices: - started - stopped - requred: false + required: false default: started http_port: description: @@ -56,12 +56,18 @@ options: - Enable/disable HTTP server. required: false default: true + choices: + - true + - false aliases: - enable_http https: description: - Enable/disable HTTPS server. required: false + choices: + - true + - false default: true aliases: - enable_https @@ -70,6 +76,9 @@ options: - Enable/disable NXAPI web based UI for entering commands. required: false default: true + choices: + - true + - false aliases: - enable_sandbox """ @@ -144,6 +153,7 @@ def execute_commands(module, commands): if not module.params.get('check_mode'): module.configure(commands) + def get_nxapi_state(module): features = module.execute(['show feature | grep nxapi'])[0] if re.search('disabled', features) is None: @@ -231,7 +241,7 @@ def main(): """ argument_spec = dict( - state=dict(default='started', choices=['started','stopped']), + state=dict(default='started', choices=['started', 'stopped']), http_port=dict(default=80, type='int'), https_port=dict(default=443, type='int'), http=dict(aliases=['enable_http'], default=True, type='bool'), diff --git a/lib/ansible/modules/network/nxos/nxos_ping.py b/lib/ansible/modules/network/nxos/nxos_ping.py index 9f7e912c9c..1e29aebd5b 100644 --- a/lib/ansible/modules/network/nxos/nxos_ping.py +++ b/lib/ansible/modules/network/nxos/nxos_ping.py @@ -22,27 +22,29 @@ module: nxos_ping version_added: "2.1" short_description: Tests reachability using ping from Nexus switch description: - - Tests reachability using ping from switch to a remote destination + - Tests reachability using ping from switch to a remote destination. extends_documentation_fragment: nxos -author: Jason Edelman (@jedelman8), Gabriele Gerbino (@GGabriele) +author: + - Jason Edelman (@jedelman8) + - Gabriele Gerbino (@GGabriele) options: dest: description: - - IP address or hostname (resolvable by switch) of remote node + - IP address or hostname (resolvable by switch) of remote node. required: true count: description: - - Number of packets to send + - Number of packets to send. required: false default: 2 source: description: - - Source IP Address + - Source IP Address. required: false default: null vrf: description: - - Outgoing VRF + - Outgoing VRF. required: false default: null ''' diff --git a/lib/ansible/modules/network/nxos/nxos_switchport.py b/lib/ansible/modules/network/nxos/nxos_switchport.py index ee9140d0f4..6818b708e7 100644 --- a/lib/ansible/modules/network/nxos/nxos_switchport.py +++ b/lib/ansible/modules/network/nxos/nxos_switchport.py @@ -27,40 +27,40 @@ description: - Manages Layer 2 interfaces author: Jason Edelman (@jedelman8) notes: - - When state=absent, vlans can be added/removed from trunk links and - the existing access vlan can be 'unconfigured' to just having VLAN 1 + - When C(state=absent), VLANs can be added/removed from trunk links and + the existing access VLAN can be 'unconfigured' to just having VLAN 1 on that interface - When working with trunks VLANs the keywords add/remove are always sent in the `switchport trunk allowed vlan` command. Use verbose mode to see commands sent. - - When state=unconfigured, the interface will result with having a default + - When C(state=unconfigured), the interface will result with having a default Layer 2 interface, i.e. vlan 1 in access mode options: interface: description: - - Full name of the interface, i.e. Ethernet1/1 + - Full name of the interface, i.e. Ethernet1/1. required: true default: null mode: description: - - Mode for the Layer 2 port + - Mode for the Layer 2 port. required: false default: null choices: ['access','trunk'] access_vlan: description: - - if mode=access, used as the access vlan id + - If C(mode=access), used as the access VLAN ID. required: false default: null native_vlan: description: - - if mode=trunk, used as the trunk native vlan id + - If C(mode=trunk), used as the trunk native VLAN ID. required: false default: null trunk_vlans: description: - - if mode=trunk, used as the vlan range to ADD or REMOVE - from the trunk + - If C(mode=trunk), used as the VLAN range to ADD or REMOVE + from the trunk. required: false default: null state: diff --git a/lib/ansible/modules/network/nxos/nxos_template.py b/lib/ansible/modules/network/nxos/nxos_template.py index 6e1ea860f5..b38b140b7d 100644 --- a/lib/ansible/modules/network/nxos/nxos_template.py +++ b/lib/ansible/modules/network/nxos/nxos_template.py @@ -23,9 +23,9 @@ author: "Peter Sprygada (@privateip)" short_description: Manage Cisco NXOS device configurations description: - Manages network device configurations over SSH or NXAPI. This module - allows implementors to work with the device running-config. It + allows implementers to work with the device running-config. It provides a way to push a set of commands onto a network device - by evaluting the current running-config and only pushing configuration + by evaluating the current running-config and only pushing configuration commands that are not already configured. The config source can be a set of commands or a template. extends_documentation_fragment: nxos @@ -50,9 +50,9 @@ options: include_defaults: description: - The module, by default, will collect the current device - running-config to use as a base for comparision to the commands + running-config to use as a base for comparisons to the commands in I(src). Setting this value to true will cause the module - to issue the command `show running-config all` to include all + to issue the command C(show running-config all) to include all device settings. required: false default: false @@ -73,8 +73,8 @@ options: against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The I(config) argument allows the - implementer to pass in the configuruation to use as the base - config for comparision. + implementer to pass in the configuration to use as the base + config for comparison. required: false default: null """ @@ -109,12 +109,14 @@ responses: sample: ['...', '...'] """ + def get_config(module): config = module.params['config'] or dict() if not config and not module.params['force']: config = module.config return config + def main(): argument_spec = dict( diff --git a/lib/ansible/modules/network/nxos/nxos_vlan.py b/lib/ansible/modules/network/nxos/nxos_vlan.py index 6d1e4839e9..dcfdff5965 100644 --- a/lib/ansible/modules/network/nxos/nxos_vlan.py +++ b/lib/ansible/modules/network/nxos/nxos_vlan.py @@ -28,36 +28,36 @@ extends_documentation_fragment: nxos options: vlan_id: description: - - single vlan id + - Single VLAN ID. required: false default: null vlan_range: description: - - range of VLANs such as 2-10 or 2,5,10-15, etc. + - A range of VLANs such as I(2-10) or I(2,5,10-15) etc. required: false default: null name: description: - - name of VLAN + - The name of VLAN. required: false default: null vlan_state: description: - - Manage the vlan operational state of the VLAN - (equivalent to state {active | suspend} command + - Manage the VLAN operational state of the VLAN + (equivalent to state {active | suspend} command. required: false default: active choices: ['active','suspend'] admin_state: description: - - Manage the vlan admin state of the VLAN equivalent - to shut/no shut in vlan config mode + - Manage the VLAN admin state of the VLAN equivalent + to shut/no shut in VLAN config mode. required: false default: up choices: ['up','down'] state: description: - - Manage the state of the resource + - Manage the state of the resource. required: false default: present choices: ['present','absent'] diff --git a/lib/ansible/modules/network/nxos/nxos_vrf.py b/lib/ansible/modules/network/nxos/nxos_vrf.py index 8106bf5ac2..4b1f891137 100644 --- a/lib/ansible/modules/network/nxos/nxos_vrf.py +++ b/lib/ansible/modules/network/nxos/nxos_vrf.py @@ -24,7 +24,9 @@ short_description: Manages global VRF configuration description: - Manages global VRF configuration extends_documentation_fragment: nxos -author: Jason Edelman (@jedelman8), Gabriele Gerbino (@GGabriele) +author: + - Jason Edelman (@jedelman8) + - Gabriele Gerbino (@GGabriele) notes: - Cisco NX-OS creates the default VRF by itself. Therefore, you're not allowed to use default as I(vrf) name in this module. @@ -37,17 +39,17 @@ notes: options: vrf: description: - - Name of VRF to be managed + - Name of VRF to be managed. required: true admin_state: description: - - Administrative state of the VRF + - Administrative state of the VRF. required: false default: up choices: ['up','down'] state: description: - - Manages desired state of the resource + - Manages desired state of the resource. required: false default: present choices: ['present','absent'] diff --git a/lib/ansible/modules/network/nxos/nxos_vrf_interface.py b/lib/ansible/modules/network/nxos/nxos_vrf_interface.py index 4bb0e8fa59..4930aff711 100644 --- a/lib/ansible/modules/network/nxos/nxos_vrf_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_vrf_interface.py @@ -24,26 +24,28 @@ short_description: Manages interface specific VRF configuration description: - Manages interface specific VRF configuration extends_documentation_fragment: nxos -author: Jason Edelman (@jedelman8), Gabriele Gerbino (@GGabriele) +author: + - Jason Edelman (@jedelman8) + - Gabriele Gerbino (@GGabriele) notes: - VRF needs to be added globally with M(nxos_vrf) before - adding a VRF to an interface + adding a VRF to an interface. - Remove a VRF from an interface will still remove - all L3 attributes just as it does from CLI + all L3 attributes just as it does from CLI. - VRF is not read from an interface until IP address is - configured on that interface + configured on that interface. options: vrf: description: - - Name of VRF to be managed + - Name of VRF to be managed. required: true interface: description: - - Full name of interface to be managed, i.e. Ethernet1/1 + - Full name of interface to be managed, i.e. I(Ethernet1/1). required: true state: description: - - Manages desired state of the resource + - Manages desired state of the resource. required: false default: present choices: ['present','absent'] diff --git a/lib/ansible/modules/network/nxos/nxos_vrrp.py b/lib/ansible/modules/network/nxos/nxos_vrrp.py index 7db482cd62..6c65295336 100644 --- a/lib/ansible/modules/network/nxos/nxos_vrrp.py +++ b/lib/ansible/modules/network/nxos/nxos_vrrp.py @@ -26,40 +26,42 @@ short_description: Manages VRRP configuration on NX-OS switches description: - Manages VRRP configuration on NX-OS switches extends_documentation_fragment: nxos -author: Jason Edelman (@jedelman8), Gabriele Gerbino (@GGabriele) +author: + - Jason Edelman (@jedelman8) + - Gabriele Gerbino (@GGabriele) notes: - - VRRP feature needs to be enabled first on the system - - SVIs must exist before using this module - - Interface must be a L3 port before using this module - - state=absent removes the vrrp group if it exists on the device - - VRRP cannot be configured on loopback interfaces + - VRRP feature needs to be enabled first on the system. + - SVIs must exist before using this module. + - Interface must be a L3 port before using this module. + - C(state=absent) removes the vrrp group if it exists on the device. + - VRRP cannot be configured on loopback interfaces. options: group: description: - - vrrp group number + - The VRRP group number. required: true interface: description: - - Full name of interface that is being managed for vrrp + - Full name of interface that is being managed for VRRP. required: true priority: description: - - vrrp priority + - VRRP priority. required: false default: null vip: description: - - hsrp virtual IP address + - HSRP virtual IP address. required: false default: null authentication: description: - - clear text authentication string + - Clear text authentication string. required: false default: null state: description: - - Specify desired state of the resource + - Specify desired state of the resource. required: false default: present choices: ['present','absent']