How flush cached inventory hosts ini

Hello from france ;- )

How can i flush the cache inventory please ?

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

before

[group_1]
srv1.group1
srv2.group1

[group2]
srv1.group2
srv2.group2

After

[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 :wink:

Have you got an idea please ?

Thanks a lot :wink: for the help

REctification :slight_smile:

My hosts looks like this

# -> 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

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

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.

1 Like