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

Resource module for [ios_vlans] #35

Open
wants to merge 11 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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.
108 changes: 108 additions & 0 deletions library/ios_facts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/usr/bin/python
# -*- 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 myos_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