# Filebeat Ansible Tags

**URL:** <https://discuss.elastic.co/t/filebeat-ansible-tags/225430>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [March 27, 2020, 3:13pm UTC](https://discuss.elastic.co/t/filebeat-ansible-tags/225430 "2020-03-27T15:13:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![santos1204](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@santos1204](https://discuss.elastic.co/u/santos1204)\
**Post date:** [March 27, 2020, 3:13pm UTC](https://discuss.elastic.co/t/filebeat-ansible-tags/225430/1 "2020-03-27T15:13:49Z")

</div>

Hi,

I'm trying to pass tags using an ansible variable from each beats host, so that I can filter on those tags inside Kibana. I've tried several methods, but the tags don't seem to show.

Whats the best way to achieve this?

Thanks,

Chris

---

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [March 27, 2020, 4:35pm UTC](https://discuss.elastic.co/t/filebeat-ansible-tags/225430/2 "2020-03-27T16:35:47Z")

</div>

I used to do this in logstash pipelines during development debugging, but I've removed the code since then.

You would need to template your beats config files, then it would be something like this:

```
processors:
- add_tags:
    tags: [{{ ansible_fqdn }}]

```

You could use ansible\_hostname for the shorter name.

---

<div class="post-metadata">

**Author:** ![santos1204](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@santos1204](https://discuss.elastic.co/u/santos1204)\
**Post date:** [March 30, 2020, 10:39am UTC](https://discuss.elastic.co/t/filebeat-ansible-tags/225430/3 "2020-03-30T10:39:06Z")

</div>

Thanks @rugenl That did the trick!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 27, 2020, 10:39am UTC](https://discuss.elastic.co/t/filebeat-ansible-tags/225430/4 "2020-04-27T10:39:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
