Exemplo n.º 1
0
def main():
    """
    Main entry point for module execution

    :returns: ansible_facts
    """
    argument_spec = FactsArgs.argument_spec
    argument_spec.update(ios_argument_spec)

    module = AnsibleModule(
        argument_spec=argument_spec, supports_check_mode=True
    )

    warnings = []
    if module.params["gather_subset"] == "!config":
        warnings.append(
            "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)
Exemplo n.º 2
0
def main():
    """
    Main entry point for module execution

    :returns: ansible_facts
    """
    argument_spec = FactsArgs.argument_spec
    argument_spec.update(ios_argument_spec)
    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)
    warnings = []
    if module.params["gather_subset"] == "!config":
        warnings.append(
            "default value for `gather_subset` will be changed to `min` from `!config` v2.11 onwards"
        )

    ansible_facts = {}
    if module.params.get("available_network_resources"):
        ansible_facts["available_network_resources"] = sorted(
            FACT_RESOURCE_SUBSETS.keys())
    result = Facts(module).get_facts()
    additional_facts, additional_warnings = result
    ansible_facts.update(additional_facts)
    warnings.extend(additional_warnings)
    module.exit_json(ansible_facts=ansible_facts, warnings=warnings)
Exemplo n.º 3
0
 def __init__(self, module):
     super(Bgp_global, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="bgp_global",
         tmplt=Bgp_globalTemplate(),
     )
Exemplo n.º 4
0
 def __init__(self, module):
     super(Ospfv3, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="ospfv3",
         tmplt=Ospfv3Template(),
     )
Exemplo n.º 5
0
 def __init__(self, module):
     super(Acl_interfaces, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="acl_interfaces",
         tmplt=Acl_interfacesTemplate(),
     )
Exemplo n.º 6
0
 def __init__(self, module):
     super(Bgp_address_family, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="bgp_address_family",
         tmplt=Bgp_address_familyTemplate(),
     )
Exemplo n.º 7
0
 def __init__(self, module):
     super(Route_maps, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="route_maps",
         tmplt=Route_mapsTemplate(),
     )
Exemplo n.º 8
0
 def __init__(self, module):
     super(Prefix_lists, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="prefix_lists",
         tmplt=Prefix_listsTemplate(),
     )
     self.parsers = ["prefix_list"]
Exemplo n.º 9
0
 def __init__(self, module):
     super(Interfaces, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="interfaces",
         tmplt=InterfacesTemplate(),
     )
     self.parsers = ["description", "enabled", "speed", "mtu", "duplex"]
Exemplo n.º 10
0
 def __init__(self, module):
     super(Ospf_Interfaces, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="ospf_interfaces",
         tmplt=Ospf_InterfacesTemplate(),
     )
     self.parsers = []
Exemplo n.º 11
0
 def __init__(self, module):
     super(Hostname, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="hostname",
         tmplt=HostnameTemplate(),
     )
     self.parsers = ["hostname"]
Exemplo n.º 12
0
    def get_l3_interfaces_facts(self):
        """ Get the 'facts' (the current configuration)
        :rtype: A dictionary
        :returns: The current configuration as a dictionary
        """
        facts, _warnings = Facts(self._module).get_facts(self.gather_subset, self.gather_network_resources)
        l3_interfaces_facts = facts['ansible_network_resources'].get('l3_interfaces')
        if not l3_interfaces_facts:
            return []

        return l3_interfaces_facts
Exemplo n.º 13
0
    def get_vlans_facts(self, data=None):
        """ Get the 'facts' (the current configuration)

        :rtype: A dictionary
        :returns: The current configuration as a dictionary
        """
        facts, _warnings = Facts(self._module).get_facts(
            self.gather_subset, self.gather_network_resources, data=data)
        interfaces_facts = facts["ansible_network_resources"].get("vlans")
        if not interfaces_facts:
            return []
        return interfaces_facts
Exemplo n.º 14
0
    def get_acl_facts(self, data=None):
        """ Get the 'facts' (the current configuration)

        :rtype: A dictionary
        :returns: The current configuration as a dictionary
        """
        facts, _warnings = Facts(self._module).get_facts(
            self.gather_subset, self.gather_network_resources, data=data)
        acl_facts = facts['ansible_network_resources'].get('acls')
        if not acl_facts:
            return []

        return acl_facts
Exemplo n.º 15
0
    def get_lacp_facts(self):
        """ Get the 'facts' (the current configuration)

        :rtype: A dictionary
        :returns: The current configuration as a dictionary
        """
        facts, _warnings = Facts(self._module).get_facts(
            self.gather_subset, self.gather_network_resources)
        lacp_facts = facts["ansible_network_resources"].get("lacp")
        if not lacp_facts:
            return []

        return lacp_facts
Exemplo n.º 16
0
    def get_lldp_global_facts(self, data=None):
        """Get the 'facts' (the current configuration)

        :rtype: A dictionary
        :returns: The current configuration as a dictionary
        """
        facts, _warnings = Facts(self._module).get_facts(
            self.gather_subset, self.gather_network_resources, data=data)
        lldp_global_facts = facts["ansible_network_resources"].get(
            "lldp_global")
        if not lldp_global_facts:
            return {}

        return lldp_global_facts
Exemplo n.º 17
0
 def __init__(self, module):
     super(L3_interfaces, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="l3_interfaces",
         tmplt=L3_interfacesTemplate(),
     )
     self.parsers = [
         "ipv4.address",
         "ipv4.pool",
         "ipv4.dhcp",
         "ipv6.address",
         "ipv6.autoconfig",
         "ipv6.dhcp",
     ]
Exemplo n.º 18
0
def main():
    """ Main entry point for AnsibleModule
    """
    argument_spec = FactsArgs.argument_spec
    argument_spec.update(ios_argument_spec)

    module = AnsibleModule(argument_spec=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)
Exemplo n.º 19
0
    def __init__(self, module):
        super(Logging_global, self).__init__(
            empty_fact_val={},
            facts_module=Facts(module),
            module=module,
            resource="logging_global",
            tmplt=Logging_globalTemplate(),
        )
        self.parsers = [
            "hosts",
            "hosts.transport",
            "buffered",
            "buginf",
            "cns_events",
            "console",
            "count",
            "delimiter",
            "discriminator",
            "dmvpn",
            "esm",
            "exception",
            "facility",
            "filter",
            "history",
            "message_counter",
            "monitor",
            "logging_on",
            "origin_id",
            "persistent",
            "policy_firewall",
            "queue_limit",
            "rate_limit",
            "reload",
            "server_arp",
            "snmp_trap",
            "source_interface",
            "trap",
            "userinfo",
        ]

        self.exclude = {"want": [], "have": []}
Exemplo n.º 20
0
def main():
    """
    Main entry point for module execution

    :returns: ansible_facts
    """
    argument_spec = FactsArgs.argument_spec
    argument_spec.update(ios_argument_spec)
    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)
    warnings = []

    ansible_facts = {}
    if module.params.get("available_network_resources"):
        ansible_facts["available_network_resources"] = sorted(
            FACT_RESOURCE_SUBSETS.keys())
    result = Facts(module).get_facts()
    additional_facts, additional_warnings = result
    ansible_facts.update(additional_facts)
    warnings.extend(additional_warnings)
    module.exit_json(ansible_facts=ansible_facts, warnings=warnings)
Exemplo n.º 21
0
 def __init__(self, module):
     super(Ntp_global, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="ntp_global",
         tmplt=Ntp_globalTemplate(),
     )
     self.parsers = [
         "allow.control.rate_limit",
         "allow.private",
         "authenticate",
         "broadcast_delay",
         "clock_period",
         "logging",
         "master.enabled",
         "master.stratum",
         "max_associations",
         "max_distance",
         "min_distance",
         "orphan",
         "panic_update",
         "passive",
         "source",
         "update_calendar",
     ]
     self.complex_parser = [
         "peer",
         "query_only",
         "serve",
         "serve_only",
         "authentication_keys",
         "peers",
         "servers",
         "trusted_keys",
     ]
Exemplo n.º 22
0
 def __init__(self, module):
     super(Snmp_server, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="snmp_server",
         tmplt=Snmp_serverTemplate(),
     )
     self.parsers = [
         "accounting",
         "cache",
         "chassis_id",
         "contact",
         "drop",
         "file_transfer",
         "if_index",
         "inform",
         "ip",
         "location",
         "manager",
         "packet_size",
         "queue_length",
         "trap_timeout",
         "source_interface",
         "trap_source",
         "system_shutdown",
     ]
     self.list_parsers = [
         "hosts",
         "groups",
         "engine_id",
         "communities",
         "context",
         "password_policy",
         "users",
         "views",
     ]
     self.complex_parsers = [
         "traps.auth_framework",
         "traps.bfd",
         "traps.bgp",
         "traps.bridge",
         "traps.casa",
         "traps.cnpd",
         "traps.config",
         "traps.config_copy",
         "traps.config_ctid",
         "traps.dhcp",
         "traps.eigrp",
         "traps.entity",
         "traps.energywise",
         "traps.event_manager",
         "traps.flowmon",
         "traps.fru_ctrl",
         "traps.hsrp",
         "traps.ipsla",
         "traps.isis",
         "traps.msdp",
         "traps.mvpn",
         "traps.mpls_vpn",
         "traps.pki",
         "traps.pw_vc",
         "traps.rsvp",
         "traps.syslog",
         "traps.transceiver_all",
         "traps.tty",
         "traps.vrrp",
         "traps.vrfmib",
         "traps.ipmulticast",
         "traps.ike.policy.add",
         "traps.ike.policy.delete",
         "traps.ike.tunnel.start",
         "traps.ike.tunnel.stop",
         "traps.ipsec.cryptomap.add",
         "traps.ipsec.cryptomap.delete",
         "traps.ipsec.cryptomap.attach",
         "traps.ipsec.cryptomap.detach",
         "traps.ipsec.tunnel.start",
         "traps.ipsec.tunnel.stop",
         "traps.ipsec.too_many_sas",
         "traps.ospf.cisco_specific.error",
         "traps.ospf.cisco_specific.retransmit",
         "traps.ospf.cisco_specific.lsa",
         "traps.ospf.cisco_specific.state_change.nssa_trans_change",
         "traps.ospf.cisco_specific.state_change.shamlink.interface",
         "traps.ospf.cisco_specific.state_change.shamlink.neighbor",
         "traps.ospf.error",
         "traps.ospf.retransmit",
         "traps.ospf.lsa",
         "traps.ospf.state_change",
         "traps.l2tun.pseudowire_status",
         "traps.l2tun.session",
         "traps.cpu",
         "traps.firewall",
         "traps.pim",
         "traps.snmp",
         "traps.frame_relay",
         "traps.frame_relay.subif",
         "traps.cef",
         "traps.dlsw",
         "traps.ethernet.evc",
         "traps.ethernet.cfm.alarm",
         "traps.ethernet.cfm.cc",
         "traps.ethernet.cfm.crosscheck",
     ]