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

22 views
Skip to first unread message

bablu

unread,
Dec 20, 2017, 8:05:30 AM12/20/17
to Ansible Project
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

John Foley

unread,
Dec 20, 2017, 12:52:53 PM12/20/17
to Ansible Project
You probably need to show us child2.yml....

bablu

unread,
Dec 20, 2017, 1:10:08 PM12/20/17
to Ansible Project
child2.yml

---------------------
- hosts: test1
  remote_user: user1
  tasks:
   - name: Fetch ansible file from client
     fetch: src=/tmp/{{certname}} dest=/home/test/ flat=yes

- hosts: "{{domainname}}"
  remote_user: user1

  tasks:
   - name: Copy file to client1
     copy: src=/home/test/{{certname}} dest=/home/tomcat-user/ owner=tomcat-user group=tomcat-user mode=0644
     sudo: true

- hosts: "{{domainname}}"
  remote_user: user1
  vars_files:
   - "group_vars/{{domainname}}"

  tasks:
   - name: check files
     command: 'ls -lrt /home/tomcat-user/{{certname}}'
     sudo: true

Dick Visser

unread,
Dec 23, 2017, 5:11:30 AM12/23/17
to ansible...@googlegroups.com
What does /etc/ansible/elb_grep_ip.sh exactly do?


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9b456e4a-f7bd-472a-9daa-34b16aee4573%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Dick Visser
GÉANT

Want to join us? We're hiring: https://www.geant.org/jobs
Reply all
Reply to author
Forward
0 new messages