diff --git a/.github/BOTMETA.yml b/.github/BOTMETA.yml index 9da4d136ea..f391b3a629 100644 --- a/.github/BOTMETA.yml +++ b/.github/BOTMETA.yml @@ -915,7 +915,7 @@ files: maintainers: zbal $modules/listen_ports_facts.py: maintainers: ndavison - $modules/lldp.py: + $modules/lldp_facts.py: ignore: andyhky labels: lldp $modules/locale_gen.py: diff --git a/changelogs/fragments/lldp.yml b/changelogs/fragments/lldp.yml new file mode 100644 index 0000000000..1a096e6203 --- /dev/null +++ b/changelogs/fragments/lldp.yml @@ -0,0 +1,3 @@ +minor_changes: + - lldp - the module has been renamed to ``community.general.lldp_facts`` (https://github.com/ansible-collections/community.general/pull/11980). + - lldp - the module now supports check mode (https://github.com/ansible-collections/community.general/pull/11980). diff --git a/meta/runtime.yml b/meta/runtime.yml index bbd4746574..745520566d 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -430,6 +430,9 @@ plugin_routing: redirect: community.kubevirt.kubevirt_template kubevirt_vm: redirect: community.kubevirt.kubevirt_vm + lldp: + # TODO: introduce deprecation warning in 14.0.0 + redirect: community.general.lldp_facts layman: deprecation: removal_version: 14.0.0 diff --git a/plugins/modules/listen_ports_facts.py b/plugins/modules/listen_ports_facts.py index 2eb49acb75..27dd361799 100644 --- a/plugins/modules/listen_ports_facts.py +++ b/plugins/modules/listen_ports_facts.py @@ -23,6 +23,9 @@ extends_documentation_fragment: - community.general._attributes - community.general._attributes.facts - community.general._attributes.facts_module +attributes: + check_mode: + version_added: 13.0.0 options: command: description: diff --git a/plugins/modules/lldp.py b/plugins/modules/lldp_facts.py similarity index 86% rename from plugins/modules/lldp.py rename to plugins/modules/lldp_facts.py index d8b44564ee..ff51b44f2a 100644 --- a/plugins/modules/lldp.py +++ b/plugins/modules/lldp_facts.py @@ -7,19 +7,19 @@ from __future__ import annotations DOCUMENTATION = r""" -module: lldp +module: lldp_facts requirements: - C(lldpctl), usually provided by the C(lldpd) package. + - The module was renamed from C(lldp) to C(lldp_facts) in community.general 13.0.0. + The old name is available as an alias. Eventually a deprecation message will be shown + when the old name is used. short_description: Get details reported by LLDP description: - Reads LLDP data from C(lldpd) using the CLI tool C(lldpctl). extends_documentation_fragment: - community.general._attributes -attributes: - check_mode: - support: none - diff_mode: - support: none + - community.general._attributes.facts + - community.general._attributes.facts_module options: multivalues: description: If C(lldpctl) outputs an attribute multiple time represent all values as a list. @@ -46,6 +46,18 @@ EXAMPLES = r""" # ok: [10.13.0.22] => (item=eth0) => {"item": "eth0", "msg": "switch3.example.com / Gi0/3"} """ +RESULTS = r""" +ansible_facts: + description: The returned facts. + returned: success + type: dict + contains: + lldp: + descrition: + - The parsed output. + type: dict +""" + from ansible.module_utils.basic import AnsibleModule @@ -95,7 +107,7 @@ def gather_lldp(module): def main(): module_args = dict(multivalues=dict(type="bool", default=False)) - module = AnsibleModule(module_args) + module = AnsibleModule(module_args, supports_check_mode=True) module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} lldp_output = gather_lldp(module)