Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

[ios_l3_interfaces] with supported operations #18

Open
wants to merge 36 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ef604c3
Draft ios l3 interface
justjais May 29, 2019
ea66575
Draft ios l3 interface
justjais May 29, 2019
7275e41
Draft ios l3 interface
justjais May 29, 2019
adea4fc
Draft ios l3 interface
justjais May 29, 2019
174103e
Draft ios l3 interface
justjais May 29, 2019
cf44ac6
Draft ios l3 interface
justjais May 29, 2019
d1e39be
Draft ios l3 interface
justjais May 29, 2019
b864c1f
Draft ios l3 interface
justjais May 29, 2019
62615f9
Draft ios l3 interface
justjais May 29, 2019
4b48250
Draft ios l3 interface
justjais May 29, 2019
a747c39
Draft ios l3 interface
justjais May 29, 2019
958e054
Draft ios l3 interface
justjais May 29, 2019
b776b98
Draft ios l3 interface
justjais May 29, 2019
dd5d6d9
Draft ios l3 interface
justjais May 29, 2019
650a727
Draft ios l3 interface
justjais May 29, 2019
9783252
Draft ios l3 interface
justjais May 29, 2019
84bafa8
Draft ios l3 interface
justjais May 29, 2019
96fe05f
Draft ios l3 interface
justjais May 29, 2019
276e46e
Draft ios l3 interface
justjais May 29, 2019
6bafc1f
Draft ios l3 interface
justjais May 29, 2019
72375c9
Draft ios l3 interface
justjais May 29, 2019
d89c1c8
Draft ios l3 interface
justjais May 29, 2019
eb223fb
Draft ios l3 interface
justjais May 29, 2019
1b530a9
Draft ios l3 interface
justjais May 29, 2019
9d2e006
Draft ios l3 interface
justjais May 29, 2019
a2c6a92
Draft ios l3 interface
justjais May 29, 2019
6e338ed
Draft ios l3 interface
justjais May 29, 2019
1e1c943
remove unnecessary lines
justjais May 29, 2019
4bc582e
ios l3 interface
justjais Jun 5, 2019
fa9201d
fix scondary ip bug
justjais Jun 6, 2019
359d074
fix issues
justjais Jun 6, 2019
f5e423d
fix issues
justjais Jun 6, 2019
84b3b21
ios l3 interface update
justjais Jun 18, 2019
93d57d8
linters fix
justjais Jun 28, 2019
e300b39
adhere to ansible/ansible
justjais Aug 12, 2019
0f383e2
fix l3 issue
justjais Aug 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added library/__init__.py
Empty file.
112 changes: 112 additions & 0 deletions library/ios_facts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The module file for ios_facts
"""

from __future__ import absolute_import, division, print_function

ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}

NETWORK_OS = "ios"
RESOURCE = "facts"
COPYRIGHT = "Copyright 2019 Red Hat"

DOCUMENTATION = """
---
module: ios_facts
version_added: 2.9
short_description: Get facts about Cisco ios devices.
description:
- Collects facts from network devices running the ios operating
system. This module places the facts gathered in the fact tree keyed by the
respective resource name. The facts module will always collect a
base set of facts from the device and can enable or disable
collection of additional facts.
author: [u'Sumit Jaiswal (@justjais)']
notes:
- Tested against iosv Version 6.1.3 on VIRL
options:
gather_subset:
description:
- When supplied, this argument will restrict the facts collected
to a given subset. Possible values for this argument include
all, min, hardware, config, legacy, and interfaces. Can specify a
list of values to include a larger subset. Values can also be used
with an initial C(M(!)) to specify that a specific subset should
not be collected.
required: false
default: 'all'
version_added: "2.2"
gather_network_resources:
description:
- When supplied, this argument will restrict the facts collected
to a given subset. Possible values for this argument include
all and the resources like interfaces, vlans etc.
Can specify a list of values to include a larger subset. Values
can also be used with an initial C(M(!)) to specify that a
specific subset should not be collected.
required: false
version_added: "2.9"
"""

EXAMPLES = """
# Gather all facts
- ios_facts:
gather_subset: all
gather_network_resources: all
# Collect only the ios facts
- ios_facts:
gather_subset:
- !all
- !min
gather_network_resources:
- ios
# Do not collect ios facts
- ios_facts:
gather_network_resources:
- "!ios"
# Collect ios and minimal default facts
- ios_facts:
gather_subset: min
gather_network_resources: ios
"""

RETURN = """
See the respective resource module parameters for the tree.
"""

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.connection import Connection
from ansible.module_utils.ios.facts.facts import Facts


def main():
"""
Main entry point for module execution
:returns: ansible_facts
"""
module = AnsibleModule(argument_spec=Facts.argument_spec,
supports_check_mode=True)
warnings = ['default value for `gather_subset` will be changed to `min` from `!config` v2.11 onwards']

connection = Connection(module._socket_path)
gather_subset = module.params['gather_subset']
gather_network_resources = module.params['gather_network_resources']
result = Facts().get_facts(module, connection, gather_subset, gather_network_resources)

try:
ansible_facts, warning = result
warnings.extend(warning)
except (TypeError, KeyError):
ansible_facts = result

module.exit_json(ansible_facts=ansible_facts, warnings=warnings)


if __name__ == '__main__':
main()
Loading