elastic/ansible-beats

Using ansible-beats conflict with using ansible-elasticsearch at the same time

Closed this issue · 1 comments

astik commented

Here is the content of elastic.beats var/main.yml :

---
# vars file for beats

beats_package_url: "https://download.elastic.co/beats"
es_conf_dir: "/etc"

It overrides the es_conf_dir set by elastic.elasticsearch :

es_conf_dir: "/etc/elasticsearch"

That is not ok as when we are using both roles in the same playbook processsing, we got /etc folder which gets broken :

$ sudo ls -al /etc/ | grep elasticsearch
drwxr-xr-x 83 elasticsearch elasticsearch  4096 Jul 21 13:54 .
drwxr-s---  2 root          elasticsearch  4096 Jul 21 13:54 elasticsearch
-rw-rw----  1 elasticsearch elasticsearch   199 Jul 21 13:54 elasticsearch.keystore
-rw-r--r--  1 elasticsearch elasticsearch   351 Jul 21 13:54 elasticsearch.yml
-rw-r--r--  1 elasticsearch elasticsearch  2580 Jul 21 13:54 jvm.options
-rw-r--r--  1 elasticsearch elasticsearch  5090 Jul 21 13:54 log4j2.properties
drwxr-xr-x  4 elasticsearch elasticsearch  4096 Jun 18 17:36 security

More interesting, es_conf_dir is not used anywhere in elastic.beats role. Therefore, it does not seems to serve any purpose and should be removed.

Settings the variable es_conf_dir explicitly in inventory does not seem to change anything as elastic.beats one is still used.

astik commented

After fixing the es_conf_dir duplicate variable definition, i encounter another issue. It looks like this ansible/ansible#12738 (comment) ... custom filter with same name conflict.

Role elastic.elasticsearch is shipping a custom filter filter_plugins/custom.py so does elastic.beats.

Solution given in the link above is to rename custom filter in order to have unique name (which might not be perfect but easy to do).

The other way is to get rid of the filter in elastic.beats as it does not do much (it only wrap variable into a new object structure which can be done inside templating anyway)