# Why playbook is not taking updated IP from the inventory on the fly

**URL:** <https://forum.ansible.com/t/why-playbook-is-not-taking-updated-ip-from-the-inventory-on-the-fly/26341>\
**Category:** Ansible Project\
**Created:** [December 20, 2017, 1:05pm UTC](https://forum.ansible.com/t/why-playbook-is-not-taking-updated-ip-from-the-inventory-on-the-fly/26341 "2017-12-20T13:05:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DHAVAL\_JAISWAL](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@DHAVAL\_JAISWAL](https://forum.ansible.com/u/DHAVAL_JAISWAL)\
**Post date:** [December 20, 2017, 1:05pm UTC](https://forum.ansible.com/t/why-playbook-is-not-taking-updated-ip-from-the-inventory-on-the-fly/26341/1 "2017-12-20T13:05:30Z")

</div>

I have a situation where 1) updating IP in inventory through following shell and 2) using that IP it will perform some operation. However, child2.yml is  
not taking updated IP in inventory and still takes old IP.

Moreover, once job is finished its showing updated IP in the inventory. How can I achieve this so that it will take only updated IP.

- hosts: localhost  
gather\_facts: False  
connection: local  
vars\_files:
- “group\_vars/{{domainname}}”

tasks:

- name: get the elb IPs  
shell: sh /etc/ansible/elb\_grep\_ip.sh {{elb\_id}} {{domainname}}

- include: child2.yml

---

<div class="post-metadata">

**Author:** ![John\_Foley](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@John\_Foley](https://forum.ansible.com/u/John_Foley)\
**Post date:** [December 20, 2017, 5:52pm UTC](https://forum.ansible.com/t/why-playbook-is-not-taking-updated-ip-from-the-inventory-on-the-fly/26341/2 "2017-12-20T17:52:53Z")

</div>

You probably need to show us child2.yml…

---

<div class="post-metadata">

**Author:** ![DHAVAL\_JAISWAL](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@DHAVAL\_JAISWAL](https://forum.ansible.com/u/DHAVAL_JAISWAL)\
**Post date:** [December 20, 2017, 6:10pm UTC](https://forum.ansible.com/t/why-playbook-is-not-taking-updated-ip-from-the-inventory-on-the-fly/26341/3 "2017-12-20T18:10:07Z")

</div>

child2.yml

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [December 23, 2017, 10:11am UTC](https://forum.ansible.com/t/why-playbook-is-not-taking-updated-ip-from-the-inventory-on-the-fly/26341/4 "2017-12-23T10:11:01Z")

</div>

What does /etc/ansible/elb\_grep\_ip.sh exactly do?
