Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
23fc144
ios interface initial commit
justjais Apr 9, 2019
f12fff9
ios interface initial commit
justjais Apr 9, 2019
5ff786f
ios interface initial commit
justjais Apr 9, 2019
afea203
ios interface initial commit
justjais Apr 9, 2019
ac7670d
ios interface initial commit
justjais Apr 9, 2019
a0eebb7
ios interface initial commit
justjais Apr 9, 2019
921ed1d
ios interface initial commit
justjais Apr 9, 2019
bb50dc5
ios interface initial commit
justjais Apr 9, 2019
e2fc5e7
ios interface initial commit
justjais Apr 9, 2019
150f248
ios interface initial commit
justjais Apr 9, 2019
321e71f
ios interface initial commit
justjais Apr 9, 2019
e7d6a00
ios interface initial commit
justjais Apr 9, 2019
a6b3b10
ios interface initial commit
justjais Apr 9, 2019
736b6cb
ios interface initial commit
justjais Apr 9, 2019
f475bda
ios interface initial commit
justjais Apr 9, 2019
7d1d333
ios interface initial commit
justjais Apr 9, 2019
f43926e
ios interface initial commit
justjais Apr 9, 2019
1d8e35b
ios interface initial commit
justjais Apr 9, 2019
4357f00
ios interface initial commit
justjais Apr 9, 2019
b9d837c
ios interface initial commit
justjais Apr 9, 2019
cce5308
ios interface initial commit
justjais Apr 9, 2019
6e06f00
ios interface initial commit
justjais Apr 9, 2019
6f90573
ios interface initial commit
justjais Apr 9, 2019
981f06c
ios interface initial commit
justjais Apr 9, 2019
126acd9
ios interface complete
justjais Apr 12, 2019
fbe658c
ios interface complete
justjais Apr 12, 2019
5d7c0d0
ios interface complete
justjais Apr 12, 2019
d9487ee
fix operation idempotency
justjais Apr 16, 2019
074d916
pep8 complain fix
justjais Apr 16, 2019
3b75917
idempotency check
justjais Apr 23, 2019
9406911
adhered to new facts
justjais May 28, 2019
77be86b
adhered to new facts
justjais May 28, 2019
0c6250f
adhered to new facts
justjais May 28, 2019
2da81e1
adhered to new facts
justjais May 28, 2019
f8b5eba
adhered to new facts
justjais May 28, 2019
072cf25
adhered to new facts
justjais May 28, 2019
f64afb3
adhered to new facts
justjais May 28, 2019
cb51f15
cosmetic change
justjais May 28, 2019
42634ef
cosmetic change
justjais May 28, 2019
f58a72a
cosmetic change
justjais May 28, 2019
77cefb8
cosmetic change
justjais May 28, 2019
0c355e3
cosmetic change
justjais May 28, 2019
747f1bd
cosmetic change
justjais May 28, 2019
5a4d60c
ios interface tests
justjais May 30, 2019
ceb4421
ios interface tests
justjais May 30, 2019
541e132
ios interface tests
justjais May 30, 2019
42a4253
ios interface tests
justjais May 30, 2019
fcbda7b
ios interface tests
justjais May 30, 2019
52e277f
ios interface tests
justjais May 30, 2019
7fd62d4
updated interfaces resource
justjais Jul 29, 2019
f7afa3b
fix interfaces module
justjais Jul 30, 2019
3dfdf8f
move common code to util
justjais Jul 30, 2019
c00244d
fix all issues
justjais Jul 31, 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.
107 changes: 107 additions & 0 deletions library/ios_facts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# 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
__metaclass__ = type


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


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 Cisco IOSv Version 15.2 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 lacp_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 lacp_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:
- interfaces
# Do not collect ios facts
- ios_facts:
gather_network_resources:
- "!interfaces"
# Collect ios and minimal default facts
- ios_facts:
gather_subset: min
gather_network_resources: interfaces
"""

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

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.ios.argspec.facts.facts import FactsArgs
from ansible.module_utils.network.ios.facts.facts import Facts


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

result = Facts(module).get_facts()

ansible_facts, additional_warnings = result
warnings.extend(additional_warnings)

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


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