# How flush cached inventory hosts ini

**URL:** <https://forum.ansible.com/t/how-flush-cached-inventory-hosts-ini/3411>\
**Category:** Get Help\
**Created:** [January 21, 2024, 12:56pm UTC](https://forum.ansible.com/t/how-flush-cached-inventory-hosts-ini/3411 "2024-01-21T12:56:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pepite](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@pepite](https://forum.ansible.com/u/pepite)\
**Post date:** [January 21, 2024, 12:56pm UTC](https://forum.ansible.com/t/how-flush-cached-inventory-hosts-ini/3411/1 "2024-01-21T12:56:14Z")

</div>

Hello from france ;- )

How can i flush the cache inventory please ?

I use inventory hosts ini like this 🙂  
i change the hosts under the group in prod

**before**

```auto
[group_1]
srv1.group1
srv2.group1

[group2]
srv1.group2
srv2.group2

```

**After**

```auto
[group1]
srv.group2
srv.group2

[group2]
srv1.new
srv2.new

```

**ansible inventory graph is ok with the “after inventory”**  
BUT  
`ansible group1 -i hosts -m ping`

results with  
_before inventory **AND** after inventory_

I try playbook with meta : refresh\_inventory but there is no effect on the ansible ping

I also try to launch the playbook, with the group1 but it’s deploy on the new and former servers 😉

Have you got an idea please ?

Thanks a lot 😉 for the help

REctification 🙂

My hosts looks like this

```auto
# -> DEV #
# #---------#
[epart_dev]
srv1.a2962
srv2.a2962

# # -> IA #
# #---------#
[epart_ia]
srv1.b0711
srv2.b0711
srv3.b0711
srv4.b0711
#
# # -> IIA #
# #---------#
[epart_iia]
srv1.b0675
srv2.b0675
srv3.b0675
srv4.b0675

```

and my graph keep former and newest servers

```auto
ansible-inventory -i inventories/socle2022/ --graph
  |--@epart_dev:
  | |--srv1.a2962
  | |--srv2.a2962
  |--@epart_ia:
  | |--srv1.a2962
  | |--srv2.a2962
  | |--srv1.b0711
  | |--srv2.b0711
  | |--srv3.b0711
  | |--srv4.b0711
  |--@epart_iia:
  | |--srv1.b0711
  | |--srv2.b0711
  | |--srv3.b0711
  | |--srv4.b0711
  | |--srv1.b0675
  | |--srv2.b0675
  | |--srv3.b0675
  | |--srv4.b0675

```

I dont find how fklush and why

---

<div class="post-metadata">

**Author:** ![bcoca](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bcoca/32/9269_2.png) [@bcoca](https://forum.ansible.com/u/bcoca)\
**Post date:** [January 22, 2024, 6:09pm UTC](https://forum.ansible.com/t/how-flush-cached-inventory-hosts-ini/3411/2 "2024-01-22T18:09:47Z")

</div>

There is no inventory cache across invocations, since you are using a directory as an inventory source i’m going to guess you have older copies of the inventory there.
