summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorRohit Thakur <rohitthakur2590@outlook.com>2021-04-28 17:39:24 +0530
committerGitHub <noreply@github.com>2021-04-28 12:09:24 +0000
commite1c29bf3b6e0ba4887693fcc347d8887051aa148 (patch)
treed0cd7ae2fb73c8fab1cd470328564058a316faf8 /plugins
parentdccc17eb6956a9a09485b90198219559acd3a209 (diff)
downloadvyos-ansible-old-e1c29bf3b6e0ba4887693fcc347d8887051aa148.tar.gz
vyos-ansible-old-e1c29bf3b6e0ba4887693fcc347d8887051aa148.zip
VyOS: available_network_resources implemented in vyos_facts (#148)
VyOS: available_network_resources implemented in vyos_facts Reviewed-by: https://github.com/apps/ansible-zuul
Diffstat (limited to 'plugins')
-rw-r--r--plugins/module_utils/network/vyos/argspec/facts/facts.py1
-rw-r--r--plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py2
-rw-r--r--plugins/modules/vyos_facts.py14
3 files changed, 14 insertions, 3 deletions
diff --git a/plugins/module_utils/network/vyos/argspec/facts/facts.py b/plugins/module_utils/network/vyos/argspec/facts/facts.py
index d78dd3a..efd98e3 100644
--- a/plugins/module_utils/network/vyos/argspec/facts/facts.py
+++ b/plugins/module_utils/network/vyos/argspec/facts/facts.py
@@ -20,4 +20,5 @@ class FactsArgs(object): # pylint: disable=R0903
default=["!config"], type="list", elements="str"
),
"gather_network_resources": dict(type="list", elements="str"),
+ "available_network_resources": {"type": "bool", "default": False},
}
diff --git a/plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py b/plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py
index 7ef05cb..4057db5 100644
--- a/plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py
+++ b/plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py
@@ -40,7 +40,7 @@ class Ospf_interfacesFacts(object):
)
def get_config_set(self, data):
- """ To classify the configurations beased on interface """
+ """To classify the configurations beased on interface"""
interface_list = []
config_set = []
int_string = ""
diff --git a/plugins/modules/vyos_facts.py b/plugins/modules/vyos_facts.py
index 01c43c2..8bffcda 100644
--- a/plugins/modules/vyos_facts.py
+++ b/plugins/modules/vyos_facts.py
@@ -52,6 +52,10 @@ options:
required: false
type: list
elements: str
+ available_network_resources:
+ description: When 'True' a list of network resources for which resource modules are available will be provided.
+ type: bool
+ default: false
"""
EXAMPLES = """
@@ -140,6 +144,7 @@ from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.fac
)
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.facts import (
Facts,
+ FACT_RESOURCE_SUBSETS,
)
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
vyos_argument_spec,
@@ -165,9 +170,14 @@ def main():
"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()
-
- ansible_facts, additional_warnings = result
+ additional_facts, additional_warnings = result
+ ansible_facts.update(additional_facts)
warnings.extend(additional_warnings)
module.exit_json(ansible_facts=ansible_facts, warnings=warnings)