Merge branch 'master' of https://github.com/iwwwwwwi/salt-formula-lldp
diff --git a/lldp/client.sls b/lldp/client.sls
index b1d8e7f..132f702 100644
--- a/lldp/client.sls
+++ b/lldp/client.sls
@@ -7,13 +7,30 @@
pkg.installed:
- name: lldpd
+
+{%- if grains.lsb_distrib_codename == "trusty" %}
+/etc/default/lldpd:
+ file.managed:
+ - source: salt://lldp/files/lldpd
+ - template: jinja
+ - require:
+ - pkg: lldp_packages
+lldp_service:
+ service.running:
+ - enable: true
+ - name: {{ client.service }}
+ - watch:
+ - file: /etc/default/lldpd
+
+{%- endif %}
+
+{%- if grains.lsb_distrib_codename == "xenial" %}
/etc/lldpd.d/interfaces.conf:
file.managed:
- source: salt://lldp/files/interfaces.conf
- template: jinja
- require:
- pkg: lldp_packages
-
lldp_service:
service.running:
- enable: true
@@ -21,7 +38,7 @@
- watch:
- file: /etc/lldpd.d/interfaces.conf
-
+{%- endif %}
{%- endif %}
{%- endif %}
{%- endif %}
diff --git a/lldp/files/lldpd b/lldp/files/lldpd
new file mode 100644
index 0000000..04521a2
--- /dev/null
+++ b/lldp/files/lldpd
@@ -0,0 +1,3 @@
+{%- from "lldp/map.jinja" import client with context -%}
+# Restrict lldpd to only listen and send LLDPPDU on the following interfaces
+DAEMON_ARGS="-I {{ client.interfaces|join(',') }}"
diff --git a/lldp/init.sls b/lldp/init.sls
index 92140bf..55c79c0 100644
--- a/lldp/init.sls
+++ b/lldp/init.sls
@@ -1,4 +1,3 @@
-
include:
{% if pillar.lldp.client is defined %}
- lldp.client