dnos* -> dellos* (Rename module & updated copyright) (#4888)
* Renamed the Modules from dnos* -> dellos*, updated copyright, corrected doc issues * Removed the unwanted module import
This commit is contained in:
parent
f6386a113b
commit
1c4efc8b2c
13 changed files with 113 additions and 74 deletions
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
|
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Dell Inc.
|
||||||
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
@ -18,9 +22,9 @@
|
||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: dnos10_command
|
module: dellos10_command
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
author: "Senthil Kumar Ganesan (@skg_net)"
|
author: "Senthil Kumar Ganesan (@skg-net)"
|
||||||
short_description: Run commands on remote devices running Dell OS10
|
short_description: Run commands on remote devices running Dell OS10
|
||||||
description:
|
description:
|
||||||
- Sends arbitrary commands to a Dell OS10 node and returns the results
|
- Sends arbitrary commands to a Dell OS10 node and returns the results
|
||||||
|
@ -28,12 +32,12 @@ description:
|
||||||
argument that will cause the module to wait for a specific condition
|
argument that will cause the module to wait for a specific condition
|
||||||
before returning or timing out if the condition is not met.
|
before returning or timing out if the condition is not met.
|
||||||
- This module does not support running commands in configuration mode.
|
- This module does not support running commands in configuration mode.
|
||||||
Please use M(dnos10_config) to configure Dell OS10 devices.
|
Please use M(dellos10_config) to configure Dell OS10 devices.
|
||||||
extends_documentation_fragment: dellos10
|
extends_documentation_fragment: dellos10
|
||||||
options:
|
options:
|
||||||
commands:
|
commands:
|
||||||
description:
|
description:
|
||||||
- List of commands to send to the remote dnos10 device over the
|
- List of commands to send to the remote dellos10 device over the
|
||||||
configured provider. The resulting output from the command
|
configured provider. The resulting output from the command
|
||||||
is returned. If the I(wait_for) argument is provided, the
|
is returned. If the I(wait_for) argument is provided, the
|
||||||
module is not returned until the condition is satisfied or
|
module is not returned until the condition is satisfied or
|
||||||
|
@ -78,25 +82,25 @@ vars:
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: run show version on remote devices
|
- name: run show version on remote devices
|
||||||
dnos10_command:
|
dellos10_command:
|
||||||
commands: show version
|
commands: show version
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- name: run show version and check to see if output contains OS10
|
- name: run show version and check to see if output contains OS10
|
||||||
dnos10_command:
|
dellos10_command:
|
||||||
commands: show version
|
commands: show version
|
||||||
wait_for: result[0] contains OS10
|
wait_for: result[0] contains OS10
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- name: run multiple commands on remote nodes
|
- name: run multiple commands on remote nodes
|
||||||
dnos10_command:
|
dellos10_command:
|
||||||
commands:
|
commands:
|
||||||
- show version
|
- show version
|
||||||
- show interface
|
- show interface
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- name: run multiple commands and evaluate the output
|
- name: run multiple commands and evaluate the output
|
||||||
dnos10_command:
|
dellos10_command:
|
||||||
commands:
|
commands:
|
||||||
- show version
|
- show version
|
||||||
- show interface
|
- show interface
|
||||||
|
@ -135,7 +139,7 @@ warnings:
|
||||||
from ansible.module_utils.basic import get_exception
|
from ansible.module_utils.basic import get_exception
|
||||||
from ansible.module_utils.netcli import CommandRunner, FailedConditionsError
|
from ansible.module_utils.netcli import CommandRunner, FailedConditionsError
|
||||||
from ansible.module_utils.network import NetworkModule, NetworkError
|
from ansible.module_utils.network import NetworkModule, NetworkError
|
||||||
import ansible.module_utils.dnos10
|
import ansible.module_utils.dellos10
|
||||||
|
|
||||||
def to_lines(stdout):
|
def to_lines(stdout):
|
||||||
for item in stdout:
|
for item in stdout:
|
||||||
|
@ -168,9 +172,9 @@ def main():
|
||||||
'check mode, not executing `%s`' % cmd)
|
'check mode, not executing `%s`' % cmd)
|
||||||
else:
|
else:
|
||||||
if cmd.startswith('conf'):
|
if cmd.startswith('conf'):
|
||||||
module.fail_json(msg='dnos10_command does not support running '
|
module.fail_json(msg='dellos10_command does not support running '
|
||||||
'config mode commands. Please use '
|
'config mode commands. Please use '
|
||||||
'dnos10_config instead')
|
'dellos10_config instead')
|
||||||
runner.add_command(cmd)
|
runner.add_command(cmd)
|
||||||
|
|
||||||
for item in conditionals:
|
for item in conditionals:
|
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
|
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Dell Inc.
|
||||||
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
@ -18,9 +22,9 @@
|
||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: dnos10_config
|
module: dellos10_config
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
author: "Senthil Kumar Ganesan (@skg_net)"
|
author: "Senthil Kumar Ganesan (@skg-net)"
|
||||||
short_description: Manage Dell OS10 configuration sections
|
short_description: Manage Dell OS10 configuration sections
|
||||||
description:
|
description:
|
||||||
- Dell OS10 configurations use a simple block indent file syntax
|
- Dell OS10 configurations use a simple block indent file syntax
|
||||||
|
@ -138,11 +142,11 @@ options:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- dnos10_config:
|
- dellos10_config:
|
||||||
lines: ['hostname {{ inventory_hostname }}']
|
lines: ['hostname {{ inventory_hostname }}']
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- dnos10_config:
|
- dellos10_config:
|
||||||
lines:
|
lines:
|
||||||
- 10 permit ip host 1.1.1.1 any log
|
- 10 permit ip host 1.1.1.1 any log
|
||||||
- 20 permit ip host 2.2.2.2 any log
|
- 20 permit ip host 2.2.2.2 any log
|
||||||
|
@ -154,7 +158,7 @@ EXAMPLES = """
|
||||||
match: exact
|
match: exact
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- dnos10_config:
|
- dellos10_config:
|
||||||
lines:
|
lines:
|
||||||
- 10 permit ip host 1.1.1.1 any log
|
- 10 permit ip host 1.1.1.1 any log
|
||||||
- 20 permit ip host 2.2.2.2 any log
|
- 20 permit ip host 2.2.2.2 any log
|
||||||
|
@ -190,7 +194,7 @@ saved:
|
||||||
"""
|
"""
|
||||||
from ansible.module_utils.netcfg import NetworkConfig, dumps
|
from ansible.module_utils.netcfg import NetworkConfig, dumps
|
||||||
from ansible.module_utils.network import NetworkModule
|
from ansible.module_utils.network import NetworkModule
|
||||||
from ansible.module_utils.dnos10 import get_config, get_sublevel_config
|
from ansible.module_utils.dellos10 import get_config, get_sublevel_config
|
||||||
|
|
||||||
def get_candidate(module):
|
def get_candidate(module):
|
||||||
candidate = NetworkConfig(indent=1)
|
candidate = NetworkConfig(indent=1)
|
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
|
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Dell Inc.
|
||||||
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
@ -17,9 +21,9 @@
|
||||||
#
|
#
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: dnos10_facts
|
module: dellos10_facts
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
author: "Senthil Kumar Ganesan (@skg_net)"
|
author: "Senthil Kumar Ganesan (@skg-net)"
|
||||||
short_description: Collect facts from remote devices running Dell OS10
|
short_description: Collect facts from remote devices running Dell OS10
|
||||||
description:
|
description:
|
||||||
- Collects a base set of device facts from a remote device that
|
- Collects a base set of device facts from a remote device that
|
||||||
|
@ -43,16 +47,16 @@ options:
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Collect all facts from the device
|
# Collect all facts from the device
|
||||||
- dnos10_facts:
|
- dellos10_facts:
|
||||||
gather_subset: all
|
gather_subset: all
|
||||||
|
|
||||||
# Collect only the config and default facts
|
# Collect only the config and default facts
|
||||||
- dnos10_facts:
|
- dellos10_facts:
|
||||||
gather_subset:
|
gather_subset:
|
||||||
- config
|
- config
|
||||||
|
|
||||||
# Do not collect hardware facts
|
# Do not collect hardware facts
|
||||||
- dnos10_facts:
|
- dellos10_facts:
|
||||||
gather_subset:
|
gather_subset:
|
||||||
- "!hardware"
|
- "!hardware"
|
||||||
"""
|
"""
|
||||||
|
@ -125,12 +129,11 @@ ansible_net_neighbors:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import itertools
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import get_exception
|
from ansible.module_utils.basic import get_exception
|
||||||
from ansible.module_utils.netcli import CommandRunner
|
from ansible.module_utils.netcli import CommandRunner
|
||||||
from ansible.module_utils.network import NetworkModule
|
from ansible.module_utils.network import NetworkModule
|
||||||
import ansible.module_utils.dnos10
|
import ansible.module_utils.dellos10
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from lxml import etree as ET
|
from lxml import etree as ET
|
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
|
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Dell Inc.
|
||||||
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
@ -17,9 +21,9 @@
|
||||||
#
|
#
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: dnos10_template
|
module: dellos10_template
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
author: "Senthil Kumar Ganesan (@skg_net)"
|
author: "Senthil Kumar Ganesan (@skg-net)"
|
||||||
short_description: Manage Dell OS10 device configurations over SSH.
|
short_description: Manage Dell OS10 device configurations over SSH.
|
||||||
description:
|
description:
|
||||||
- Manages Dell OS10 network device configurations over SSH. This module
|
- Manages Dell OS10 network device configurations over SSH. This module
|
||||||
|
@ -44,7 +48,7 @@ options:
|
||||||
current device running-config. When set to true, this will
|
current device running-config. When set to true, this will
|
||||||
cause the module to push the contents of I(src) into the device
|
cause the module to push the contents of I(src) into the device
|
||||||
without first checking if already configured. This argument is
|
without first checking if already configured. This argument is
|
||||||
mutually exclusive with O(config).
|
mutually exclusive with I(config).
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
choices: [ "true", "false" ]
|
choices: [ "true", "false" ]
|
||||||
|
@ -54,7 +58,7 @@ options:
|
||||||
the running-config from the node prior to making any changes.
|
the running-config from the node prior to making any changes.
|
||||||
The backup file will be written to backup_{{ hostname }} in
|
The backup file will be written to backup_{{ hostname }} in
|
||||||
the root of the playbook directory. This argument is
|
the root of the playbook directory. This argument is
|
||||||
mutually exclusive with O(config).
|
mutually exclusive with I(config).
|
||||||
|
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
@ -68,7 +72,7 @@ options:
|
||||||
every task. The I(config) argument allows the implementer to
|
every task. The I(config) argument allows the implementer to
|
||||||
pass in the configuration to use as the base config for
|
pass in the configuration to use as the base config for
|
||||||
comparison. This argument is mutually exclusive with
|
comparison. This argument is mutually exclusive with
|
||||||
O(force) and O(backup).
|
I(force) and I(backup).
|
||||||
|
|
||||||
required: false
|
required: false
|
||||||
default: null
|
default: null
|
||||||
|
@ -76,20 +80,20 @@ options:
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: push a configuration onto the device
|
- name: push a configuration onto the device
|
||||||
dnos10_template:
|
dellos10_template:
|
||||||
host: hostname
|
host: hostname
|
||||||
username: foo
|
username: foo
|
||||||
src: config.j2
|
src: config.j2
|
||||||
|
|
||||||
- name: forceable push a configuration onto the device
|
- name: forceable push a configuration onto the device
|
||||||
dnos10_template:
|
dellos10_template:
|
||||||
host: hostname
|
host: hostname
|
||||||
username: foo
|
username: foo
|
||||||
src: config.j2
|
src: config.j2
|
||||||
force: yes
|
force: yes
|
||||||
|
|
||||||
- name: provide the base configuration for comparison
|
- name: provide the base configuration for comparison
|
||||||
dnos10_template:
|
dellos10_template:
|
||||||
host: hostname
|
host: hostname
|
||||||
username: foo
|
username: foo
|
||||||
src: candidate_config.txt
|
src: candidate_config.txt
|
||||||
|
@ -117,7 +121,7 @@ responses:
|
||||||
"""
|
"""
|
||||||
from ansible.module_utils.netcfg import NetworkConfig, dumps
|
from ansible.module_utils.netcfg import NetworkConfig, dumps
|
||||||
from ansible.module_utils.network import NetworkModule
|
from ansible.module_utils.network import NetworkModule
|
||||||
import ansible.module_utils.dnos10
|
import ansible.module_utils.dellos10
|
||||||
|
|
||||||
|
|
||||||
def get_config(module):
|
def get_config(module):
|
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
|
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Dell Inc.
|
||||||
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
@ -18,21 +22,21 @@
|
||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: dnos6_command
|
module: dellos6_command
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
short_description: Run commands on remote devices running Dell OS6
|
short_description: Run commands on remote devices running Dell OS6
|
||||||
description:
|
description:
|
||||||
- Sends arbitrary commands to a Dell OS6 node and returns the results
|
- Sends arbitrary commands to a Dell OS6 node and returns the results
|
||||||
read from the device. The M(dnos6_command) module includes an
|
read from the device. The M(dellos6_command) module includes an
|
||||||
argument that will cause the module to wait for a specific condition
|
argument that will cause the module to wait for a specific condition
|
||||||
before returning or timing out if the condition is not met.
|
before returning or timing out if the condition is not met.
|
||||||
- This module does not support running commands in configuration mode.
|
- This module does not support running commands in configuration mode.
|
||||||
Please use M(dnos6_config) to configure Dell OS6 devices.
|
Please use M(dellos6_config) to configure Dell OS6 devices.
|
||||||
extends_documentation_fragment: dellos6
|
extends_documentation_fragment: dellos6
|
||||||
options:
|
options:
|
||||||
commands:
|
commands:
|
||||||
description:
|
description:
|
||||||
- List of commands to send to the remote dnos6 device over the
|
- List of commands to send to the remote dellos6 device over the
|
||||||
configured provider. The resulting output from the command
|
configured provider. The resulting output from the command
|
||||||
is returned. If the I(waitfor) argument is provided, the
|
is returned. If the I(waitfor) argument is provided, the
|
||||||
module is not returned until the condition is satisfied or
|
module is not returned until the condition is satisfied or
|
||||||
|
@ -77,25 +81,25 @@ vars:
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: run show verion on remote devices
|
- name: run show verion on remote devices
|
||||||
dnos6_command:
|
dellos6_command:
|
||||||
commands: show version
|
commands: show version
|
||||||
provider "{{ cli }}"
|
provider "{{ cli }}"
|
||||||
|
|
||||||
- name: run show version and check to see if output contains Dell
|
- name: run show version and check to see if output contains Dell
|
||||||
dnos6_command:
|
dellos6_command:
|
||||||
commands: show version
|
commands: show version
|
||||||
wait_for: result[0] contains Dell
|
wait_for: result[0] contains Dell
|
||||||
provider "{{ cli }}"
|
provider "{{ cli }}"
|
||||||
|
|
||||||
- name: run multiple commands on remote nodes
|
- name: run multiple commands on remote nodes
|
||||||
dnos6_command:
|
dellos6_command:
|
||||||
commands:
|
commands:
|
||||||
- show version
|
- show version
|
||||||
- show interfaces
|
- show interfaces
|
||||||
provider "{{ cli }}"
|
provider "{{ cli }}"
|
||||||
|
|
||||||
- name: run multiple commands and evaluate the output
|
- name: run multiple commands and evaluate the output
|
||||||
dnos6_command:
|
dellos6_command:
|
||||||
commands:
|
commands:
|
||||||
- show version
|
- show version
|
||||||
- show interfaces
|
- show interfaces
|
||||||
|
@ -134,7 +138,7 @@ warnings:
|
||||||
from ansible.module_utils.basic import get_exception
|
from ansible.module_utils.basic import get_exception
|
||||||
from ansible.module_utils.netcli import CommandRunner, FailedConditionsError
|
from ansible.module_utils.netcli import CommandRunner, FailedConditionsError
|
||||||
from ansible.module_utils.network import NetworkModule, NetworkError
|
from ansible.module_utils.network import NetworkModule, NetworkError
|
||||||
import ansible.module_utils.dnos6
|
import ansible.module_utils.dellos6
|
||||||
|
|
||||||
def to_lines(stdout):
|
def to_lines(stdout):
|
||||||
for item in stdout:
|
for item in stdout:
|
||||||
|
@ -168,9 +172,9 @@ def main():
|
||||||
'check mode, not executing `%s`' % cmd)
|
'check mode, not executing `%s`' % cmd)
|
||||||
else:
|
else:
|
||||||
if cmd.startswith('conf'):
|
if cmd.startswith('conf'):
|
||||||
module.fail_json(msg='dnos6_command does not support running '
|
module.fail_json(msg='dellos6_command does not support running '
|
||||||
'config mode commands. Please use '
|
'config mode commands. Please use '
|
||||||
'dnos6_config instead')
|
'dellos6_config instead')
|
||||||
runner.add_command(cmd)
|
runner.add_command(cmd)
|
||||||
|
|
||||||
for item in conditionals:
|
for item in conditionals:
|
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
|
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Dell Inc.
|
||||||
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
@ -18,7 +22,7 @@
|
||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: dnos6_config
|
module: dellos6_config
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
author: "Abirami N(@abirami-n)"
|
author: "Abirami N(@abirami-n)"
|
||||||
short_description: Manage Dell OS6 configuration sections
|
short_description: Manage Dell OS6 configuration sections
|
||||||
|
@ -138,11 +142,11 @@ options:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- dnos6_config:
|
- dellos6_config:
|
||||||
lines: ['hostname {{ inventory_hostname }}']
|
lines: ['hostname {{ inventory_hostname }}']
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- dnos6_config:
|
- dellos6_config:
|
||||||
lines:
|
lines:
|
||||||
- 10 permit ip 1.1.1.1 any log
|
- 10 permit ip 1.1.1.1 any log
|
||||||
- 20 permit ip 2.2.2.2 any log
|
- 20 permit ip 2.2.2.2 any log
|
||||||
|
@ -154,7 +158,7 @@ EXAMPLES = """
|
||||||
match: exact
|
match: exact
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- dnos6_config:
|
- dellos6_config:
|
||||||
lines:
|
lines:
|
||||||
- 10 permit ip 1.1.1.1 any log
|
- 10 permit ip 1.1.1.1 any log
|
||||||
- 20 permit ip 2.2.2.2 any log
|
- 20 permit ip 2.2.2.2 any log
|
||||||
|
@ -190,7 +194,7 @@ saved:
|
||||||
"""
|
"""
|
||||||
from ansible.module_utils.netcfg import NetworkConfig, dumps, ConfigLine
|
from ansible.module_utils.netcfg import NetworkConfig, dumps, ConfigLine
|
||||||
from ansible.module_utils.network import NetworkModule
|
from ansible.module_utils.network import NetworkModule
|
||||||
from ansible.module_utils.dnos6 import get_config
|
from ansible.module_utils.dellos6 import get_config
|
||||||
|
|
||||||
def get_candidate(module):
|
def get_candidate(module):
|
||||||
candidate = NetworkConfig(indent=1)
|
candidate = NetworkConfig(indent=1)
|
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
|
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Dell Inc.
|
||||||
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
@ -18,7 +22,7 @@
|
||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: dnos9_command
|
module: dellos9_command
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
short_description: Run commands on remote devices running Dell OS9
|
short_description: Run commands on remote devices running Dell OS9
|
||||||
description:
|
description:
|
||||||
|
@ -27,12 +31,12 @@ description:
|
||||||
argument that will cause the module to wait for a specific condition
|
argument that will cause the module to wait for a specific condition
|
||||||
before returning or timing out if the condition is not met.
|
before returning or timing out if the condition is not met.
|
||||||
- This module does not support running commands in configuration mode.
|
- This module does not support running commands in configuration mode.
|
||||||
Please use M(dnos9_config) to configure Dell OS9 devices.
|
Please use M(dellos9_config) to configure Dell OS9 devices.
|
||||||
extends_documentation_fragment: dellos9
|
extends_documentation_fragment: dellos9
|
||||||
options:
|
options:
|
||||||
commands:
|
commands:
|
||||||
description:
|
description:
|
||||||
- List of commands to send to the remote dnos9 device over the
|
- List of commands to send to the remote dellos9 device over the
|
||||||
configured provider. The resulting output from the command
|
configured provider. The resulting output from the command
|
||||||
is returned. If the I(wait_for) argument is provided, the
|
is returned. If the I(wait_for) argument is provided, the
|
||||||
module is not returned until the condition is satisfied or
|
module is not returned until the condition is satisfied or
|
||||||
|
@ -77,25 +81,25 @@ vars:
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: run show version on remote devices
|
- name: run show version on remote devices
|
||||||
dnos9_command:
|
dellos9_command:
|
||||||
commands: show version
|
commands: show version
|
||||||
provider "{{ cli }}"
|
provider "{{ cli }}"
|
||||||
|
|
||||||
- name: run show version and check to see if output contains OS9
|
- name: run show version and check to see if output contains OS9
|
||||||
dnos9_command:
|
dellos9_command:
|
||||||
commands: show version
|
commands: show version
|
||||||
wait_for: result[0] contains OS9
|
wait_for: result[0] contains OS9
|
||||||
provider "{{ cli }}"
|
provider "{{ cli }}"
|
||||||
|
|
||||||
- name: run multiple commands on remote nodes
|
- name: run multiple commands on remote nodes
|
||||||
dnos9_command:
|
dellos9_command:
|
||||||
commands:
|
commands:
|
||||||
- show version
|
- show version
|
||||||
- show interfaces
|
- show interfaces
|
||||||
provider "{{ cli }}"
|
provider "{{ cli }}"
|
||||||
|
|
||||||
- name: run multiple commands and evalute the output
|
- name: run multiple commands and evalute the output
|
||||||
dnos9_command:
|
dellos9_command:
|
||||||
commands:
|
commands:
|
||||||
- show version
|
- show version
|
||||||
- show interfaces
|
- show interfaces
|
||||||
|
@ -134,7 +138,7 @@ warnings:
|
||||||
from ansible.module_utils.basic import get_exception
|
from ansible.module_utils.basic import get_exception
|
||||||
from ansible.module_utils.netcli import CommandRunner, FailedConditionsError
|
from ansible.module_utils.netcli import CommandRunner, FailedConditionsError
|
||||||
from ansible.module_utils.network import NetworkModule, NetworkError
|
from ansible.module_utils.network import NetworkModule, NetworkError
|
||||||
import ansible.module_utils.dnos9
|
import ansible.module_utils.dellos9
|
||||||
|
|
||||||
|
|
||||||
def to_lines(stdout):
|
def to_lines(stdout):
|
||||||
|
@ -169,9 +173,9 @@ def main():
|
||||||
'check mode, not executing `%s`' % cmd)
|
'check mode, not executing `%s`' % cmd)
|
||||||
else:
|
else:
|
||||||
if cmd.startswith('conf'):
|
if cmd.startswith('conf'):
|
||||||
module.fail_json(msg='dnos9_command does not support running '
|
module.fail_json(msg='dellos9_command does not support running '
|
||||||
'config mode commands. Please use '
|
'config mode commands. Please use '
|
||||||
'dnos9_config instead')
|
'dellos9_config instead')
|
||||||
runner.add_command(cmd)
|
runner.add_command(cmd)
|
||||||
|
|
||||||
for item in conditionals:
|
for item in conditionals:
|
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
|
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Dell Inc.
|
||||||
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
@ -18,7 +22,7 @@
|
||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: dnos9_config
|
module: dellos9_config
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
author: "Dhivya P (@dhivyap)"
|
author: "Dhivya P (@dhivyap)"
|
||||||
short_description: Manage Dell OS9 configuration sections
|
short_description: Manage Dell OS9 configuration sections
|
||||||
|
@ -138,11 +142,11 @@ options:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- dnos9_config:
|
- dellos9_config:
|
||||||
lines: ['hostname {{ inventory_hostname }}']
|
lines: ['hostname {{ inventory_hostname }}']
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- dnos9_config:
|
- dellos9_config:
|
||||||
lines:
|
lines:
|
||||||
- 10 permit ip host 1.1.1.1 any log
|
- 10 permit ip host 1.1.1.1 any log
|
||||||
- 20 permit ip host 2.2.2.2 any log
|
- 20 permit ip host 2.2.2.2 any log
|
||||||
|
@ -154,7 +158,7 @@ EXAMPLES = """
|
||||||
match: exact
|
match: exact
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- dnos9_config:
|
- dellos9_config:
|
||||||
lines:
|
lines:
|
||||||
- 10 permit ip host 1.1.1.1 any log
|
- 10 permit ip host 1.1.1.1 any log
|
||||||
- 20 permit ip host 2.2.2.2 any log
|
- 20 permit ip host 2.2.2.2 any log
|
||||||
|
@ -190,7 +194,7 @@ saved:
|
||||||
"""
|
"""
|
||||||
from ansible.module_utils.netcfg import NetworkConfig, dumps
|
from ansible.module_utils.netcfg import NetworkConfig, dumps
|
||||||
from ansible.module_utils.network import NetworkModule
|
from ansible.module_utils.network import NetworkModule
|
||||||
from ansible.module_utils.dnos9 import get_config, get_sublevel_config
|
from ansible.module_utils.dellos9 import get_config, get_sublevel_config
|
||||||
|
|
||||||
|
|
||||||
def get_candidate(module):
|
def get_candidate(module):
|
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
|
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Dell Inc.
|
||||||
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
@ -17,7 +21,7 @@
|
||||||
#
|
#
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: dnos9_facts
|
module: dellos9_facts
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
author: "Dhivya P (@dhivyap)"
|
author: "Dhivya P (@dhivyap)"
|
||||||
short_description: Collect facts from remote devices running Dell OS9
|
short_description: Collect facts from remote devices running Dell OS9
|
||||||
|
@ -43,16 +47,16 @@ options:
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Collect all facts from the device
|
# Collect all facts from the device
|
||||||
- dnos9_facts:
|
- dellos9_facts:
|
||||||
gather_subset: all
|
gather_subset: all
|
||||||
|
|
||||||
# Collect only the config and default facts
|
# Collect only the config and default facts
|
||||||
- dnos9_facts:
|
- dellos9_facts:
|
||||||
gather_subset:
|
gather_subset:
|
||||||
- config
|
- config
|
||||||
|
|
||||||
# Do not collect hardware facts
|
# Do not collect hardware facts
|
||||||
- dnos9_facts:
|
- dellos9_facts:
|
||||||
gather_subset:
|
gather_subset:
|
||||||
- "!hardware"
|
- "!hardware"
|
||||||
"""
|
"""
|
||||||
|
@ -128,7 +132,7 @@ import itertools
|
||||||
|
|
||||||
from ansible.module_utils.netcli import CommandRunner
|
from ansible.module_utils.netcli import CommandRunner
|
||||||
from ansible.module_utils.network import NetworkModule
|
from ansible.module_utils.network import NetworkModule
|
||||||
import ansible.module_utils.dnos9
|
import ansible.module_utils.dellos9
|
||||||
|
|
||||||
|
|
||||||
class FactsBase(object):
|
class FactsBase(object):
|
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
|
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Dell Inc.
|
||||||
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
@ -17,7 +21,7 @@
|
||||||
#
|
#
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: dnos9_template
|
module: dellos9_template
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
author: "Dhivya P (@dhivyap)"
|
author: "Dhivya P (@dhivyap)"
|
||||||
short_description: Manage Dell OS9 device configurations over SSH.
|
short_description: Manage Dell OS9 device configurations over SSH.
|
||||||
|
@ -76,20 +80,20 @@ options:
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: push a configuration onto the device
|
- name: push a configuration onto the device
|
||||||
dnos9_template:
|
dellos9_template:
|
||||||
host: hostname
|
host: hostname
|
||||||
username: foo
|
username: foo
|
||||||
src: config.j2
|
src: config.j2
|
||||||
|
|
||||||
- name: forceable push a configuration onto the device
|
- name: forceable push a configuration onto the device
|
||||||
dnos9_template:
|
dellos9_template:
|
||||||
host: hostname
|
host: hostname
|
||||||
username: foo
|
username: foo
|
||||||
src: config.j2
|
src: config.j2
|
||||||
force: yes
|
force: yes
|
||||||
|
|
||||||
- name: provide the base configuration for comparison
|
- name: provide the base configuration for comparison
|
||||||
dnos9_template:
|
dellos9_template:
|
||||||
host: hostname
|
host: hostname
|
||||||
username: foo
|
username: foo
|
||||||
src: candidate_config.txt
|
src: candidate_config.txt
|
||||||
|
@ -117,7 +121,7 @@ responses:
|
||||||
"""
|
"""
|
||||||
from ansible.module_utils.netcfg import NetworkConfig, dumps
|
from ansible.module_utils.netcfg import NetworkConfig, dumps
|
||||||
from ansible.module_utils.network import NetworkModule
|
from ansible.module_utils.network import NetworkModule
|
||||||
import ansible.module_utils.dnos9
|
import ansible.module_utils.dellos9
|
||||||
|
|
||||||
|
|
||||||
def get_config(module):
|
def get_config(module):
|
Loading…
Reference in a new issue