diff options
Diffstat (limited to 'plugins/modules/vyos_facts.py')
-rw-r--r-- | plugins/modules/vyos_facts.py | 14 |
1 files changed, 12 insertions, 2 deletions
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) |