Note
This plugin is part of the junipernetworks.junos collection.
To install it use: ansible-galaxy collection install junipernetworks.junos
.
To use it in a playbook, specify: junipernetworks.junos.junos_lldp_interfaces
.
New in version 1.0.0: of junipernetworks.junos
Note
This module has a corresponding action plugin.
Parameter | Choices/Defaults | Comments | |
---|---|---|---|
config list / elements=dictionary | The list of link layer discovery protocol interface attribute configurations | ||
enabled boolean |
| This is a boolean value to control disabling of LLDP on the interface name
| |
name string / required | Name of the interface LLDP needs to be configured on. | ||
running_config string | This option is used only with state parsed. The value of this option should be the output received from the Junos device by executing the command show protocols lldp. The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result | ||
state string |
| The state of the configuration after module completion. |
# Using merged # Before state: # ------------- # user@junos01# # show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; - name: Merge provided configuration with device configuration junipernetworks.junos.junos_lldp_interfaces: config: - name: ge-0/0/1 - name: ge-0/0/2 enabled: false state: merged # After state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } # Using replaced # Before state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } - name: Replace provided configuration with device configuration junipernetworks.junos.junos_lldp_interfaces: config: - name: ge-0/0/2 disable: false - name: ge-0/0/3 enabled: false state: replaced # After state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/1; # interface ge-0/0/2; # interface ge-0/0/3 { # disable; # } # Using overridden # Before state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } - name: Override provided configuration with device configuration junipernetworks.junos.junos_lldp_interfaces: config: - name: ge-0/0/2 enabled: false state: overridden # After state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/2 { # disable; # } # Using deleted # Before state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/1; # interface ge-0/0/2; # interface ge-0/0/3 { # disable; # } - name: Delete lldp interface configuration (this will not delete other lldp configuration) junipernetworks.junos.junos_lldp_interfaces: config: - name: ge-0/0/1 - name: ge-0/0/3 state: deleted # After state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/2; # interface ge-0/0/1; # Using gathered # Before state: # ------------ # #ansible@cm123456tr21# show protocols lldp # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } - name: Gather junos lldp interfaces as in given arguments junipernetworks.junos.junos_lldp_interfaces: state: gathered # Task Output (redacted) # ----------------------- # # "gathered": [ # { # "name": "ge-0/0/1" # }, # { # "enabled": false, # "name": "ge-0/0/2" # } # ] # After state: # ------------ # #ansible@cm123456tr21# show protocols lldp # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } # Using rendered - name: Render platform specific xml from task input using rendered state junipernetworks.junos.junos_lldp_interfaces: config: - name: ge-0/0/1 - name: ge-0/0/2 enabled: false state: rendered # Task Output (redacted) # ----------------------- # "rendered": "<nc:protocols # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:lldp> # <nc:interface> # <nc:name>ge-0/0/1</nc:name> # <nc:disable delete="delete"/> # </nc:interface> # <nc:interface> # <nc:name>ge-0/0/2</nc:name> # <nc:disable/> # </nc:interface> # </nc:lldp> # </nc:protocols>" # Using parsed # parsed.cfg # ------------ # # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <protocols> # <ospf> # <area> # <name>0.0.0.0</name> # <interface> # <name>ge-0/0/0.0</name> # </interface> # </area> # </ospf> # <lldp> # <interface> # <name>ge-0/0/1</name> # </interface> # <interface> # <name>ge-0/0/2</name> # <disable/> # </interface> # </lldp> # </protocols> # </configuration> # </rpc-reply> # - name: Convert lldp interfaces config to argspec without connecting to the appliance # junipernetworks.junos.junos_lldp_interfaces: # running_config: "{{ lookup('file', './parsed.cfg') }}" # state: parsed # Task Output (redacted) # ----------------------- # "parsed": [ # { # "name": "ge-0/0/1" # }, # { # "enabled": false, # "name": "ge-0/0/2" # } # ]
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
after list / elements=string | when changed | The configuration as structured data after module completion. Sample: The configuration returned will always be in the same format of the parameters above. |
before list / elements=string | always | The configuration as structured data prior to module invocation. Sample: The configuration returned will always be in the same format of the parameters above. |
commands list / elements=string | always | The set of commands pushed to the remote device. Sample: ['<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:lldp> <nc:interface> <nc:name>ge-0/0/1</nc:name> <nc:disable delete="delete"/> </nc:interface> <nc:interface> <nc:name>ge-0/0/2</nc:name> <nc:disable/> </nc:interface> </nc:lldp> </nc:protocols>', 'xml 2', 'xml 3'] |
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/junipernetworks/junos/junos_lldp_interfaces_module.html