Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
5b5f2e6d
Commit
5b5f2e6d
authored
Dec 18, 2013
by
Andy Hill
Committed by
Michael DeHaan
Mar 28, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lldp: Added EXAMPLES
parent
8ca70ec4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
library/net_infrastructure/lldp
+18
-2
No files found.
library/net_infrastructure/lldp
View file @
5b5f2e6d
...
@@ -19,15 +19,31 @@ import subprocess
...
@@ -19,15 +19,31 @@ import subprocess
DOCUMENTATION
=
'''
DOCUMENTATION
=
'''
---
---
module: lldp
module: lldp
short_description: get details reported by lldp
short_description: get details reported by lldp
description:
description:
- Reads data out of lldp
- Reads data out of lldp
ctl
author: Andy Hill
author: Andy Hill
notes:
notes:
- Requires lldpd running and lldp enabled on switches
- Requires lldpd running and lldp enabled on switches
'''
'''
EXAMPLES
=
'''
# Retrieve switch/port information
- name: Gather information from lldp
lldp:
- name: Print each switch/port
debug: msg="{{ lldp[item]['chassis']['name'] }} / {{ lldp[item]['port']['ifalias'] }}
with_items: lldp.keys()
# TASK: [Print each switch/port] ***********************************************************
# ok: [10.13.0.22] => (item=eth2) => {"item": "eth2", "msg": "switch1.example.com / Gi0/24"}
# ok: [10.13.0.22] => (item=eth1) => {"item": "eth1", "msg": "switch2.example.com / Gi0/3"}
# ok: [10.13.0.22] => (item=eth0) => {"item": "eth0", "msg": "switch3.example.com / Gi0/3"}
'''
def
gather_lldp
():
def
gather_lldp
():
cmd
=
[
'lldpctl'
,
'-f'
,
'keyvalue'
]
cmd
=
[
'lldpctl'
,
'-f'
,
'keyvalue'
]
proc
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
)
proc
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment