Skip to content

Commit 63ec7ba

Browse files
authored
feat: Add LLDP support for node attributes (#18)
1 parent 00747ab commit 63ec7ba

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@ In addition to es_config, the following parameters allow the customization of th
423423
- `es_use_repository` Setting this to `false` will stop Ansible from using the official Elastic package from any repository configured on the system.
424424
- `es_add_repository` Setting this to `false` will stop Ansible to add the official Elastic package repositories (if es_use_repository is true) if you want to use a repo already present.
425425
- `es_custom_package_url` the URL to the rpm or deb package for Ansible to install. When using this you will also need to set `es_use_repository: false` and make sure that the `es_version` matches the version being installed from your custom URL. E.g. `es_custom_package_url: https://downloads.example.com/elasticsearch.rpm`
426+
- `es_identifier_string` String to search for LLDP neighbors to be used as value for `es_identifier_attribute`.
427+
- `es_identifier_attribute` Node attribute name declared in elasticsearch.yml as `node.attr.<name>`.
426428

427429
Earlier examples illustrate the installation of plugins using `es_plugins`. For officially supported plugins no version or source delimiter is required. The plugin script will determine the appropriate plugin version based on the target Elasticsearch version. For community based plugins include the full url. This approach should NOT be used for the X-Pack plugin. See X-Pack below for details here.
428430

templates/elasticsearch.yml.j2

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
{% if es_config %}
33
{{ es_config | to_nice_yaml(indent=2) }}
44
{% endif %}
5+
{% if ansible_local.lldp is defined %}
6+
{% for interface in ansible_local.lldp.lldp.interface %}
7+
{% set iface_data = interface.get(ansible_default_ipv4.interface) %}
8+
{% set chassis_key = iface_data.chassis.keys() | list | first %}
9+
{% if es_identifier_string in chassis_key %}
10+
node.attr.{{ es_identifier_attribute }}: {{ chassis_key }}
11+
{% endif %}
12+
{% endfor %}
13+
{% endif %}
514

615
{% if es_config['cluster.name'] is not defined %}
716
cluster.name: elasticsearch

0 commit comments

Comments
 (0)