�
�Udac @` s6 d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l Z d d l m
Z
d d
l m Z d d l m Z d d l m Z d e f d � � YZ d e f d � � YZ d e f d � � YZ e d e d e � Z e e j � � Z d � Z e d k r2e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
module: ordnance_facts
version_added: "2.3"
author: "Alexander Turner (@alexanderturner) <[email protected]>"
short_description: Collect facts from Ordnance Virtual Routers over SSH
description:
- Collects a base set of device facts from an Ordnance Virtual
router over SSH. This module prepends all of the
base network fact keys with C(ansible_net_<fact>). The facts
module will always collect a base set of facts from the device
and can enable or disable collection of additional facts.
options:
gather_subset:
description:
- When supplied, this argument will restrict the facts collected
to a given subset. Possible values for this argument include
all, hardware, config, 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: '!config'
sH
---
# Note: examples below use the following provider dict to handle
# transport and authentication to the node.
vars:
cli:
host: "{{ inventory_hostname }}"
username: RouterName
password: ordnance
transport: cli
---
# Collect all facts from the device
- ordnance_facts:
gather_subset: all
provider: "{{ cli }}"
# Collect only the config and default facts
- ordnance_facts:
gather_subset:
- config
provider: "{{ cli }}"
# Do not collect hardware facts
- ordnance_facts:
gather_subset:
- "!hardware"
provider: "{{ cli }}"
s�
ansible_net_gather_subset:
description: The list of fact subsets collected from the virtual router
returned: always
type: list
# config
ansible_net_config:
description: The current active config from the virtual router
returned: when config is configured
type: str
# interfaces
ansible_net_all_ipv4_addresses:
description: All IPv4 addresses configured on the virtual router
returned: when interfaces is configured
type: list
ansible_net_all_ipv6_addresses:
description: All IPv6 addresses configured on the virtual router
returned: when interfaces is configured
type: list
ansible_net_interfaces:
description: A hash of all interfaces running on the virtual router
returned: when interfaces is configured
type: dict
N( t
NetworkModule( t iteritems( t zip( t to_nativet FactsBasec B` s e Z d � Z d � Z RS( c C` s% | | _ t � | _ t � | _ d S( N( t modulet dictt factst listt failed_commands( t selfR
( ( sS /usr/lib/python2.7/site-packages/ansible/modules/network/ordnance/ordnance_facts.pyt __init__k s c C` s@ y | j j | � d SWn! t k
r; | j j | � n Xd S( Ni ( R
t clit ExceptionR t append( R t cmd( ( sS /usr/lib/python2.7/site-packages/ansible/modules/network/ordnance/ordnance_facts.pyt runp s
( t __name__t
__module__R R ( ( ( sS /usr/lib/python2.7/site-packages/ansible/modules/network/ordnance/ordnance_facts.pyR i s t Configc B` s e Z d � Z RS( c C` s) | j d � } | r% | | j d <n d S( Ns show running-configt config( R R ( R t data( ( sS /usr/lib/python2.7/site-packages/ansible/modules/network/ordnance/ordnance_facts.pyt populatey s ( R R R ( ( ( sS /usr/lib/python2.7/site-packages/ansible/modules/network/ordnance/ordnance_facts.pyR w s t
Interfacesc B` sb e Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z
d � Z RS(
c C` s� t � | j d <t � | j d <| j d � } | r] | j | � } | j | � | j d <n | j d � } | r� | j | � } | j | � n d S( Nt all_ipv4_addressest all_ipv6_addressess show interfacest
interfacess show ipv6 interface( R R R t parse_interfacest populate_interfacest populate_ipv6_interfaces( R R R"