# add\_host case sensitive.

**URL:** <https://forum.ansible.com/t/add-host-case-sensitive/27248>\
**Category:** Ansible Developer\
**Created:** [April 11, 2018, 1:37pm UTC](https://forum.ansible.com/t/add-host-case-sensitive/27248 "2018-04-11T13:37:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marek\_Slebodnik](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Marek\_Slebodnik](https://forum.ansible.com/u/Marek_Slebodnik)\
**Post date:** [April 11, 2018, 1:37pm UTC](https://forum.ansible.com/t/add-host-case-sensitive/27248/1 "2018-04-11T13:37:56Z")

</div>

Hello,

I’ve got playbook with dynamic inventory. And what bothers me is, that add\_host is case sensitive.

So when I have in my initial inventory

---

<div class="post-metadata">

**Author:** ![Andrew\_Gaffney](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@Andrew\_Gaffney](https://forum.ansible.com/u/Andrew_Gaffney)\
**Post date:** [April 11, 2018, 3:20pm UTC](https://forum.ansible.com/t/add-host-case-sensitive/27248/2 "2018-04-11T15:20:19Z")

</div>

Instead of modifying add\_host to ignore case, why not just pass the values through the jinja2 ‘lower’ filter when passing them to add\_host in your playbook? You can even do something like the following to de-dupe with existing inventory hosts:

{{ (list\_with\_new\_hosts | map(“lower”)) | difference(groups.all | map(“lower”)) }}

This will give you a list of hosts that only exist in the new list, taking into account case differences, with all results in lowercase.

---

<div class="post-metadata">

**Author:** ![Marek\_Slebodnik](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Marek\_Slebodnik](https://forum.ansible.com/u/Marek_Slebodnik)\
**Post date:** [April 11, 2018, 4:01pm UTC](https://forum.ansible.com/t/add-host-case-sensitive/27248/3 "2018-04-11T16:01:38Z")

</div>

thanks for pointing map, previously I had in my playbook temporary facts.
